|
Joined: Oct 2005
Posts: 122
Vogon poet
|
OP
Vogon poet
Joined: Oct 2005
Posts: 122 |
hi i have the following script:
on *:text:*:#mybooks:{
echo -a a
if ($regex($strip($1-),/Triggers:\[(.*)\]/)) {
var %cmd = $remove($gettok($regml(1),1,45),])
echo -a %cmd
echo -a b
if (/ctcp $nick * iswm %cmd) {
echo -a c
%cmd
if (!$read(somefile.txt,w,$+(*,$nick,*))) {
echo -a d
write booktriggers.txt $nick $+ $chr(9) $+ %cmd
}
}
}
elseif ($regex($strip($1-),/Triggers:\«(.*)\»/)) {
echo -a aa
var %cmd = $remove($gettok($regml(1),1,187),»)
if (/ctcp $nick * iswm %cmd) {
echo -a bb
%cmd
if (!$read(somefile.txt,w,$+(*,$nick,*))) {
echo -a cc
write booktriggers.txt $nick $+ $chr(9) $+ %cmd
}
}
}
}
it was designed to set off a trigger of 2 styles of fileserver ads, whcih triggers a seperate script. the 2 ads r as follows
[04:27:48]pm <MY-Book1> File Server Online Triggers:« /ctcp MY-Book1 !trigger1 » Sends:«0/2» Queues:«0/10» Accessed:«6 times» Online:«0/4» RCPS:«0 cps by n/a» Served:«0B in 0 files» Current BW:«0 cps» AQT:«No Wait» MOTD: -= Invision 2.0 Build 1816
and
[04:29:50]pm <My-Book2> [Fserve Active] - Trigger:[/ctcp My-Book2 Gimme My Damn Books] - Users:[0/5] - Record CPS:[22.3kB/s by Matrix] - Files Sent:[4] - Accesses:[15] - Current Bandwidth:[45.4kB/s] - SysReset 2.53
the first IF event is meant to trigger Fileserver type 2 and The 2nd IF Eveent, File Server Type 1 Currently the 2nd IF works perfectly how it is, howerver it is the First IF i had a problem with as you can see i added echo's in there so you can see exactly what happens from the scripts pt of view a /ctcp My b now the script works fine except when a nick has a - in the name (i.e My-Books2) it doesnt read on.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Its here...
if ($regex($strip($1-),/Triggers:\[(.*)\]/)) { $reml(1) is likely = to /ctcp My-Book2 Gimme My Damn Books] - Users:[0/5] - Record CPS:[22.3kB/s by Matrix] - Files Sent:[4] - Accesses:[15] - Current Bandwidth:[45.4kB/s var %cmd = $remove($gettok($regml(1),1,45),]) $gettok( ???? ,1,45) is ment to give you /ctcp My-Book2 Gimme My Damn Books] ie the trigger!, but returns /ctcp My due to the "-" (asc45) in the nick (as u said), lastly the $remove rips the "]" off of the text
var %cmd = $gettok($regml(1),1-2,32) $remove($gettok($gettok($regml(1),3-,32),1,45),]) ^ that might work (however if a trigger has a ] in it it well be swallowed up (as it would also have done in your original)
var %cmd = $gettok($regml(1),1-2,32) $left($gettok($gettok($regml(1),3-,32),1,45),-2) ^ that might be better, -2 to remove the "]<space>" off the end
PS: shouldnt that "books" in your trigger end in a z ? <grin>
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
I think this is the problem..
You have: var %cmd = $remove($gettok($regml(1),1,45),])
which is 'remove all "]" characters from the text before the "-" character.' Try this:
var %cmd = $remove($gettok($regml(1),1,93),])
-genius_at_work
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
using that, you wouldnt need the $remove, and while it would work 99% of the time its still got that problem with ] being in the trigger, mind you so did mine with having - in the trigger!
|
|
|
|
|