mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
#98764 26/09/04 04:58 PM
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
if (%var == 1) { echo -a do this }
else echo -a do that

the %var is set to 1 .. then u halted ur script.. but if set to 2, then it shouldent halt..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98765 26/09/04 05:02 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
oh okay... Thanks smile

So now my script looks like this:

Code:
on *:TEXT:!request*:#channel:{
  if ($2 == $me) && ($left($3,1) == $chr(35)) {
    join $3
    set $+(%,req,$3) $nick
  }
}

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

*raw 366:*:{
  if (%var == 1) || %var == 2) { goto end }
  elseif ($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.
  }
  elseif ($nick($2,0) < 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)
  :end
}


Is there anyone there can spot errors?


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#98766 26/09/04 05:29 PM
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
why dont u just try it? then u notice if its any problem


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98767 26/09/04 05:43 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Code:
raw 366:*:{
  if (%var == 1) || %var == 2) { goto end }
  [color:red]elseif ($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.
  }
  elseif ($nick($2,0) < 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)
  :end
}[/color]



Text marked with red doesnt work.


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#98768 26/09/04 05:46 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
There is no $nick in raw events.


New username: hixxy
#98769 26/09/04 05:49 PM
Joined: Mar 2004
Posts: 457
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Mar 2004
Posts: 457
why not instead of messing around with the RAW, just do a 5 second timer on join to call an alias which uses $nick(#channelname,0)

#98770 26/09/04 05:54 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
because

a] the raw evenm works fine as it was. It does as he asked. He'll just need to modify it a bit, like in the raw event, check if the variable $+(%,req,$2) exists before doing anything else. that should take care of both the /hop and the /join problem

b] timers are notoriously unreliable in all matters that deal with joining channels, services of any kind of automated system that could be lagged, but whose response is absolutely necessary for the script. In such cases, in good scripting, one never uses a timer, but always an event triggered by the response.


Code:
on *:TEXT:!request*:#channelname: {
  if ($2 == $me) && ($left($3,1) == $chr(35)) { join $3 | set $+(%,req,$3) $nick }
}
 
[color:blue] [/color]
raw 366:*: {
  [color:blue]if ($+(!%,req,$2)) halt[/color]
  [color:red]if ($eval($+(%,req,$2),2) !isop $2) {
    .msg $eval($+(%,req,$2),2) Request failed. You are not opped on channel $2 try again when you have op.
    .part $2
  }[/color]
  elseif ($nick($2,0) < 5) {
    .msg $eval($+(%,req,$2),2) Request failed. You do not have the required amount of users in channel.
    .part $2
  }
  else .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)
}


The blue line is added to my original code to prevent the raw event from triggering if you do a /hop or manual /join or any other kind of join that was not triggered by the script. This could still malfunction if you do a join or hop while the script is processing the !request command by a user, but odds of that happening are kinda astronomical.

The part in red is added to check if the requester is an op in the channel.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#98771 26/09/04 06:29 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
LocutusofBorg i am using your script. But the:
Code:
  if ($eval($+(%,req,$2),2) !isop $2) {
    .msg $eval($+(%,req,$2),2) Request failed. You are not opped on $2 try again when you have op.
    .part $2
  }
  elseif ($nick($2,0) < 5) {
    .msg $eval($+(%,req,$2),2) Request failed. You do not have the required amount of users in channel.
    .part $2
  }
  else .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)
}


That part still seams like it wont trigger confused


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#98772 26/09/04 06:47 PM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
I tested it before posting - it works fine. Just remember YOU cannot trigger it.

Try this tho:

Code:
on *:TEXT:!request*:#channelname: {
  if ($2 == $me) && ($left($3,1) == $chr(35)) { join $3 | set $+(%,req,$3) $nick }
}
 [color:red] [/color]
raw 366:*: {
  if ($+(%,req,$2)) {
    if ($eval($+(%,req,$2),2) !isop $2) {
      .msg $eval($+(%,req,$2),2) Request failed. You are not opped on channel $2 try again when you have op.
      .part $2
    }
    elseif ($nick($2,0) < 5) {
      .msg $eval($+(%,req,$2),2) Request failed. You do not have the required amount of users in channel.
      .part $2
    }
    else .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)
  }
}


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#98773 26/09/04 06:51 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Okay. Thats wierd crazy

i got 2 mirc installed. I go to a channel with one of them where im opped but only one user. Then i use !request <botname> #channel and then it joins but doenst part. confused


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#98774 26/09/04 07:08 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline OP
Vogon poet
OP Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Okay now it works. But now we have the old /hop /join /j problem back. crazy


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#98775 26/09/04 07:47 PM
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
if ($1 == /hop) %% (%var == 2) { set %var 1 }


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#98776 27/09/04 05:28 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Have someone triger the script. See if the variable still exists after awhile. it shouldn't.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Page 2 of 2 1 2

Link Copied to Clipboard