mIRC Home    About    Download    Register    News    Help

Print Thread
#239421 25/10/12 01:41 PM
Joined: Oct 2012
Posts: 7
T
Thomas Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Oct 2012
Posts: 7
i have been making a dicing bot for 60x2. but i cant seem to get it right... if it rolls below 60 it says you lost ....... but if it rolls over 60. it still says you lost ......

here is the script so far:


Code:
on *:TEXT:!60x2*:#chan: {
  if ($2 != $null) && ($3 != $null) && ($4 != $null) && ($nick !ishop $chan) && ($nick !isop $chan) {
    notice $nick 12You must be a channel (half)operator to use this command.
    halt
  }
  if ($2 != $null) && ($3 != $null) && ($nick ishop $chan || $nick isop $chan) {
    set %roller1 $2
    set %rollpot $3
    msg # 12 $+ %roller1 %rollpot Pot gl - 1 60 = win. type !dice
  }
}

on *:TEXT:!dice*:#: {
  if ($nick == %roller1) ($nick == %roller1 <60) {
    %roll1 = $rand(1,100)
    msg $chan  12 $nick 1 Rolled The Number 2|12 %roll1 2| 1On a 121-100 percentage dice.

    if (%roll1) {
      msg $chan 12 %roller1 1 lost the 12 %rollpot pot 1  with the roll: 12 %roll1 .
      unset %*roll*
    }
    elseif (%roll1) ($nick == %roller1 >60) {
      msg $chan 12 %roller1 1 wins the 12 %rollpot pot 1  with the roll: 12 %roll1 .
      unset %*roll*

    }
  }


Code:
if ($nick == %roller1) ($nick == %roller1 <60) {


Code:
elseif (%roll1) ($nick == %roller1 >60) {



im not sure if those two are wrong.. please help me smile

regards,
humeruzz

Thomas #239422 25/10/12 02:10 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I told you in your last thread that all your checks are redundant. I don't know why you're checking for $3 for ops and $4 for non-ops; I can only guess you shouldn't be doing this, but I'm not a mind reader. The first event should be replaced with the following:

Code:
on *:TEXT:!60x2*:#chan: {
  if ($nick !ishop #) && ($nick !isop #) {
    if ($4 != $null) {
      notice $nick 12You must be a channel (half)operator to use this command.
    }
  }
  elseif ($3 != $null) {
    set %roller1 $2
    set %rollpot $3
    msg # 12 $+ %roller1 %rollpot Pot gl - 1 60 = win. type !dice
  }
}


For your second event you are using the pipe | in your text. You happen to be using color codes right next to it so it's okay, but be careful using it in your text in the future because this is reserved for separating commands on a single line.

Code:
if ($nick == %roller1) ($nick == %roller1 <60) {

Here you seem to be using the same variable for the name and for the value, and trying to check the value before it's been set. Then you have the fact that the syntax is all wrong - but I can't really correct it because your code doesn't make sense anyway.

Please keep all your dice questions in a single thread. We don't need a new one every time you're doing something wrong, and it seems like that will be happening a lot.

If you write out what you're doing in English first and then turn it into mIRC script you might have a better time spotting what you're doing wrong with your syntax.

Thomas #239423 25/10/12 09:23 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
if ($nick == %roller1) ($nick == %roller1 <60) {


You can't do that. Try saying that as words. How would you say it? "If $nick is %roller1 $nick is %roller1 is less than 60 then..." Does that sound like a normal sentence? Think about how it should sound when spoken and that will give you a better idea of how to script it. My guess is that you mean, "If $nick is %roller1 and %roll1 < 60 then..." If that's the case, think about how that is written in English and how you'd convert that to a script...

Code:
if ($nick == %roller1 && %roll1 < 60) {


Do the same for your elseif check. Saying it out loud or writing it out as words can make your life much easier. In many cases, that tells you what you are missing or how it should be laid out in a script.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard