mIRC Home    About    Download    Register    News    Help

Print Thread
if ($$1 == me) $$1 == $nick ??? #179828 28/06/07 04:46 PM
Joined: Apr 2007
Posts: 19
E
endlos Offline OP
Pikka bird
OP Offline
Pikka bird
E
Joined: Apr 2007
Posts: 19
Hello

How can I do this: if ($$1 == me) $$1 == $nick

Let me explain the details. I have this:

<Tom>!points Peter
<Bot>Peter points: 1,559

Code:
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 laugh

Thanks

Last edited by endlos; 28/06/07 05:00 PM.
Re: if ($$1 == me) $$1 == $nick ??? [Re: endlos] #179834 28/06/07 05:22 PM
Joined: Jun 2007
Posts: 2
M
Mystery Offline
Bowl of petunias
Offline
Bowl of petunias
M
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:

Code:
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

Code:
; 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

Re: if ($$1 == me) $$1 == $nick ??? [Re: Mystery] #179836 28/06/07 05:25 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
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,.) }
Re: if ($$1 == me) $$1 == $nick ??? [Re: sparta] #179837 28/06/07 05:27 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
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

Re: if ($$1 == me) $$1 == $nick ??? [Re: sparta] #179838 28/06/07 05:28 PM
Joined: Mar 2007
Posts: 218
V
vexed2 Offline
Fjord artisan
Offline
Fjord artisan
V
Joined: Mar 2007
Posts: 218
Why did you use / in /msg then?

Re: if ($$1 == me) $$1 == $nick ??? [Re: vexed2] #179840 28/06/07 05:44 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
in what msg ?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: if ($$1 == me) $$1 == $nick ??? [Re: Mystery] #179843 28/06/07 06:08 PM
Joined: Apr 2007
Posts: 19
E
endlos Offline OP
Pikka bird
OP Offline
Pikka bird
E
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.

Re: if ($$1 == me) $$1 == $nick ??? [Re: endlos] #179845 28/06/07 06:31 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
You could also just use a variable:

Code:
var %1 = $iif($$1 == me,$nick,$v1)


Then just use %1 in place of $$1

Re: if ($$1 == me) $$1 == $nick ??? [Re: Mystery] #179893 29/06/07 10:39 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
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
Re: if ($$1 == me) $$1 == $nick ??? [Re: billythekid] #179900 30/06/07 01:09 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
on *:JOIN:#channel:if ($nick == me) kick $nick Invalid nickname



:P

-genius_at_work

Re: if ($$1 == me) $$1 == $nick ??? [Re: genius_at_work] #179907 30/06/07 04:10 AM
Joined: Dec 2002
Posts: 503
B
Bekar Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
Why not just use '!points' on it's own for self-points-return, and drop of the 'me' thing?

[SOLVED] Re: if ($$1 == me) $$1 == $nick ??? [Re: Bekar] #180263 06/07/07 07:33 PM
Joined: Apr 2007
Posts: 19
E
endlos Offline OP
Pikka bird
OP Offline
Pikka bird
E
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.