mIRC Home    About    Download    Register    News    Help

Print Thread
#14484 07/03/03 05:46 PM
Joined: Mar 2003
Posts: 21
N
Nanaki Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2003
Posts: 21
In a script I have been working on for a while, I would like to add some 'fun' features. One thing I have been working on is a slots script, called slots.ini. Here is the code:
Code:
ON *:TEXT:!slots*:*: msg $chan $nick plays the slots. $read $mircdir\slots.txt

Basically this means whenever someone says !slots, a random line from the slots.txt is read and sent to the channel. Here is a sample line from slots.txt:
Code:
/msg $chan [Cherry] [Banana] [Bar] Sorry, You lose £5. | /dec %slots $+ $nick 5 

Basically my problem is that that is exactly what is sent to the channel, coding and all. Is there a variable, like there is the -c option for the /play command, which forces mIRC to read lines as actual commands rather than just text, so that I can work my slots script properly?
Or is there something which would do the same? I cannot use /play because I only want one random line to be sent to the channel.

Any help would be much appreciated.

Thankyou in advance,
Nanaki.

#14485 07/03/03 10:23 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
ON *:TEXT:!slots*:#:.play -cr $chan slots.txt 0
The -r switch forces a single line to be chosen randomly from a file and played.

#14486 08/03/03 07:31 PM
Joined: Mar 2003
Posts: 21
N
Nanaki Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2003
Posts: 21
Thanks, but now there is another problem. The
Code:
  /dec %slots $+ $nick 5 
Code isn't functioning - it doesnt decrease the variable. I am not sure if i need to /set the variable before i /dec it, but i would not know how to do that!

Thanks again,
Nanaki,

#14487 10/03/03 04:28 AM
Joined: Feb 2003
Posts: 32
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Feb 2003
Posts: 32
Code:
 
/dec %slots [ $+ [ $nick ] ] 5
 

#14488 10/03/03 04:50 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
$nick and $chan are invalid when called from a /played file.
$pnick is the nick|channel you are currently playing to.

You could set $nick to a temp var before /playing.
ON *:TEXT:!slots*:#:set -u10 %playnick $nick | .play -cr $chan slots.txt 0

msg $pnick [Cherry] [Banana] [Bar] Sorry, You lose £5. | /dec %slots $+ %playnick 5

If you /play files other than here, and someone else msgs chan "!slots xx yada" before the queue is finished, then the %playnick var will be overwritten. :tongue:


Link Copied to Clipboard