In JASS, red is always player 0. What nuuby is saying is that the 1 means red because it will automatically subtract 1 from the integer to create the player ID.darkfuryex wrote:Hey there i got a few questions...
about this, if the ID of player red is 1...why did it bother to minus 1 from that to make it 0 again? i know that the default color of red is 0..and blue is 1 etc etc but why did it minus 1?Nuuby wrote:
As you might be able to guess, I2S(Vx[bj_forLoopAIndex])) , is what shows the score. Here's an explanation of the stuff in this. I2S converts an integer into a string. Naturally Vx[bj_forLoopAIndex] is a integer. Whenever you see those [ ] it would mean that it's an array, in this case an integer array. An integer goes into that [ ]. Which in this case would be 1 = Red 2 = blue so on... How would you know this? When the bj_forLoopAIndex is 1, the player is that minus 1, in other words player 0 aka Red.
The 0,3 is for the command, 0-1c2c3, which goes from 0 to 3, as indicated in red above.darkfuryex wrote:may i ask is "s2s" just the "name" for this trigger? sorry i dont have any basic knowledge of jass x(, and "4,15" just means that it will only take whatever value that appears right after 4 letters which is after "-cc " and the max score we can set to is 11 digits eg "-cc 12312312312"..right?Nuuby wrote: So from this we know that Vx[1] is the Jurassic score for Red. So now we make the command~ The easiest way is to insert this line of code into JJ's cheatpack.
elseif SubString(s2s,0,3)=="-cc"then
set Vx[Player(GetPlayerId(p2p)+1)]=S2I(SubString(s2s,4,15))
then how about the "0,3" what is that for?
s2s is just the string. You would need to use a local to call it earlier in the function (local string s2s). JJ uses that in his cheatpack.
And, yes, it means you can only do 11 characters. If you changed the 15, you can make it higher or lower if you wanted.
The code probably takes in your Player ID (using the bj_LoopAIndex thing which uses 1 for red and so on). That being said, if 1 is for red in that function, would you think using 0 for red generate the same code? Most of the time, it will be used in some sort of formula, and to make it easier, adding 1 and adding 0 to a number gives different results (multiplying is even worse because one value will be 0!). You need to add 1 back into the value because that's how the LoopAIndex works.darkfuryex wrote:last question, in the 1st question i asked why did the system minus 1 from the ID...why does the system adds 1 value to our ID again after giving you the final code? is it due to some security stuff? i seriously dont understand this minus 1 and plus 1 thingy..can you explain further pls? why is having the value of 1 for generating the final score code important and is what we need as mentioned by you?Nuuby wrote: What this does is that once you have activated JJ's CP. When you type "-cc 9999" it will set your Jurassic Score to 9999. What the individual stuff do:
-Player(GetPlayerId(p2p)+1) what this does is that it gets your player ID, ie if you're red it gives you a number of 0. Then adds 1 to it. So if you're red it gives you a number of 1. Which is what we need
-S2I(SubString(s2s,4,15)) S2I is the opposite of I2S. The 4,15 is the location in your string that it will check for the integer. In this case it checks from the range more then 4 less then 15.
sorry im a noob but im willing to learn x( pls help..
anyway u got a very nice guide here...u went in depth with some stuff which is what noobs like me needs
P.S i hope you can see the words i specially bolded out..
Hope that explains some stuff.