mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Hey,
i have a little game script and want that the game is automatically active (when i have written !on) every 10min WITHOUT a user have to type anything, everything in the game script works great when i do it with the "on *:text:!test:#:" command but that isnt what i want.

So i tried to make timers and a game alias:

Code:
on *:text:!on:#: {
  .timer.game 0 600 %gamealias
}
on *:text:!off:#: {
  .timer.game off
}

alias %gamealias {
  set -n %word $read(wordlist.txt,n)
  msg # Game: %word
}



That is just a example, but it dont work, mirc dont even setting up the timer! When i remove the "%" at the alias mirc loads the timer but dont give any message!

Its just really odd - someone can explain me what i do wrong?


Tldr:
Timers dont working for me when i use "%" in the script / alias title.


Last edited by Krawalli; 11/12/14 06:49 PM.
Joined: Mar 2014
Posts: 52
P
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
timer.game 0 600 /msg #channel %gamealias

Last edited by patrickplays; 11/12/14 07:39 PM.
Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Hey,
that is not working for me:

Code:
on *:text:!on:#: {
  .timer.game 0 5 /msg # %gamealias
}
on *:text:!off:#: {
  .timer.game off
}

alias %gamealias {
  set -n %word $read(wordlist.txt,n)
  msg # Game: %word
}



Not even the timer is created when i check it on the bot with /timers

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Code:
on *:text:!on:#: {
  .timer.game 0 5 gamealias $chan
}
on *:text:!off:#: {
  .timer.game off
}

alias gamealias {
  set -n %word $read(wordlist.txt,n)
  msg $1 Game: %word
}


How about a simple solution.

Last edited by Belhifet; 11/12/14 08:37 PM.
Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Thank you Belhifet, that helps me alot!
I was able to fix my script smile

Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Okay perhaps someone can help me again, i have now 2 Games - i want them to choosen random.

When i change the 10min timer to this:
Code:
.timer.game 0 5 $+(game,$rand(1,2)) $chan


It is chooseing the game random the first time, but stay then on that game. The timer isnt changeing!



So i thought about another alias and tried it this way:

Code:
on *:text:!on:#: {
  .timer.gameselecter 0 5 selected $chan
}

alias selected {
  .timer.random 1 0 $+(game,$rand(1,2)) $chan
}

alias game1 {
  set -n %word $read(wordlist.txt,n)
  /echo -a GAME1
  msg $1 Game: GAME1: %word
}

alias game2 {
  set -n %word $read(wordlist.txt,n)
  /echo -a GAME2  
  msg $1 Game: GAME2 %word
}



The strange thing is now:
The "echo" is working but there is NO message - when i execute game1 or game2 with the first timer without the random thing - its working perfect.

Please someone? laugh

Last edited by Krawalli; 12/12/14 04:37 PM.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
in
Code:
alias selected {
  .timer.random 1 0 $+(game,$rand(1,2)) $chan
}

The alias is not on a channel. You've passed $chan on to the alias via the on text !on. That value($chan) is $1 for that alias.
Code:
alias selected {
  .timer.random 1 0 $+(game,$rand(1,2)) $1
}

Joined: Aug 2014
Posts: 42
K
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Aug 2014
Posts: 42
Wuh... its working like charme lol!
Thank you much.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Using unknown content inside /timer is dangerous, you should sanitize the unknown parameters passed to /timer as part of its command (here, $1) with $safe()


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Thats a fair point, I only use mirc for twitch so this doesnt come up for me frown


Link Copied to Clipboard