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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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