|
Joined: Apr 2007
Posts: 19
Pikka bird
|
OP
Pikka bird
Joined: Apr 2007
Posts: 19 |
Hello How can I do this: if ($$1 == me) $$1 == $nickLet me explain the details. I have this: <Tom>!points Peter <Bot>Peter points: 1,559
ON @7:TEXT:!points*:#:{ /k-show-points $$2 }
alias k-show-points {
if ( %k-botcolor == 1 ) { /msg $chan 8,3 $$1 points: $var($+(%, points., $$1),1).value }
else { /msg $chan [ $$1 Points: $var($+(%, points., $$1),1).value ] }
}
and I wonder how to add this feature: <Tom>!points me <Bot>Tom points: 3,000 theres no hurry but its a nice feature  Thanks
Last edited by endlos; 28/06/07 05:00 PM.
|
|
|
|
Joined: Jun 2007
Posts: 2
Bowl of petunias
|
Bowl of petunias
Joined: Jun 2007
Posts: 2 |
i think it would be better to do all the commands under the one event, if its simply just meant to respond to a ! command by the user and the client is a bot: on @7:TEXT:!points*:#:{
; checks if the second word is "me" if it is, sets the variable %nick to the actual person
if ($$2 == me) { var %nick $nick }
; sets the variable %nick to the users second word if it isnt "me"
else { var %nick $$2 }
; this line will shorten down your script a bit - since you have the colour codes in the exact same places, and the ones at the end are not required since theres no text after them, just set them to a variable
if (%k-botcolor == 1) { var %x 8,3 }
else { var %k }
; ive added this check for you - to make sure that the users "points" exist in a variable before messaging
if ($var($+(%, points.,%nick),1).value) { msg $chan %x %nick points: $var($+(%, points.,%nick),1).value }
; then just added this line to show a response if their points dont exist
else { msg $chan %x %nick Not Found! }
} However, if for one reason or another you want it in two steps, for say if you wanted to trigger the script when on the bots actual client, i didnt explain it as much as its pretty much a repeat of the above, the code will be
; Just Added $nick and $chan to the command - explained underneath
ON @7:TEXT:!points*:#:{ /k-show-points $$2 $nick $chan }
alias k-show-points {
; here we use much of the same principle as the above script, for this to work we had to have the actual nick who triggered the on text event at our disposal, in order for us to use their name instead of the text
if ($1 == me) { var %nick $1 }
else { var %nick $2 }
if (%k-botcolor == 1) { var %x 8,3 }
else { var %k }
; here, ive replaced your $chan with $3 from the command - this is just better incase the script is running in more then one channel, or if the mirc client isnt actually active on that particular channel
if ($var($+(%, points.,%nick),1).value) { msg $3 %x %nick points: $var($+(%, points.,%nick),1).value }
else { msg $3 %x %nick Not Found! }
} hope this helps
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
why use /k-show-points ? the / arent needed as long as you dont trigger the command your self. so you can remove that.. k-show-points will do the same thing in a remote script as /k-show-points
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
Probably personal preference. Either way the script does the same so it's not important.
OP:
Use $iif($$1 == me,$nick,$v1) instead of just $$1
|
|
|
|
Joined: Mar 2007
Posts: 218
Fjord artisan
|
Fjord artisan
Joined: Mar 2007
Posts: 218 |
Why did you use / in /msg then?
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Apr 2007
Posts: 19
Pikka bird
|
OP
Pikka bird
Joined: Apr 2007
Posts: 19 |
Mystery, Thanks for the idea, I'll try it.
Sparta, I use the / for visual preference.
hixxy, looks good and works, though the code will get messy replacing every $$1 with that.
Thanks guys.
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
You could also just use a variable: var %1 = $iif($$1 == me,$nick,$v1) Then just use %1 in place of $$1
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
what happens if a player is called me
<me> !points me <bot> me points: 200
still works, but if another player wants to see me's points it breaks.
<player1> !points me <bot> player1 points: 300
how are the scores stored? you could add a switch
if %pointsme { code }
at the beginning to sort that out...
of course if a player called me is playing then the whole thing breaks, better with a !mypoints or something.
btk
Last edited by billythekid; 29/06/07 10:41 PM.
billythekid
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
on *:JOIN:#channel:if ($nick == me) kick $nick Invalid nickname
:P
-genius_at_work
|
|
|
|
Joined: Dec 2002
Posts: 503
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 503 |
Why not just use '!points' on it's own for self-points-return, and drop of the 'me' thing?
|
|
|
|
Joined: Apr 2007
Posts: 19
Pikka bird
|
OP
Pikka bird
Joined: Apr 2007
Posts: 19 |
Thanks for all the ideas, you are right in everything, it may break with a user named "me".
I'll take the alternative with just the !points alone.
Thanks.
|
|
|
|
|