<tossing another...>
Lightfoot8 wrote...
...
It was also noted somewhere in the mess above that the method you are useing is already in the "nw_o0_itemmaker" #include. with the functions SetLocalArrayString and SetLocalArrayInt.
So yes your method works. Some of us however like to complicate things to our own liking.
L8
Do you have any idea how much I cried <ranted, screamed, pleaded...> when Don told us we wouldn't have arrays? Almost as loud as when we learned we weren't getting a socket for 3rd party apps.
How much skull sweat we put into work-arounds that were *all* moot?!
Didn't really understand why until I read
Skywing's analysis of the NwScript interpreter.
No registers. All stack. Fixed cells. Two pointers. Second pointer stored *on the stack*.
Pseudo-arrays (have you looked at the way they work? Ack.) jump through hoops to pretend to be arrays which we are familiar with (well, *I* am).
From the Lexicon
Although this is hardly an array, it can be accessed like one, and can even be looped through. It works by creating a new local integer object on whatever object you passed in through the parameters. This LocalInt is called sVarName + nVarNum, so in otherwords if I called the following:
GetLocalArrayInt(OBJECT_SELF, "MyArray", 1);
meaning I want the value in position one of MyArray on OBJECT_SELF. It would call GetLocalInt(OBJECT_SELF, "MyArray1") to retrieve the value. So if you create one array and have 300 values stored in it, you've actually created 300 variables with values on the object. This just hides the mess for you.
You don't do much better with linked lists.
Not trying to start a new flame, but seriously advise people to code in a way that works for them, while keeping in mind that, working solely with a stack, every time you do something different with a different value, you are incurring overhead with stack management. <clear as mud, boss> Grrr. How about "Keep is simple, silly"? <not very helpful> Heh.
How about this, then: Read the Grey Fox' post. Twice. Then go ahead and write script that works, whatever speed. Then tweak it. Ask advice. *Take* advice.
[edit: gray.fox, not grey... :-P Too much java!
We are working with a creaking, ancient engine (Deity, how I love her!) and creating things *because we want to*. If someone laughs at you... Hey!, You got 'em to laugh! =)
Meanwhile, just keep impressing your personality on the NwN-sphere.
<...hanky in the laundry basket>
Modifié par Rolo Kipp, 16 octobre 2011 - 08:23 .