Warcraft III resources & community, 2003–2006 · archived

String -> Integer

8 posts
#1

String -> Integer

I usually try and figure stuff out on my own, but heck, I give.
How do you create an integer from a chat string?
Like for instance -
Player types in message.
Message contains -create
ex.
Player types in: -create 10 units
Action: Create 10 units for triggering player

How would I do such a thing? Doing conversion - string to integer gets me the length of the integer... but...
Not what I want :?
--donut3.5--
#2
Sub String (SubString) gets the chars from the string that you want, then String to Integer (S2I) will get you the value you want.
#3
I kinda of get the idea, but how would I use it to make a variable?
Events
Player 1 types in a chat message containing (-max ) as a substring
Actions
Set Variable to...
IDK what to do there.
(integer((Substring(-max 1,30))))
(I want to set the variable to a number in between 1 and 30
Ya... since you said you have to do two things.
I'm not too experienced with substrings, and the example they give is really weird examples like Grunts Stink, 2, 5= "run"... <_<
--dout3.5--
#4
Events
Player x types a chat message containing y as a Substring
Conditions
(none)
Actions
Set int = Convert String to Integer( Sub String( Get Entered Chat String, (start), (end) ) )
//do any other actions here
#5
I remember having lots of trouble using variables in chat strings..... was very annoying...
#6
I <3 purplepoot :D
Thanks man, works perfectly ;)
--donut3.5--
#7
glad i could help

PS. nice new sig

Another PS. Have you quit modelling? :(
#8
Quit... ah... isn't the word.
Forcibly removed from accessability to War3 modelers fits better. In short, I moved to a Mac, which I hate, which does not hav any good modeling progs. My parents have decided I can only get macs now or something...
I have been hearing news of a Mac in which you can install Windows onto it, which I could get... If I get it, expect my return in January/Febuary... :twisted:
--donut3.5--