Is There A Way To Have Multiple Outcomes Of A Command?


#1

Hey guys!

I am trying to set up a custom command that leads to various outcomes, is there a way to do this at all?
I tried looking through the forums but had no luck, if this has been answered even a link to the post would be amazing!

Thank you guys :D!

Nato.


#2

Typically something like this needs a custom script created if you want to have branching within a command.


#3

Thank you so much for the response. So basically I need to learn java?

Basically wanted to have a command like !death which leads to 5 or so different responses at random.

Would this be difficult to create?


#4

There’s already the !kill command for this, that does exactly the same thing. It’s built in with different options. Using just !kill will trigger one of about 50 responses resulting in your death (nothing actually happens). Using !kill Auroris (It’s a regular occurrence, I assure you), will result in a different set of options, and also has the possibility to rebound on the sender.


Alternatively, you can write your own using the (readfilerand) variable, as detailed here, which will pull a random line from a file that you can write.


#5

That’s amazing thank you so much! I wanted a way more detailed version of kill which is why I was trying to make my own! I’ll check this out. Thank you once again!


#6

I have been playing around with the (readfilerand) variable and unfortunately I am unable to make it do what I want in terms of variables inside the actual text so for example.

the command is !oops
one of the lines in the txt file is
"(sender) is deep frying delicious thinly cut potatoes when, during the excitement, they accidentally throw (random) in to the fryer, (random)'s whole body is broken down by the boiling oil…"

when that comes up on the screen it doesn’t change the variables that are written in the txt file (if that makes sense).

How could I go about this?

Thank you!


#7

Hmm… The readfile function itself does just print the text directly, it doesn’t parse the variables. I think this was discussed recently and the devs were going to look at it, but that’s not current.

For the example you described, using the targeted kill command would cover exactly what you’ve described. The (random) in a custom command will actually pick a different random user each time, so you’d likely end up with one user in the fryer, and another user’s body breaking down.

At this point, unless you’re willing/able to repurpose the !kill script to your needs, I think that you’ll either need to wait to see if the devs are able to nest variable parsing within the readfile variable, or write your own script. Unfortunately, I don’t think this is otherwise possible with the vanilla bot at the moment.


#8

Thank you for your help Auroris, I really do appreciate it, hopefully something can happen in the future :slight_smile:


#9

This was patched in a nightly a little bit ago:

commit be07483d80ed070115ad225abdf066a112b153bf
Author: ScaniaTV [email protected]
Date: Wed Aug 16 16:36:59 2017 -0300

- Allow command tags in file commmand tags

Essentially, the file-related tags are processed first now and expanded to capture all other tags.