• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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: ?
 
Level 2
Joined
Feb 24, 2009
Messages
14
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: 160
Level 5
Joined
Feb 21, 2009
Messages
136
  • 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.
 
Level 2
Joined
Feb 24, 2009
Messages
14
  • 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
 
Level 7
Joined
Jul 20, 2008
Messages
377
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.
 
Level 2
Joined
Feb 24, 2009
Messages
14
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.
Top