mIRC Home    About    Download    Register    News    Help

Print Thread
#237449 05/05/12 04:35 PM
Joined: May 2012
Posts: 10
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2012
Posts: 10
i have setup a remote script as follows

on !*:TEXT:!strike*:#Legija.strike: { write D:\LegijaStrike\strikes.txt $nick : $address : at $timestamp on $date : requested suppliers for : $2- } { msg $chan $nick : Hvala supplies will be donated shortly
}


all working but i need to hold a variable to match

i want them to type
!strike name number

if variable doesnt match an error message will appear
saying sorry $nick you are not entering the correct format
please type....

instead of it outputting whatever they want

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
What do you want to match, exactly? If you want to make sure name ($2) is in a short list of approved text you can use tokens.
Code:
var %name = $2
var %number = $3
var %list = item1;item2;item3
if ($istok(%list,%name,59)) && (%number isnum) {
  ;do whatever
}
else {
  msg $nick incorrect format
}

For a longer list, you may try matching with $hfind.

Joined: May 2012
Posts: 10
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2012
Posts: 10
the script below works, but with 1 issue, i need to know where i am going wrong

on !*:TEXT:!strike*:#Legija.strike: {
var %name = $2
var %number = $3
var %list = Snowderblazer;item2;item3
if ($istok(%list,%name,59)) && (%number isnum) {
write D:\LegijaStrike\strikes.txt $nick : $address : at $timestamp on $date : requested suppliers for : $2- } { msg $chan $nick : Hvala supplies will be donated shortly
}
else {
msg $chan $nick incorrect format
}

----------------------------------------------------------

Snowderblazer 75 - Works, it writes to file and shows message on channel

Snowderblazer 75FF doesnt work in the fact an error message does not appear

why does the error message not appeat after Snowderblazer 75FF is entered

Last edited by Snowderblazer; 06/05/12 10:05 PM.
Joined: May 2012
Posts: 10
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2012
Posts: 10
also for some reason i can't use $2 with spaces for var %lists

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
1. the reason 75FF doesn't work is because 75FF isn't a number, unless you're wanting to allow hexadecimal also?

$3 is 75FF, and is set to %number, and since "&& (%number isnum)" is $false, there is no action taken .

2. Your list isn't allowing separated by spaces, because you need to choose ONE delimiter. Currently, "($istok(%list,%name,59))" is checking values separated by alt-59 which is semicolon, if you want to separate your list items by space, then change all your existing semi-colon separators to space, then change the 59 to 32, and it will look at each space (alt-32) as a separator between list items - which means that no list item can contain a space.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It wouldn't be quite that simple for using a space. The script is using space deliminated tokens already ($2), so you'd have to adjust the script to either swap $2 and $3 so you can then use $3-, or use $gettok() to get tokens 2 through the second to last token, or use a deliminator within the command itself, or something similar in addition to changing the $istok and list. Far better to use something other than a space unless it's necessary for some reason.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard