• 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.

String length trigger

Status
Not open for further replies.
Level 9
Joined
Mar 9, 2010
Messages
272
Hellow bees, me saying this is going to anger you lot. I am trying to make a save/load code, the tutorials are long winded so i gave up. Im trying a different method so please listen to my godly request.

I want to know the triggers that allow me to do actions after a string is typed. example;

-save A2 -i want the "-save" to be compulsory and if A is typed as the 7th letter or number on the string i want it to make a certain hero. B will be different hero. The number will be adding stats.
I do not know how to create the triggers that check the certain letter or number that far into the string.

Thx to all help :ogre_rage:
 
Level 5
Joined
Jan 4, 2007
Messages
103
This?:

  • Events
    • Player - Player 1 (Red) types a chat message containing -save as A substring
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 7, 7)) Equal to A
      • Then - Actions
      • Your Actions for Hero 1
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 8, 8)) Equal to 2
      • Then - Actions
      • Your Stats Actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Substring((Entered chat string), 7, 7)) Equal to B
      • Then - Actions
      • Your Actions Hero 2
      • Else - Actions
The substring acually matches the entered chat from and to the number you've entered, so from 7 to 7(that's the 7th letter) if you entered -save A2 it will be A, if you entered -save B3, the from 8 to 8 will be 3 ect. Hope it helps:)
 
Status
Not open for further replies.
Top