This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Values in the Topic -> $var1,2 etc

Old posts that have not been replied to for several years.
Locked
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Values in the Topic -> $var1,2 etc

Post by LexXx »

Well i got a topic like this one: [Hot: N/A] [Cold: .51/823/856 .45/930/952 ] [Walked: .34 .233 .225 ]
and i got a script with the command: !calcip 51

-> i want the script to get the 2 numbers behind the .51 separated with / and to use them (e.g. $var1=51 $var2=823 and $var3=856)
-> the number of .xx/XXX/xxx in the topic varies sometimes there can be some under Hot: ....

We tried this but i didnt work really :/

Code: Select all

bind dcc n|n bluborn dcc:blub
proc dcc:blub {hand idx text} { set topic [topic #dclone.eu]; regexp -all -nocase {^.*?[Hot: N/A] [Cold: (.*?)/(.*?)/(.*?) (sg: Factor-1/x) .45/930/952 ] [Walked: .34 .233 .225 ] [ #dclone.eu is BACK! ].*?$} $topic temp var1 var2 var3; putcmdlog "var1: $var1 . var2: $var2 . var3: $var3"}
thx
Image
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

if you want to use regexp, somthing like this should work:

Code: Select all

regexp -nocase {.*\[cold: \.((\d)+)/((\d)+)/((\d)+).*} $topic a var1 b var2 c var3
Elen sila lúmenn' omentielvo
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Post by LexXx »

i gonna try! can i reach u at irc or sth (not for buggin g you :) )
Image
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Post by LexXx »

Code: Select all

bind pubm n "#dclone.eu !calcx *" pub:calcx
 
proc pub:calcx {nick uhost hand chan text} { 
set text [split $text] 
set topic [topic #dclone.eu]; regexp -nocase {.*\[cold: \.((\d)+)/((\d)+)/((\d)+).*} $topic a cipx(server) b cipx(lwe) c cipx(act)"
set cipx(min) [expr $cipx(lwe) + 75]; set cipx(max) [expr $cipx(lwe) + 125]; set cipx(tomin) [expr $cipx(min) - $cipx(act)]; set cipx(sold) [expr $cipx(act) - $cipx(lwe)]; set cipx(tomax) [expr $cipx(max) - $cipx(act)];
 
if {$cipx(tomin) > 0} { putmsg $chan "Server \[\002.$cipx(server)\002\] Minimum sojcount for WE is $cipx(min), while maximum is $cipx(max). $cipx(sold) sojs have been sold and $cipx(tomin) sojs need to be sold to reach minimum!" }
if {$cipx(tomin) == 0} { putmsg $chan "Server \[\002.$cipx(server)\002\] Minimum sojcount for WE is $cipx(min), while maximum is $cipx(max). $cipx(sold) sojs have been sold - minimum is reached." }
if {$cipx(tomin) < 0} {putmsg $chan "Server \[\002.$cipx(server)\002\] Minimum sojcount for WE is $cipx(min), while maximum is $cipx(max). $cipx(sold) sojs have been sold, min is reached and $cipx(tomax) more sojs need to be sold to max." }
}

array unset cipx
------> Tcl error [pub:calcx]: can't read "cipx(act)": no such variable
Image
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

you have an extra " at the end of the regexp... try removing it
Elen sila lúmenn' omentielvo
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Post by LexXx »

well server11.xlhost is down so are my bot and my bouncer :) but im at irc (gc|day[eCh] or sth like that) u can tell me there ;-)
Image
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Post by LexXx »

works but there are more .xx/xxx/xxx and there can be some under hot.... how do i handle that
Image
L
LexXx
Voice
Posts: 13
Joined: Mon Jun 14, 2004 11:32 am
Location: Bereldange/Luxembourg
Contact:

Post by LexXx »

could you do sth like that -> \.((\d)+)/((\d)+)/((\d)+). :

[Hot: 1time HERE ] [Private WE's: IGNORE THIS PART COMPLETELY ] [Cold: 2times HERE ] [.... (ignore whhat follows the cold box imediatly)
=> 9 vars (3* .xx/zzz/yyy)
set them to anything i can change it ;)

thx
Image
Locked