mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#71992 19/02/04 01:49 AM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
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?


#71993 19/02/04 03:08 AM
Joined: Dec 2002
Posts: 332
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
Code:
  
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 smile

#71994 19/02/04 03:40 AM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2004
Posts: 7
What you posted made no visible difference frown

Thanks for replying with a suggestion. Its not setting the %highestPeepTime variable either.

I'm sure it's something simple...

#71995 19/02/04 03:47 AM
Joined: Dec 2002
Posts: 102
M
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 102
Quote:
/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
#71996 19/02/04 07:51 AM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
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 smile

#71997 19/02/04 07:59 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
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.

#71998 19/02/04 08:52 AM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2004
Posts: 7
Thanks, looked like it was going to work but it didnt frown

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?

#71999 19/02/04 09:05 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
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 0
Here also is (slightly) different code which has a check fo rth evar not being present
Code:
on *:join:[color:blue]#channel[/color]:{
  if ($nick(#,0) &gt; %highestPeeps) || (!%highestPeeps) { set %highestPeeps $nick(#,0) | set %highestPeepTime $fulldate }  
}
And again the #channel should be changed to whatever channel you want this for.

#72000 19/02/04 12:39 PM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
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.
Code:
 on *:join:#whitetower:{ if ($nick(#,0) &gt; %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 frown
If Im truly that inept Ill put this on a back burner and move on with something else and stop wasting your time.

#72001 19/02/04 12:51 PM
Joined: Feb 2004
Posts: 124
T
Vogon poet
Offline
Vogon poet
T
Joined: Feb 2004
Posts: 124
Quote:
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!!

#72002 19/02/04 09:47 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Try typing /remote on and see if the join works then.

#72003 20/02/04 01:29 AM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2004
Posts: 7
Nope frown

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.

#72004 20/02/04 02:04 AM
Joined: Dec 2002
Posts: 102
M
Vogon poet
Offline
Vogon poet
M
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.

Code:
on *:join:#mIRC:{
  if ($nick(#,0) &gt; %highestPeeps) || (!%highestPeeps) {
    set -s %highestPeeps $nick(#,0) 
    set -s %highestPeepTime $fulldate
} }

Code:
* 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
#72005 20/02/04 02:25 AM
Joined: Feb 2004
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Feb 2004
Posts: 7
You're a champ!! smile

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 smile

#72006 20/02/04 02:32 AM
Joined: Dec 2002
Posts: 102
M
Vogon poet
Offline
Vogon poet
M
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. cool


-
MIMP
#72007 21/04/04 11:48 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I did a search and found this threat. I have kind of the same problem.. i have this:
Code:
on me:*:JOIN:#: {
    var %i = 1
    while (%i &lt;= $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 wink

Thanks,
Zyzzy. smile


"All we are saying is give peace a chance" -- John Lennon
#72008 21/04/04 11:58 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
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.

#72009 22/04/04 09:02 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
raw 366 or raw 353? Because i have this
Code:
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 list

And how do i use it? smile

Thanks, Zyzzy.


"All we are saying is give peace a chance" -- John Lennon
#72010 22/04/04 10:09 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
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.

Code:
raw 366:*:{
  echo -a $nick($2,0)
}


In raw 366 $2 is the channel name.

#72011 23/04/04 02:45 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oic.. smile The $nick($2,0) identifier works, it returns the number of nicks in the channel.. but now i've got another little issue smirk

Neither $nick($2,%i) nor $nick(#,%i) is working on the while part:
Code:
raw 366:*:{
  var %names = $nick($2,0)
  var %i = 1
  while (%i &lt;= %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
Page 1 of 2 1 2

Link Copied to Clipboard