Page 2 of 2

Re: Activation code

Posted: October 26th, 2007, 6:17 pm
by weirdone2
You tricked me xantan I thought you'd actually talked to him, so I cancelled my post. ;/

Anyway just change:

Code: Select all

if SubString(s,0,5)=="-gold" then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD )+S2I(SubString(s,6,13)))
elseif SubString(s,0,7)=="-lumber" then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER )+S2I(SubString(s,8,15)))
to:

Code: Select all

if SubString(s,0,5)=="-gold" then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD )+S2I(SubString(s,6,13))/4)
elseif SubString(s,0,7)=="-lumber" then
call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER )+S2I(SubString(s,8,15))/4)
and it should be fine. ;)

Re: Activation code

Posted: October 26th, 2007, 11:10 pm
by Penguin
Thank you very much weirdone. I also love your cheat pack (although it sometimes makes the map I apply it to cause WC to crash, and other time it just doesn't work at all).

Georgemots wrote:somehow off-topic
Shouldn't this be

from

Code: Select all

if SubString(GetEventPlayerChatString(),0,8)=="-penguin" then


to
this
if SubString(GetEventPlayerChatString(),0,9)=="-penguin" then


"-penguin" is 8 characters, so it should be 0,8.

Re: Activation code

Posted: October 27th, 2007, 12:16 am
by trb92
Penguin wrote:"-penguin" is 8 characters, so it should be 0,8.

Actually, it should be 0,7
- 0
p 1
e 2
n 3
g 4
u 5
i 6
n 7

Jass counts the first character as 0, not 1.

Re: Activation code

Posted: October 27th, 2007, 12:33 am
by JJ2197
I'm not sure how to explain this but I think it works like this...
It starts at 1 and ends at whatever number specifed because 0 can't really be counted because that's not possible to put a string there because when you say "whatever" w=1 h=2 a=3 etc...

So 0 is simply like a precheck or whatever you want to call it...
Example (s,1,2) would just check to see where the 2nd char of what you say is...

Re: Activation code

Posted: October 27th, 2007, 4:15 pm
by weirdone2
Trb if you stopped at 7 then one would only have to enter -pengui, it works liek this substring(source,start(where you wish to start at),end(ending does not get this char)) so lets say i have k="1234" Substring(k,0,3) This would look at the start 0, which is 1 then get 1 which is 2 also 2 which is 3 and then would see that its at 3(the end) so would stop. So in the end it would return "123"

@penguin thx, ya I know of the lil crash bug just haven't really tried to find it yet. :P And the 2nd is the vex error. :S