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

[Trigger] Substrings goes to variable, need help

Status
Not open for further replies.
Level 2
Joined
Feb 24, 2009
Messages
14
I need help with converting substrings from the chat to integers.
I can convert a specific number like "240" to the ability "a", but I don't know how to make ANY number from 1 to 360 go to the integer if player 1 writes it. I don't want it to be possible to have a number like 380 or -10.
If it is possible I would like it on this form:
"Angle XXX" The players write Angle, then a space, then three numbers to decide the integer. Like 008 or 195.
Pleaase help mee :cute: ?
 
Made it work ^^

EVENT:
Player - Player 1 (Red) types a chat message containing -angle as A substring

ACTION:
Set AngleVariable = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))

just add some conditions

Thanks you helped me a lot: ). I was able to figure it out.
But my conditions aren't working, so I had to make limits in another way.. the "if then else multiple functions" that I added fixed the problem though..
Can you show me how the condition was supposed to be ?
Thanks again for all help :grin:. I will try to be done with the spell in a few days :D! Then I will release it to THW :smile:.
 

Attachments

  • Substring.JPG
    Substring.JPG
    47.3 KB · Views: 177
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -angle as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string)))))) Greater than or equal to 0
          • (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string)))))) Less than or equal to 360
        • Then - Actions
          • Set AngleVariable = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Angle above 360 or below 0? You must be a real retard.
+REP if i helped you.
 
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -angle as A substring
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string)))))) Greater than or equal to 0
          • (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string)))))) Less than or equal to 360
        • Then - Actions
          • Set AngleVariable = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
        • Else - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: Angle above 360 or below 0? You must be a real retard.
+REP if i helped you.

You sure did help me. But this last message? The conditions you used are the exact same as the ones I used that didn't work.. Your first help surely was worth a + rep :)
Remember you aren't allowed to ask for rep ;p
 
It converts to an integer the substring of the chat string from the 8th position to the end.

"-angle " <--- including the space is 7 characters long. So if we start at the 8th position, it's just the number.
 
Sorry

Please first try my way b4 telling me it doesn't work.
And you cant ask for a rep? what kind of rule is that..

Sorry. I thought I had read that rule somewhere but maybe I remembered wrong.

I did actually try your way before I told you it didn't work. Cause it didn't work on my map, may it be a noobish mistake I made somewhere or the conditions, I don't know.
Anyways I'm sorry again. :)
 
Status
Not open for further replies.
Back
Top