Detect Number in Event

Igor_Z

You can change this now in User CP.
Reaction score
61
How can I detect the number in the entered chat string.

For example:
-water 125 139 203 = setting water tinting color
-lvl X = set lvl of your hero to entered number in place of the X sigh
-ms 298 = Set movespeed of hero to 298

There are many more but i only mentioned some of them. Can some 1 tell me?
 

Eyonix

TH.net Regular
Reaction score
16
I don't know about in an entered chat screen... but you could make a dialog pop up say when they type -water then make a button for each tint level you want.

Only other way I know of would be to make a trigger for each exact match of text.

Edit: Nvm what I said... just remembered in ultimate footmen the -zoom thing.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
You'll need to use substrings :D
Here's an example on the -lvl X :D

Trigger:
  • Set Level
    • Events
      • Player - Player 1 (Red) types a chat message containing -lvl as A substring
    • Conditions
    • Actions
      • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to (==) True))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Hero - Set (Picked unit) Hero-level to (Integer((Substring((Entered chat string), 6, (Length of (Entered chat string)))))), Hide level-up graphics
      • Custom script: call DestroyGroup(udg_TempGroup)


This will set the triggering player's heroes to the number after -lvl(space).

To set the event here, you use the event Player - Chat Message, and type in -lvl(space) then change As an exact match to As a substring :D

Then, for the lvl up action:
Code:
Hero - Set (Picked unit) Hero-level to [COLOR="Red"](Integer((Substring((Entered chat string), 6, (Length of (Entered chat string))))))[/COLOR], Hide level-up graphics

The first there is a conversion to use a string instead of an integer, then you use "Substring", and after that you set which string to "look at" which is (Entered chat string), then from and to which number of letters you want to use...

By this I mean that -lvl(space) is 5 letters, meaning that, (since a number is supposed to come after that) 6 is where the numbers start.
So we use 6 as the "from" number" and then use (Length of (Entered chat string)) as the "to" number :D
 

Igor_Z

You can change this now in User CP.
Reaction score
61
Thanks Komaqtion, +rep from me. Can you tell me how to make water color too? Cuz it is complicated containing this:

-water X Y Z

P.S: X is a first number from 0-255
Y the second number ---||---
Z the third number ---||---
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, then just use the same principal :D But use from 8 to 11 for the X, then 13 to 16 for y and 18 to 21 for Z.
Though, since all those numbers can be either 1 2 or 3 numbers long, it's harder :S I'm not completely sure how to do that :S Sorry :(
But I'll try to figure it out :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top