HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Recognizing Integers in Chat ////Wrists/////

03-30-2009, 09:40 PM#1
Thu-Amsf749
Basically :
I want players to be able to set a real value by typing a message.
In this case, it's a respawn rate.

Since you apparently cannot use variables for a Time - Periodic Event function, I have it set to :
Every (Convert to real(Custom Value of Fountain 0051)) seconds of game time
What I would like to know is how to recognize a number in a chat string?
Example : -spawn 15
Will set the custom value of the fountain to 15, causing the enemies to spawn every 15 seconds.

Any help please? Hopefully I explained it well enough I can add pictures if you need.
GUI please XD
03-30-2009, 10:20 PM#2
Anitarf
That won't work because the custom value of the fountain is read only once, when the event is registered. After that, even if you change the custom value, the trigger will still run as often as before. In fact, when the event is registered, the custom value of the fountain is likely still 0.
03-30-2009, 10:38 PM#3
Thu-Amsf749
I was smart enough to set the custom value of the fountain before turning on the spawn trigger. But is there any other way to do this - By changing the integer used or turning the trigger off and back on or anything?
03-30-2009, 11:01 PM#4
MaD[Lion]
i would recommend u to use timer for dynamic timing
03-30-2009, 11:04 PM#5
Blacktastic
What type of method are you using to spawn with? If you are using structs, give each spot point some type of identification and then check if the entered string is of the format <identification id> <real>, and set the spawn time of the struct that is associated with the identification id to the typed value, and make the timer reference that value.
03-30-2009, 11:37 PM#6
Anitarf
Quote:
Originally Posted by Thu-Amsf749
I was smart enough to set the custom value of the fountain before turning on the spawn trigger.
That doesn't help either, the trigger's event is setup at map initialization regardless of when you turn it on. For variable intervals, you would want to use a timer, not a periodic event.
03-31-2009, 04:17 AM#7
Thu-Amsf749
The timer idea seems to work perfectly, allowing me to set it as a one shot timer with a length that i can set to a variable. (Using a one shot timer and then restarting the timer as a one shot in the spawn trigger, to prevent fail if the time is changed during a repeating timer).

However, my original question now remains the same. How can I recognize the value entered in the chat message to set the variable?
Ex
Player enters chat message: "-spawn [number]"
Set SpawnRate = [number]
Set Timer as a one-shot timer that will expire in SpawnRate seconds
03-31-2009, 04:45 AM#8
akolyt0r
Trigger:
SpawnRate
Collapse Events
Player - Player 1 (Red) types a chat message containing -spawn as A substring
Conditions
Collapse Actions
Set SpawnRate = (Real((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
03-31-2009, 09:22 PM#9
Deaod
additionally to what akolyt0r said, you should check if SpawnRate equals zero and throw out comprehensive error messages if its an invalid value.