mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
!request script #98744 26/09/04 01:52 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Can anyone tell me what i did wrong?
Code:
on *:text:!request*:#channel:{
  if ($2 == $me) {
    join $3
    if ($calc($nick($chan,0)) < 5) {
      .timer 1 3 msg $nick Request failed. You do not have the required amount of users in channel.
      .timer 1 4 part $3
    }
    elseif ($calc($nick($chan,0)) >= 5) {
      .timer 1 3msg $nick Your channel meets the requirements and I will stay. Remember give me op or else my commands wont work.
    }
  }
}


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98745 26/09/04 02:10 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I dont know whats the problem.. but i spoted one error..

timer 1 3msg <<-- that wont work..

add a space.. timer 1 3 .. and a tip, use a . infront of the time, then you dont need to see it start and stop every time..

.timer 1 3


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: !request script #98746 26/09/04 02:12 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Haha blush my bad.. well if the users on the chan is 5 or above it still says "Request failed. You do not have the required amount of users in channel." And parts the channel? confused

btw. There is . infront of timer wink


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98747 26/09/04 02:19 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Why are you using $calc? $nick($chan,0) already gives you the amount of people inside $chan.

[i]Edit: ($nick($chan,0) < 5) --> what channel is this one you want to get the number of users from? The !request channel ($3) or the channel where the !request text occurred?

Last edited by Zyzzyx26; 26/09/04 02:22 PM.

"All we are saying is give peace a chance" -- John Lennon
Re: !request script #98748 26/09/04 02:20 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
okay then what is $calc used for? I need it to check the amount of users on the channel it joins


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98749 26/09/04 02:24 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I've edit the post, please check it out wink

$calc is used to make mathematics calculations. $calc(2 + 3) = 5; $calc(3^2) = 9 and so on.. You don't need $calc in the $nick() identifier.

Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
Re: !request script #98750 26/09/04 02:27 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
The channel i need to count from is the one it joins $3 so is it just

($nick($chan,$3) < 5) then?


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98751 26/09/04 02:28 PM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Most likely you think the code does something when in fact you missed a step or so. What exactly do you want the code
to do?

Right now, it does the following:
If anyone but you (why would you allow anyone to do that anyway - remember you cannot trigger your own on TEXT events!)
types !request yournick #channelname, the code first checks if yournick matches your current nick. If so, it will join
#channelname (personally I'd add a check to see if $3 is a valid channel name). Then it will check the amount of users in the
channel the text was typed in (NOT the channel you just joined), and if the number is smaller than 5, it will prompt an error
(not 100% sure this will actually work, since there is a $calc identifier used that doesn't actually calculate anything, so why
is it even there). It will then also part the channel the command was typed in.
If the amount of users in the channel the command was typed in is more than 4, you will stay in the channel the command was
typed in.

Now I imagine the whole checking and so is supposed to take place in the channel you just joined. That means most your code needs to be changed, as it fails there.

Based on this assumption, you would need to change your code as follows (change the parts in blue as you see fit)

Code:
[color:green]; wait till anyone but you types !request yournick #channelname[/color]
on *:TEXT:!request*:[color:blue]#channelname[/color]: {
  [color:green]; make sure they typed yournick and a valid channelname[/color]
  [color:green]; if so - join the channel and save the requester's name[/color]
  if ($2 == $me) &amp;&amp; ($left($3,1) == $chr(35)) { join $3 | set $+(%,req,$3) $nick }
}
[color:blue] [/color]
[color:green]; after joining, wait for the /names list to complete, then check users[/color]
raw 366:*: {
  [color:green]; check usercount[/color]
  if ($nick($2,0) &lt; 5) {
    [color:green]; if there's not enough users, inform the requester[/color]
    .msg $eval($+(%,req,$2),2) [color:blue]Request failed. You do not have the required amount of users in channel.[/color]
    [color:green]; and leave[/color]
    .part $2
  }
  [color:green]; otherwise, stay[/color]
  else .msg $eval($+(%,req,$2),2) [color:blue]Your channel meets the requirements and I will stay. Remember give me op or else my commands wont work.[/color]
  [color:green]; clean up your mess when you're done ![/color]
  unset $+(%,req,$2)
}


Now this code could potentially get your bot into a lot of channels, which could cause serious problems....



DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: !request script #98752 26/09/04 02:35 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Hmm. not quite. If the bot (assuming its a bot) has joined the channel between join $3 and the IF statement, then yes. But that is very unlikely, since from the /join to the IF stat. it takes miliseconds Suggestion:
Code:
on *:text:!request*:#channel: if ($2 == $me) { join $3 | set $+(%,request.,$3) $nick }
on me:*:join:#: {
 if ($eval($+(%,request.,$3),2)) {
   var %nick = $ifmatch
    if ($nick($chan,0) &lt; 5) {
      .timer 1 3 msg %nick Request failed. You do not have the required amount of users in channel.
      .timer 1 4 part $chan
    }
    elseif ($nick($chan,0) &gt;= 5) {
      .timer 1 3 msg %nick Your channel meets the requirements and I will stay. Remember give me op or else my commands wont work.
    }
  unset $+(%,request.,$chan)
  }
}
The above should work. It creates a variable that, when combined with the ON Join, should have the effect you want.

Hope this helps smile
Zyzzyx.

Edit: you might also use Raw 366, as LocutusofBorg did. In this case, replace the [i]on me:*:join event for raw 366:*: and, under that same ON Join, replace all $chan for $2's.

Last edited by Zyzzyx26; 26/09/04 02:38 PM.

"All we are saying is give peace a chance" -- John Lennon
Re: !request script #98753 26/09/04 02:35 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
i would add some type of "ignore".. if the bot been in a channel.. and user count is to low, then put that channel as a no no for X amount of time.. else it can be abused by !request many times in a row.. wink but thats me, im maybe a bit paranoid wink


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: !request script #98754 26/09/04 02:41 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Workes fine smile

Thanks guys


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98755 26/09/04 02:42 PM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
I'm wondering if you tested it. You MUST use the raw, as in the on JOIN event, you cannot count nicks in the channel using $nick. That doesn't become available until after the /names has been processed.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: !request script #98756 26/09/04 02:43 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
That is very true, I forgot :P


"All we are saying is give peace a chance" -- John Lennon
Re: !request script #98757 26/09/04 03:00 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Okay now this is what i got:
Code:
on *:TEXT:!request*:#channel:{
  if ($2 == $me) &amp;&amp; ($left($3,1) == $chr(35)) {
    join $3
    set $+(%,req,$3) $nick
  }
}

raw 366:*:{
  [color:red]if ($nick !isop $2) {
    .timer 1 3 part $2
    .timer 1 5 msg $eval($+(%,req,$2),2) You are not opped on channel $2 try again when you have op.[/color]
  }
  elseif ($nick($2,0) &lt; 5) {
    .timer 1 3 .msg $eval($+(%,req,$2),2) Request failed. You do not have the required amount of users in channel.
    .timer 1 5 .part $2
  }
  else timer 1 3 .msg $eval($+(%,req,$2),2) Your channel meets the requirements and I will stay. Remember give me op or else my commands wont work.
  unset $+(%,req,$2)
}


I have edit the line with the red color
Now there is just one problem.
When i take the bot myself and type /j #channel it also parts and give this message:

[5:00PM] -> *You* are not opped on channel #pik try again when you have op.

And this when i use /hop:

port80c.se.quakenet.org No such nick


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98758 26/09/04 03:05 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
when you type join u do a input..

on 1:INPUT: {
if ($1 == /join) { set %var 1 }
if ($1 == /hop) { set %var 1 }
if ($1 == /part) { set %var2 }
}

raw 366:*:{
if (%var == 1) { goto end }
the rest of your code here.
:end
}

thats one way to sove it.. mabe you can find bether ones tho, play with that and i think u find a way smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: !request script #98759 26/09/04 03:11 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
on me:*:INPUT:{
if ($1 == /j) || ($1 == /join) || ($1 == /hop) || ($1 == /part) {
set %var 1
}
}

raw 366:*:{
if (%var == 1) { goto end }
the rest of your code here.
:end
}


you can use that aswell


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98760 26/09/04 03:29 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
you have to change the %var somwhere too.. /part would be one place.. if it's set to 1 all the time, then the addon wont work..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: !request script #98761 26/09/04 03:37 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Ca´n't you do it like this then?

Code:
on me:*:INPUT:#:{
   if ($1 == /j) { set %var 1 }
   if ($1 == /join) { set %var 2 }
   if ($1 == /hop) { set %var 3 }
   if ($1 == /part) { set %var 4 }
  }
}

raw 366:*:{
  if (%var == 1) || (%var == 2) || (%var == 3) || (%var == 4) { goto end }
rest of code here.
:end
}


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: !request script #98762 26/09/04 03:46 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
shure.. but no need to have more then one value for all events..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: !request script #98763 26/09/04 04:57 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
But you said before that i needed to change some?


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Page 1 of 2 1 2