|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
Im relatively new to scripting and wanted to create a script that returned the most amount of users online in a particular channel and record the time of it. I think the following is logically correct but I dont think it is evaluating "$nick(#channel,0)" because I have tried echoing it and it wouldn't work then either. What I have is:
/highset if($nick(#channel,0) > %highestPeeps) {/set %highestPeeps $nick(#channel,0) | /set %highestPeepTime $fulldate}
I initiated %highestPeeps with 1. Im using mIRC version 6.1. I moved everything out of remote into alias thinkin it might work better.
Any ideas?
|
|
|
|
Joined: Dec 2002
Posts: 332
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 332 |
alias highset {
if ($nick($active,0) > %highestPeeps) {
/set %highestPeeps $nick($active,0) | /set %highestPeepTime $fulldate
}
%highestPeeps 30 %highestPeepTime Wed Feb 18 21:04:52 2004 $active refers to the channel inwhich you type /highset when adding a /something to a remote file you need to code it as alias whatever { which is = to /whatever if you want you can add a variable to return the channel which you were in such as set %highpeepschannel $active hope that helps
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
What you posted made no visible difference Thanks for replying with a suggestion. Its not setting the %highestPeepTime variable either. I'm sure it's something simple...
|
|
|
|
Joined: Dec 2002
Posts: 102
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 102 |
/highset if($nick(#channel,0) > %highestPeeps) {/set %highestPeeps $nick(#channel,0) | /set %highestPeepTime $fulldate} I think spacing is your issue: /highset if ($nick(#channel,0) > %hightestPeeps) { set %highestPeeps $nick(#channel,0) | set %highestPeepsTime $fulldate } You need to have spaces after {'s and |'s and before }'s.
- MIMP
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
Spacing helped me out with displaying what I had initialised the %highestPeepTime, but it still isnt setting the new values on join. I've tried this: /nicks echo $nick(#channel,0) and nothing happens. I think this is where my problem is, but according to help, I've written it correctly. Thanks for the heads up on where to put spaces
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
on *:join:[color:blue]#channel[/color]:{
if ($nick(#,0) > %highestPeeps) { set %highestPeeps $nick(#,0) | set %highestPeepTime $fulldate }
} Change #channel to whatever channel you want this for.
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
Thanks, looked like it was going to work but it didnt Ive checked my variables spelling, gone through it. I can call the varialbles in another alias and have the messaged to channel, I just cant get the initial if statement evaluated and the variables set. Could it be the server preventing that particular command? Does $nick(#channel,0) work for anyone else?
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
The #channel in $nick( #channel,0) needs to be the real #channelname or "#" ("$chan") if it is called from an event/ or command. Type in channel window //echo -a $nick(#,0) <- needs two //'s to evaluate the $nick() identifier. Also //set -s %HighestPeeps $nick(#,0) <- the -s switch will 'show' you if and what the var was set to. If the %highestPeeps var isn't set, you can set it with /set %highestPeeps 0Here also is (slightly) different code which has a check fo rth evar not being present on *:join:[color:blue]#channel[/color]:{
if ($nick(#,0) > %highestPeeps) || (!%highestPeeps) { set %highestPeeps $nick(#,0) | set %highestPeepTime $fulldate }
} And again the #channel should be changed to whatever channel you want this for.
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
I just don't understand. If I type //echo -a $nick(#,0) it works. If I type //set -s %HighestPeeps $nick(#,0) it works. If I dont use the -a and -s switches (having specific a channel where # is) it doesnt work. I've done what you said and used my channel, where you told me to. Ill paste exactly what I have in my script folder so you can point out what Im doing wrong.
on *:join:#whitetower:{ if ($nick(#,0) > %highestPeeps) || (!%highestPeeps) { set %highestPeeps $nick(#,0) | set %highestPeepTime $fulldate } }
Spaces dont copy across too well, I have it spaced as directed earlier too. It's just not assigning the new variables on join If Im truly that inept Ill put this on a back burner and move on with something else and stop wasting your time.
|
|
|
|
Joined: Feb 2004
Posts: 124
Vogon poet
|
Vogon poet
Joined: Feb 2004
Posts: 124 |
If I dont use the -a and -s switches (having specific a channel where # is) it doesnt work. That's because if the first parameter after the /echo command is a number, it's seen as specifying a color. So if there are four users on #mIRC and you do this ... //echo $nick(#mIRC,0) users are on #mIRC right now!! .. it will turn out like this .. users are on #mIRC right now!!
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Try typing /remote on and see if the join works then.
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
Nope Nothing I do or change seems to make a different. Thanks for your help if its not a bug then it's me. If I come back to it and succeed Ill make sure to post the result here for everyone else as frustrated as me.
|
|
|
|
Joined: Dec 2002
Posts: 102
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 102 |
I tested the following code in #mIRC with version 6.1 and it seems to work fine. It's the same code you posted before just moved to more than one line. You may need to double check that you do not have another on join event interfering with this. on *:join:#mIRC:{
if ($nick(#,0) > %highestPeeps) || (!%highestPeeps) {
set -s %highestPeeps $nick(#,0)
set -s %highestPeepTime $fulldate
} } * Set %highestPeeps to 52
-
* Set %highestPeepTime to Thu Feb 19 18:58:51 2004
-
* Set %highestPeeps to 53
-
* Set %highestPeepTime to Thu Feb 19 19:01:57 2004
-
* Set %highestPeeps to 54
-
* Set %highestPeepTime to Thu Feb 19 19:02:10 2004
- MIMP
|
|
|
|
Joined: Feb 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Feb 2004
Posts: 7 |
You're a champ!! The only difference I saw was the use of the -s switch with set. I don't know if thats what the whole trouble was but Im so elated it's finally working!! Thanks everyone for helping me through this one
|
|
|
|
Joined: Dec 2002
Posts: 102
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 102 |
No, all -s does is shows the output when the variable is set. You can remove it, I just had it in there for debugging. Glad to hear it works.
- MIMP
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
I did a search and found this threat. I have kind of the same problem.. i have this: on me:*:JOIN:#: {
var %i = 1
while (%i <= $nick(#,0)) {
.msg Zyzzyx26 7- $nick(#,%i).pnick
inc %i
}
} This is for my bot.. i want that whenever it joins a channel he /msgs me telling the users on it. The code seems fine to me, but the $nick(#,0) is being set as 1, no matter how many users the channel actually has! I tryed typing //echo $nick(#,0) and it returned the correct number of users, but when the bot joins it only returns 1. (i've also tried the script in a new .mrc file, but nothing..) Please help Thanks, Zyzzy.
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
When on JOIN fires for you joining a channel you have not yet recieved the names list, try it on raw 366 instead.
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
raw 366 or raw 353? Because i have this raw *:*: echo 4 -s $numeric $1- and it echos: 353 <nick> = #channel <nicks in the channel>while the 366 returns 366 <nick> #channel End of /NAMES listAnd how do i use it? Thanks, Zyzzy.
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
Joined: Dec 2002
Posts: 3,138
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,138 |
Raw 366 is triggered when the names list has been recieved, only when it has will $nick(#channel,0) return the correct amount of people. raw 366:*:{
echo -a $nick($2,0)
} In raw 366 $2 is the channel name.
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
Oic.. The $nick($2,0) identifier works, it returns the number of nicks in the channel.. but now i've got another little issue Neither $nick($2,%i) nor $nick(#,%i) is working on the while part: raw 366:*:{
var %names = $nick($2,0)
var %i = 1
while (%i <= %names) {
.msg Zyzzyx26 - [color:blue]$nick(#,%i)[/color] or [color:blue]$nick($2,%i)[/color]
inc %i
}
} Why? :P Thanks, Zyzzy.
"All we are saying is give peace a chance" -- John Lennon
|
|
|
|
|
|
|
|