| View previous topic :: View next topic |
| Author |
Message |
MMushroom Voice
Joined: 28 Feb 2011 Posts: 2
|
Posted: Mon Feb 28, 2011 4:52 pm Post subject: One game at a time; disabling text triggers |
|
|
Hello,
Sometime ago I had great success running different irc games like Trivia and Uno so I've decided to make it full time uptime by setting up an eggdrop with such scripts.
Since our channel is public, lately we had a couple of trolls coming and ruining our fun by triggering multiple games at once - when we played trivia they triggered uno or hangman, etc.
It got me so frustrated that I had to revert back to mIrc scripts and only enable single game at a time.
My request is if it's possible to make a script that would disable triggering the other games while a certain one is played.
I was thinking about something like this:
When bot says the words " Starting the trivia...." it would set a counter. Then when another trigger is typed (!uno) it would do nothing, because a counter is set. Then when bot finishes a game by saying " Stopping the trivia..." the counter is set to 0 and other triggers to start the games can be used again.
Is that possible?
My TCL and MSL scripting knowledge is pretty much null and I failed miserably when I tried to make this script for mIrc at least.
Thank you for all your help in advance. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Mar 01, 2011 3:12 am Post subject: |
|
|
With a simple 'setudef int game' and define 0 = no game is active, 1 = trivia, 2 = hangman and 3 = uno (or whatever order you wish) you can achieve this goal.
Get the active running game (if any) with '[channel get #channel game]' you get an integer number representing the current running game (if any).
Then in trivia for instance, at the '!start' proc add a line like:
| Code: |
# will block the start of the game
if {[channel get $chan game] != 1} return
# since no game is active, we let them start this game
if {![channel get $chan game]} {
channel set $chan game 1
}
|
and at the '!stop' proc:
| Code: |
# if the 'trivia' game is the current game running we stop it and allow other games to be started
if {[channel get $chan game] == 1} {
channel set $chan game 0
}
|
And similar lines added to other games, the only difference is the number defining the game. Be sure to replace '$chan' with the actual variable representing the channel and drop a message if you get stuck or you don't understand anything from what I wrote above.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
MMushroom Voice
Joined: 28 Feb 2011 Posts: 2
|
Posted: Wed Mar 02, 2011 7:11 pm Post subject: |
|
|
Hey caesar, thanks for your quick reply.
If I understood it right I have to write "setudef int game" somewhere in the script too? Now, I've tried this with around 3 different trivias, Marky's color uno and Crack the code script, before I gave up. Nothing worked for me and I don't know what I was doing wrong. I searched for the start and stop processes and inserted the code there, but when I started my bot the scripts suddenly stopped working and did not want to start even. Basically they weren't responding to !trivia nor !uno nor !ctc nor any start command.
I'll copy-paste the part of Marky's color uno script code and please correct me what I am doing wrong.
(notice: the start proc is after the stop so I've put setudef here)
| Code: | #
# stop a game
#
setudef int game
proc UnoStop {nick uhost hand chan txt} {
global UnoOn UnoPaused UnPlayedRounds UnoStartTimer UnoSkipTimer UnoCycleTimer UnoLastWinner UnoWinsInARow
if {(![uno_ischan $chan])||($UnoOn == 0)} {return}
# if the 'trivia' game is the current game running we stop it and allow other games to be started
if {[channel get $UnoChan game] == 1} {
channel set $UnoChan game 0
}
catch {killutimer $UnoStartTimer}
catch {killtimer $UnoSkipTimer}
catch {killutimer $UnoCycleTimer}
# remove player dcc list
uno_removedccplayers
set UnoOn 0
set UnoPaused 0
set UnPlayedRounds 0
set UnoLastWinner ""
set UnoWinsInARow 0
UnoUnbindCmds
UnoReset
unochanmsg "stopped by $nick"
return
}
|
And the start proc:
| Code: | #
# first entry
#
proc UnoInit {nick uhost hand chan txt} {
global UnoOn
if {(![uno_ischan $chan])||($UnoOn > 0)} {return}
# will block the start of the game
if {[channel get $UnoChan game] != 1} return
# since no game is active, we let them start this game
if {![channel get $UnoChan game]} {
channel set $UnoChan game 1
}
#unochanmsg "$nick\!$uhost"
set UnoOn 1
UnoBindCmds
UnoNext
return
}
|
Desperate call for help. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Mar 03, 2011 2:53 am Post subject: |
|
|
Put the
line in just one of the files at the top, then in the 'uno' game (defined as 1st game):
| Code: |
proc UnoStart {nick uhost hand chan txt} {
# will block the start of the game cos another game is already running
if {![channel get $chan game]} return
# no game is started so we start this one
channel set $chan game 1
[...]
|
as for stop:
| Code: |
proc UnoStop {nick uhost hand chan txt} {
# will block the stop of the game cos this game isn't the one that's currently running
if {[channel get $chan game] != 1} return
# will stop the game and allow any (including this one) game to be started
channel set $chan game 0
[...]
|
At 'trivia' game (defined as 2nd game):
| Code: |
proc TriviaStart {nick uhost hand chan txt} {
# will block the start of the game cos another game is already running
if {![channel get $chan game]} return
# no game is started so we start this one
channel set $chan game 2
[...]
|
as for stop:
| Code: |
proc TriviaStop {nick uhost hand chan txt} {
# will block the stop of the game cos this game isn't the one that's currently running
if {[channel get $chan game] != 2} return
# will stop the game and allow any (including this one) game to be started
channel set $chan game 0
[...]
|
Hope it makes more sense now.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|