Setting variable by chat message...

Juliano

New Member
Reaction score
8
Sup dudes, in my arena, I really need help on a trigger to set the team kills limit variable according to a chat message that Player 1 (Red) sends...like in Pudge Wars and some other arenas like Heroes Wars

Something like:

/kills ##

Where ## must be a number between 10 and 500 that the player tips, than, it will set a Integer variable to ##(my stuff, team kills variable), if the player tips a /kills lesser than 10 or greater than 500, he receives a error message.

At 60.00 seconds, if no message is set, it will set to 50 automatically.

HALP:eek:
 

Kazuga

Let the game begin...
Reaction score
110
Try this
Code:
First choise
    Events
        Player - Player 1 (Red) types a chat message containing (your message) as An exact match
    Conditions
    Actions
        Set Integer1 = (Integer1 + 1)
        Trigger - Turn off (This trigger)

Code:
Second choise
    Events
        Player - Player 1 (Red) types a chat message containing (your other message) as An exact match
    Conditions
    Actions
        Set Integer2 = (Integer2 + 1)
        Trigger - Turn off (This trigger)

Code:
Result
    Events
        Time - Elapsed game time is 60.00 seconds
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer1 Greater than or equal to 1
            Then - Actions
                Set KiIls = YourValue
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer2 Greater than or equal to 1
            Then - Actions
                Set KiIls = YourValue
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        Integer1 Equal to 0
                        Integer2 Equal to 0
            Then - Actions
                Set KiIls = YourValue
            Else - Actions
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
Like ertaboy356b said, use substring and conversion
Code:
Chat
    Events
        Player - Player 1 (Red) types a chat message containing -kills  as A substring
    Conditions
    Actions
        Set KillInteger = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
        Trigger - Turn off (This trigger)
Set KillInteger= Conversion - Convert String To Integer ( SubString( Event Response - Entered Chat String, 8, String Length ( Event Response - Entered Chat String ) ) )
"-kills " has 7 chars so substring start at 8
Code:
At60
    Events
        Time - Elapsed game time is 60.00 seconds
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                KillInteger Equal to 0
            Then - Actions
                Set KillInteger = 50
            Else - Actions
 

Juliano

New Member
Reaction score
8
I havent understand NOTHING at all...please, somebody clarify this for me... I know I must use
Player - Player 1 (Red) tips a chat message containing /kills as a substring

but what must I do now?how can I f***ing detect what number the player tiped?

EDIT:

Good homie, thanks!I hate when this happens, I post and than the thread is updated
 

Kazuga

Let the game begin...
Reaction score
110
wrote down some comments that explains the moments
Try this
Code:
First choise
    Events
        Player - Player 1 (Red) types a chat message containing (your message) as An exact match   (This is the event, when player red writes the command this trigger activates and will do the following actions)
    Conditions
    Actions
        Set Integer1 = (Integer1 + 1)      (Integer1 is a integer variable, a variable can save information for later use and integer stands for hole numbers. Thereby an integer variable is a saved hole number. To make diffrent kind of things happen depending on what you write you need diffrent variables. Integer1 stands for the first option, for example: -kills 50-70 or something like that when the next option will be 70-90, just some examples. The (Integer1 + 1) makes just what it sounds like, the integer1 is 0 from the beginning if nothing else is said so this means that Integer1 = 1, if you now choose this option. 
        Trigger - Turn off (This trigger)     (turns of this trigger so that nothing hapens if you write the same command again)

Code:
Second choise
    Events
        Player - Player 1 (Red) types a chat message containing (your other message) as An exact match  
    Conditions
    Actions
        Set Integer2 = (Integer2 + 1)    (ok here is the second option, works exactly as the first option)
        Trigger - Turn off (This trigger)    (same thing here)

Code:
Result
    Events
        Time - Elapsed game time is 60.00 seconds   (after 60 seconds the program will check what is correct and what isn't and then do an action depending on what result he get's)
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer1 Greater than or equal to 1   (if integer1 is 1 then do action, integer1 is 1 if you wrote the first option, if you didn't the program will ignore this if then else)
            Then - Actions
                Set KiIls = YourValue
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer2 Greater than or equal to 1  (same thing here exept this is the second option result)
            Then - Actions
                Set KiIls = YourValue
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        Integer1 Equal to 0    (this is if you didn't write anything at all then you can deside yourself what integer it should be)
                        Integer2 Equal to 0
            Then - Actions
                Set KiIls = YourValue
            Else - Actions

hope this helped
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top