mIRC Home    About    Download    Register    News    Help

Print Thread
#168572 10/01/07 05:27 PM
Joined: Dec 2006
Posts: 37
T
THE_ADZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Dec 2006
Posts: 37
OK: I have the following problem. I made a script that if you type !order blah, it brings you that, and if you type !order blah for blah, it brings it to them. And for some reason it is not working:


on 1:TEXT:!order*:#avatarrp,#mirc:{ if (%mood == 3)
/msg $chan * ADZ's Robot is too tired (Yeah ROBOTS GET TIRED TOO!)...No ordering today!
}
else { /msg $chan * ADZ's Robot brings $nick $2-
}

on 1:TEXT:!order*for*:#avatarrp,#mirc:{ if (%mood == 3)
/msg $chan * ADZ's Robot is too tired (Yeah ROBOTS GET TIRED TOO!)...No ordering today!
}
if ($3 == for) {
/msg $chan * ADZ's Robot brings $2 for $4 from $nick | halt
}
if ($4 == for) {
msg $chan * ADZ's Robot brings $2 for $5 from $nick | halt
}
if ($5 == for) {
msg $chan * ADZ's Robot brings $2 for $6 from $nick | halt
}
else {
msg $chan * ADZ's Robot only delivers orders to other people that are under 4 words long. Bad memory laugh
}

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It is because you have !order* before !order*for*, so the second one won't ever trigger. You also had a {} mismatch and your IF's weren't set up correctly.

Here's a rewrite with a little improvement (it'll work with any length of item instead of just 4). Btw, use code tags when displaying code as it makes things much easier to read. smile

Also, you might want to consider changing msg to describe so that it displays it as an action (/me) instead of as a message.

Code:
on 1:TEXT:!order*:#avatarrp,#mirc:{
  if (%mood == 3) {
    msg $chan * ADZ's Robot is too tired (Yeah ROBOTS GET TIRED TOO!)...No ordering today!
  }
  else {
    if (* for * iswm $2-) {
      msg $chan * ADZ's Robot brings $gettok($2-,1- $calc($gettok($2-,0,32) - 2),32) for $gettok($2-,$gettok($2-,0,32),32) from $nick $+ .
    }
    else {
      msg $chan * ADZ's Robot brings $nick $2- $+ .
    }
  }
}


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard