mIRC Home    About    Download    Register    News    Help

Print Thread
#115449 26/03/05 07:59 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
can anyone tell me where i could find a game like this to add to my bot?

#115450 26/03/05 08:27 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
What is an acronym game?

#115451 26/03/05 08:33 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
It is like a trivia game, the bot will tell you the letters of the acronym, and then everyone starts guessing as to what it stands for.

#115452 26/03/05 09:00 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
 on *:text:*:#:{
if $1 == !acronym {
if !%ac { set %ac 1 }
else { describe # Current Acronym %acronym hasn't been guessed }
set %acronym $read(acronym.txt)
set %response $right(%acronym,$calc(-1 * ($pos(%acronym,$chr(32),1))))
set %acronym $remove(%acronym,%response)
set %response $right(%response,-1)
describe # Acronym is %acronym
}
elseif $1 == %response {
describe # Congratulations $nick
unset %ac
describe # Type !acronym to start another game
}
else { describe # Sorry $nick, but that's not the correct response }
}
 


Just make sure that you have the information in the text file (acronym.txt) in the correct order. The acronym, then a space character, then the correct response.

This was quickly done, so I can't guarantee anything, but I think it should work

#115453 26/03/05 09:52 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The setting up the acronym was a bit dodgy but beyond that looked good.
* I also havent checked this code, its late sorry

Code:
on *:text:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == !acronym) {
    if !%ac {
      set %ac 1
      set %acronym $read(acronym.txt)
      set %response $gettok(%acronym,2-,32)
      set %acronym $gettok(%acronym,1,32)
      describe # Acronym is %acronym
    }
    else {
      describe # Current Acronym %acronym hasn't been guessed.
    }
  }
  elseif ($1- == %response) {
    describe # Congratulations $nick You have the answer!
    unset %ac
    describe # Type !acronym to start another game.
  }
  else {
    describe # Sorry $nick, but that's not the correct response
  }
}


acronym.txt format as follows
omg oh my god
cpu central processing unit
ape a purple elephant <snicker snicker>

#115454 26/03/05 10:07 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
thank you very much russel and dave grin would it be possible to put a timer on how long they have to respond before it times out?

Last edited by Pariah; 26/03/05 10:14 AM.
#115455 26/03/05 10:28 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on *:text:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == !acronym) {
    if !%ac {
       new.acronym #
    }
    else {
      describe # Current Acronym %acronym hasn't been guessed.
    }
  }
  elseif ($1- == %response) {
    describe # Congratulations $nick You have the answer!
    unset %ac
    describe # Type !acronym to start another game.
    .timer.acronym.end.turn off
  }
  else {
    describe # Sorry $nick, but that's not the correct response
  }
}
alias -l new.acronym {
  set %ac 1
  set %acronym $read(acronym.txt)
  set %response $gettok(%acronym,2-,32)
  set %acronym $gettok(%acronym,1,32)
  describe $1 Acronym is %acronym
  .timer.acronym.end.turn 1 300 acronym.end.turn $1
  ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 300 is 300 seconds set that to what ya want.
}
;
;------------------------------------------------------------ 
alias -l acronym.end.turn {
  describe $1 Times up you loosers it was %response
  unset %ac
  describe $1 Type !acronym to start another game.
}  
;------------------------------------------------------------ 
;
; * choose which of these two you want the top one end the turn the bottom one does to but starts another turn on its own. (delete the one you dont want
;
;------------------------------------------------------------ 
alias -l acronym.end.turn {
  describe $1 Times up you loosers it was %response
  describe $1 So you all get to play again try harder this time!
  new.acronym $1
}
;------------------------------------------------------------
;

#115456 26/03/05 11:06 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Like you said, Dave...it was late when I did that

#115457 26/03/05 11:42 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
thanks tremendously dave, only problem i seem to have is with
Code:
else {
    describe # Sorry $nick, but that's not the correct response
   }

would there be an easy way to put an off trigger in it?

Last edited by Pariah; 26/03/05 12:54 PM.
#115458 26/03/05 03:55 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Oops...change that to read
Code:
else { describe # Sorry $nick $+ , but that's not the correct response } 


As to turning the game on/off, put the following at the top of the code
Code:
on *:text:!acgame &amp;:#:{
$iif($2 == on,.enable #acronym,.disable #acronym)
}
#acronym off


and make the last line of the code
Code:
#acronym end


The command to turn the game on is !acgame on
anything else will turn the game off

If you need/want an updated code, with these changes, say so and I'll put them up. Unfortunately copy & pasting from code from this forun doesn't put in line returns where they occur in the actual code.

#115459 26/03/05 10:56 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Code:
on *:text:!acgame &amp;:#:{
$iif($2 == on,.enable #acronym,.disable #acronym)
}
#acronym off


heheh I like that nice style of enabling and disabling on the fly

#115460 27/03/05 06:06 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
I tried to make myself another little game modeled after the code you posted, but it doesnt work for me like the other one did, think you could maybe tell me where i messed up at?
Code:
  
on *:text:*:#:{
  if ($1 == !riddleoff) {
    if !%rdl {
      msg # It's not on
    }
    else {
      describe # 9,1¿3,1? 9,1R3,1i9,1d3,1D9,1l3,1e 9,1M3,1e 9,1T3,1h9,1i3,1S 9,1?3,1¿ has been turned off.
      riddle.end
    }
  }
  if ($1 == !riddle) {
    if !%rdl {
      new.riddle #
    }
    else {
      describe # ¿? %riddle ?¿
    }
  }
  else {
    if ($1- == %answer) {
      describe # %answer $+ !¡! Congratulations $nick you are correct!
      unset %rdl
      describe # Type !riddle for another round.
      .timer.riddle.end.turn off
    }
    else {
      if %rdl {
        .notice $nick Sorry $nick $+ , that's wrong.
        else {
          halt
        }
      }
    }
  } 
} 
alias new.riddle {
  set %rdl 1
  set %read $read(riddle.txt)
  set %answer $gettok(%read,2-,61)
  set %riddle $gettok(%read,1,61)
  describe $1 9,1¿3,1? 9,1R3,1i9,1d3,1D9,1l3,1e 9,1M3,1e 9,1T3,1h9,1i3,1S 9,1?3,1¿
  describe $1 :: %riddle ::
  .timer.riddle.end.turn 1 60 riddle.end.turn $1
}
alias  riddle.end.turn {
  describe $1 Time's up the answer was %answer
  describe $1 Put your Thinking Caps on Brainiacs!
  new.riddle $1
}
alias riddle.end {
  unset %rdl
  .timer.riddle.end.turn off
}


Last edited by Pariah; 27/03/05 06:13 AM.
#115461 27/03/05 10:03 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
One thing I did is rename the variables, they all start with %rdl. now this is so they are unlikely to conflict with any other variable names other scripts may use.
* I changed if ($1 == !riddle) { into elseif ($1 == !riddle) { becuase before if !riddleoff after doing its code it is also compared to %rdl.answer etc
* Only enter the comparing to %rdl.answer code if %rdl.on is set, if its not there isnt a riddle in play, otherwise just ignore the text
* If the answer was correct, I call the end.riddle alias (reduces code, also means if u patch the code u only need to patch it in one place)
* I changed set %read $read(riddle.txt) to var %read = $read(riddle.txt) meaning it exists only while the script (event) is running
.. You might notice i didnt bother to make it %rdl.read as this variable exists only inside this script, if a $read exists elsewhere it is uneffected.

Code:
on *:text:*:#:{
  if ($1 == !riddleoff) {
    if !%rdl.on {
      msg # It's not on
    }
    else {
      describe # 9,1¿3,1? 9,1R3,1i9,1d3,1D9,1l3,1e 9,1M3,1e 9,1T3,1h9,1i3,1S 9,1?3,1¿ has been turned off.
      riddle.end
    }
  }
  elseif ($1 == !riddle) {
    if !%rdl.on {
      new.riddle #
    }
    else {
      describe # ¿? %rdl.riddle ?¿
    }
  }
  elseif (%rdl.on) {
    if ($1- == %rdl.answer) {
      describe # %rdl.answer $+ !¡! Congratulations $nick you are correct!
      describe # Type !riddle for another round.
      riddle.end
    }
    else {
      .notice $nick Sorry $nick $+ , that's wrong.
    }
  } 
} 
alias new.riddle {
  set %rdl.on 1
  var %read = $read(riddle.txt)
  set %rdl.answer $gettok(%read,2-,61)
  set %rdl.riddle $gettok(%read,1,61)
  describe $1 9,1¿3,1? 9,1R3,1i9,1d3,1D9,1l3,1e 9,1M3,1e 9,1T3,1h9,1i3,1S 9,1?3,1¿
  describe $1 :: %rdl.riddle ::
  .timer.riddle.end.turn 1 60 riddle.end.turn $1
}
alias  riddle.end.turn {
  describe $1 Time's up the answer was %rdl.answer
  describe $1 Put your Thinking Caps on Brainiacs!
  new.riddle $1
}
alias riddle.end {
  unset %rdl.on
  unset %rdl.answer
  unset %rdl.riddle
  .timer.riddle.end.turn off
}
;
;riddle.txt format &lt;riddle&gt;=&lt;answer&gt; ie:
;Whats black and white and red all over=newspaper
;Why did the chicken cross the road=To get to the other side
;

#115462 28/03/05 05:27 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
Is it possible for me to use %acr $+(.,$nick) or something like that so i could set up some kind of points? Like whenever a person gets an answer right it will inc the variable by 1

#115463 28/03/05 08:06 AM
Joined: Mar 2005
Posts: 46
P
Pariah Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Mar 2005
Posts: 46
Another thing ive noticed from playing around with the acronym game, is that after a user guesses the correct answer, if anyone says it after them it says congratulations to them too. I really hate to ask you guys for more help since you've helped me so much already, but it's greatly appreciated.

#115464 28/03/05 12:48 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
If thats the case, then I think you have altered something, becuase I tested it out and that didnt happen, (%rdl.on) must be set, and when someone gets win messaged it gets unset.

---

%acr $+(.,$nick) this isnt the correct format!

Ill break down whats it is...

$+(%,arc.,$nick) this builds the string "%arc.$nick", of course $nick isnt "$nick" but the usersname

Now if you want to set a value to it its /SET $+(%,arc.,$nick) valuehere
Now if you want to var a value to it its /VAR $+(%,arc.,$nick) = valuehere

But if you want to access the value of %arc.$nick then you must use $($+(%,arc.,$nick),2) or add a $( ... ,2) around it essentially.
This means evaluate it 2 times, once gets the "%arc.$nick the second time the contents of that!


Link Copied to Clipboard