mIRC Home    About    Download    Register    News    Help

Print Thread
Random variable help #265001 12/02/19 03:34 AM
Joined: Dec 2018
Posts: 52
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 52
1st off i just want to say sorry if im "spamming" the forums with help but i'm really new to this stuff and still a little confused on stuff. But anyways this is the code
Code:
on *:text:*!roulette*:#troyl:{
var %r $rand(1,5)
if (%r == 1) describe $chan Example
;;so for the next variable response i want to time them out for 1 second to show they got "shot" in away while at the same time give a message.
elseif (%r == 2) describe $chan Example response..
msg $chan /timeout $nick 1 
;; now when i do that it doesnt give a message it skips everything and goes to the timeout command. 

So my question is how would i put a message and a timeout command for (%r == 2) ?

Re: Random variable help [Re: TroyL] #265002 12/02/19 07:25 AM
Joined: Jan 2004
Posts: 1,174
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,174
While debugging, it helps to add an echo message to yourself to see what the random number actually was. You can also do "var -s %r $rand(1,5)" and the -s makes it show the set message. Being done inside an :EVENT: the message shows to the status window.

In an if/else/elseif structure, each branch has 1 "then" command unless you use { } to allow the "then" to be a group of commands. The commands can be listed on separate rows and/or listed on same line separated by pipe symbols.

if (%var == 1) echo -a only when it's 1
elseif (%var == 2) { condition2#1 | condition2#2
condition2#3 }
else {
this stuff done only if didn't match any condition above it
}