mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2014
Posts: 83
H
Babel fish
OP Offline
Babel fish
H
Joined: Sep 2014
Posts: 83
I have the following code:

Code:
ON *:TEXT:*tip gamebot*:#:{ 
  if ($mnick != gamebot) { return } 
  set %chan $chan
  set %game $4
}
ON *:TEXT:*tipped gamebot*:#: { 
  if ($mnick != gamebot) { return } 
  if ($1 == gamebot) { halt }
  if ($nick == pointsbot) {
    set %player $1
    set %bet $4
    if ($4 > 500) { 
      if (%game == donate ) {
        /msg %chan Thank you %player for your donation!
        halt
      }
      msg $chan !tip %player %bet Sorry! I only accept 500 at a time MAX!
      halt 
    }
    %game
  }
}


note: at the %game area at bottom it goes to specified alias

But my problem is this works fantasticly BUT when two people try and play the games, it seems to bork and do whatever the last person chose....

Example:
Quote:

[19:48] <@happyfappy> !tip gamebot 83 dice
[19:48] <Player2> !tip gamebot 2 slots
[19:49] <+pointsbot> happyfappy tipped gamebot 83 points
[19:49] <@gamebot> happyfappy Your spin: ( BAR ) ( BAR ) ( BAR )
[19:49] <@gamebot> !tip happyfappy 249 WINNER WINNER!
[19:49] <+pointsbot> Player2 tipped gamebot 2 points
[19:49] <@gamebot> Player2 Your spin: ( Cherry ) ( Cherry ) ( FREE )
[19:49] <@gamebot> Player2 1 FREE PLAY credits added! (use !freespin)


how can I prevent this issue?

i've tried with .ini's but it seems to refuse to read them (i've checked they all match and they do but still wont read)

is there another way?

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Problem is in your way of setting %player adn %bet.
When you use /set %x $1 - it is set as global variable, and if two players write command simultaniously - %x would be re-seted for last recieved command but %game-alias probably wont be that fast and triggers twice for %x which can have only 1 value.
To avoid this, you better use /var %x = $1, and run alias not as /game, but as /game %x %x2 ..., and inside of your game-alias you need to re-assign this %x, %x2 which will be $1,$2 so on.


Dont give a fish - teach to fish!

Link Copied to Clipboard