View previous topic :: View next topic |
Author |
Message |
ArielT
Joined: 26 Jan 2010 Posts: 30
|
Posted: Sat May 15, 2010 8:53 Post subject: Hashset efficiency |
|
|
How efficient is the nwnx hashset plugin when used as an array? The PRC creates arrays by using in game strings, would the hashset plugin improve on this speed?
Is there a better way to implement a modifiable array? |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Sat May 15, 2010 11:54 Post subject: |
|
|
The hashset plugin is great for when you want to store key/value pairs. It is not, as such, an array, but I'd imagine you could use it as one anyway if you wanted and it would be alright, certainly better than mucking about with NWN local variables. |
|
Back to top |
|
|
ArielT
Joined: 26 Jan 2010 Posts: 30
|
Posted: Sat May 15, 2010 12:41 Post subject: |
|
|
Fireboar wrote: | The hashset plugin is great for when you want to store key/value pairs. It is not, as such, an array, but I'd imagine you could use it as one anyway if you wanted and it would be alright, certainly better than mucking about with NWN local variables. | Well, I suppose I could try to write an array plugin fairly simply. The transition time with NWNX isn't too long, then? |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Sat May 15, 2010 23:31 Post subject: |
|
|
Well nwnx uses locals too, so imo short array wont be more eficient with nwnx, especialy with objects. Also only string local variable is hooked so you will have to always convert input into string, then twice again in plugin and again when you retrieve local in nwscript.
However the more fields the more efficient the plugin solution will be because of locals retrieval from the same object.
Personally, since I learnt how to use advantages of mysql, i dont need (pseudo) arrays or lists anymore... _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
ArielT
Joined: 26 Jan 2010 Posts: 30
|
Posted: Sun May 16, 2010 1:19 Post subject: |
|
|
ShaDoOoW wrote: | Personally, since I learnt how to use advantages of mysql, i dont need (pseudo) arrays or lists anymore... | How so? |
|
Back to top |
|
|
ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Sun May 16, 2010 5:06 Post subject: |
|
|
because you can use mysql for this purpose
two column table for list, three colums for 2d array or more for specific one
using autoincrement integer as first column you get list/array functionality...
EDIT: to be honest, im not using this, im using list only for players to avoid multi loop, and for that locals works good... but when I think about this, maybe i could reconsider event based scripting (like in PRC) with mysql it could be pretty efficient _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|
Back to top |
|
|
|