![]() |
Array help
This wont select the next variable in thiso.rights.
thiso.rights = Stick,Unstick,Jail,Stealth can someone help me get this to work? PHP Code:
|
Why are you using a thiso prefix there? Should work with a regular this prefix.
|
Quote:
|
But you do not need it in this case. You only need that particular prefix if you want to reference to the NPC the code is executed in while being in another NPC's scope, like inside some of this stuff:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
Edit: What do you want to do, anyway? Your conditions seem strange; you also got your operators the wrong way (=> and =< instead of >= and <=, but I'm not sure if that even matters). Also, you're converting an integer to a string for your array index here: PHP Code:
PHP Code:
|
I'm trying to make it so that you can change which variable in the array you are showing, by pressing [ and \. Once like first it will say Stick, then you press \. And it would do UpdateText(); to say Unstick, then Jail, then Stealth. But it shouldn't go any higher then the array size, and the array minimum.
|
You could use the modulo operator for this one.
PHP Code:
|
I don't even know why you're looping it strangely in the first place, but you wrote temp.i < thiso.rights.size() instead of temp.i <= thiso.rights.size()? You'd be excluding one less array item.
In general though, there really isn't anything to 'fix' persay if we don't even know how you store your array vars (this.orights? too vague) or what you're really trying to do. Apparently you want to change the array with '[' or / yet nothing is indicating any keypresses besides onKeyPressed() which you didn't utilize properly anyway. Wat? I guess you want to increment your array [] selectors, so why not just increment temp.i and de-increment them on '[' & / keypresses? |
Quote:
|
Quote:
Anyway, it'd be much easier to just increment like this and perform some checks for this.i or whatever number he'll be using for the array [0] selector. PHP Code:
|
Quote:
Astram, I would use the method Crow described. In the end it should look somewhat like this: PHP Code:
|
Quote:
PHP Code:
|
All times are GMT +2. The time now is 08:23 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.