mIRC Home    About    Download    Register    News    Help

Topic Options
#265001 - 12/02/19 03:34 AM Random variable help
TroyL Offline
Babel fish

Registered: 04/12/18
Posts: 51
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
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) ?

#265002 - 12/02/19 07:25 AM Re: Random variable help [Re: TroyL]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1062
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