• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

using the, Player types a chat message containing string, HELP!

Status
Not open for further replies.
Level 11
Joined
Nov 1, 2008
Messages
828
How do i record an integer from the message?
For example,


Event: Player says -mode 100

Where 100 is stored in to a variable and converted to integer for game purposes. All i have is Player says <Empty String> and it converts it to an integer. I don't know how to have what is said above. Thanks. +rep
 
should be like this
  • Events
    • Player - Player 1 (Red) types a chat message containing -mode as a substring
  • Conditions
    • Length of (entered chat string) greater than or equal to 6
    • subtring(entered chat string, 1, 5) is equal to -mode
  • Actions
    • Set i = (Integer((Substring(Entered Chat string, 7, Length of (entered chat string)))))
you use length of chat string as an upper bound so that it can take any possible length... :)

and we also check if it's greater than 6 so that we are sure that it has at least a single digit after the "-mode "
 
should be like this
  • Events
    • Player - Player 1 (Red) types a chat message containing -mode as a substring
  • Conditions
    • Length of (entered chat string) greater than or equal to 6
    • subtring(entered chat string, 1, 5) is equal to -mode
  • Actions
    • Set i = (Integer((Substring(Entered Chat string, 7, Length of (entered chat string)))))
you use length of chat string as an upper bound so that it can take any possible length... :)

and we also check if it's greater than 6 so that we are sure that it has at least a single digit after the "-mode "

Wow thanks, Works perfect! :ogre_haosis:
 
Status
Not open for further replies.
Back
Top