Staredit Network > Forums > SC2 Assistance > Topic: Array index arithmetic problems
Array index arithmetic problems
May 3 2010, 12:51 am
By: LostInMyself  

May 3 2010, 12:51 am LostInMyself Post #1



I am trying to do arithmetic in an array index and it does not work. I'm assuming an index is an integer.
The array variable is a unit type if it matters and I'm trying to add 1 to an integer in the index of said array.
Any suggestions?



None.

May 3 2010, 5:46 am ZeroAme Post #2



Can you show the trigger and variables your doing it with so we have a better idea of what you mean?



None.

May 3 2010, 2:14 pm LostInMyself Post #3



I have two global variables one is called unitArray[20] and is a unit type array.
The second one is unitArrayIndex and is an integer type.

The trigger is

Event - Any unit construction is completed

Local Variables - None
Conditions - None

Actions - Set unitArray[(unitArrayIndex + 1)] = (Triggering progress unit)



None.

May 3 2010, 8:00 pm Swampfox Post #4



Perhaps modifying a variable OUTSIDE of the array index (Lets call it ArrayIndex :)), and then using that variable instead? Just a thought.



None.

May 3 2010, 8:11 pm ZeroAme Post #5



What is the arry by default? if it 20 by default then it wont add anything because its already at its max.

I'll play around with this in GE and see what I come up with.

Edit: is unitArrayIndex an array?

Post has been edited 2 time(s), last time on May 3 2010, 8:22 pm by ZeroAme.



None.

May 4 2010, 4:28 am LostInMyself Post #6



Quote from Swampfox
Perhaps modifying a variable OUTSIDE of the array index (Lets call it ArrayIndex :)), and then using that variable instead? Just a thought.

After playing around for awhile I eventually came up with this and it does work.
It's just odd that you can't do arithmetic in an array index.

Quote from ZeroAme
What is the arry by default? if it 20 by default then it wont add anything because its already at its max.

I'll play around with this in GE and see what I come up with.

Edit: is unitArrayIndex an array?

unitArrayIndex is not an array and it's default is 0
The array is defaulted to a 20 slot array with 0 (assuming) in each slot.
Even though I solved my problem I would like to figure out why this does not work.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-7-23. : 6:40 am]
Oh_Man -- true
[2026-7-23. : 3:16 am]
RIVE -- Still annoyed there was never a trigger to stop or pause wavs.
[2026-7-23. : 1:40 am]
Oh_Man -- tthen u come to SCBW and it's like - upload WAV, play WAV.... sigh why cant it be that easy
[2026-7-23. : 1:40 am]
Oh_Man -- and no consistent easy to use way to then play the audio either
[2026-7-23. : 1:39 am]
Oh_Man -- where they use third party audioprogram called WWISE which basically makes adding audio extremely difficult
[2026-7-23. : 1:39 am]
Oh_Man -- i appreciate SCBW's ability to just let us upload and play WAVs so much compared to nightmare that is total war warhammer 3
[2026-7-18. : 2:27 am]
Symmetry -- https://staredit.net/topic/18903/ THE REVIEWS ARE HERE! "ok these are pretty good memes" - ssj9Kevin
[2026-7-17. : 2:58 pm]
Ultraviolet -- Symmetry
Symmetry shouted: Man I wish we had this tech back in the day when people played ums lmao
fr fr
[2026-7-17. : 2:39 am]
Symmetry -- Man I wish we had this tech back in the day when people played ums lmao
[2026-7-16. : 6:28 am]
NudeRaider -- EUD actions, specifically. The conditions remained. Today we can even have actions again, but they're all virtualized/whitelisted (not sure on the actual technical implementation) so you can only use them for specific intended purposed, not arbitrary code injections.
Please log in to shout.


Members Online: ManCubuS