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.
[03:34 pm]
ManCubuS -- Used : " [img=https://i.imgur.com/gpOjTuD.jpeg] "
[03:28 pm]
ManCubuS -- Even tried with imgur, doesn't attach.
[03:14 pm]
ManCubuS -- I should try a workaround, thanks! Sadly imgur is blocked in my country for some unknown reason.
[03:05 pm]
NudeRaider -- I think SEN has trouble with https or hotlinking is forbidden. It certainly is nothing about the size, it just fails to get any size. You can get it working if you use imgur and include the actual image link for the img tag. Like this: [img=https://i.imgur.com/ddYqXZa.jpeg]
[11:15 am]
ManCubuS -- Hey fellas! Anyone knows why when I try to upload an image it says "failed to get image size"? I even tried making it so small. Imgur isn't working here and I tried postimg no luck.
[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
Please log in to shout.


Members Online: Ultraviolet, Symmetry