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.

notice script

Help for those learning Tcl or writing their own scripts.
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Sir_Fz wrote:So you didn't apply anything we told you here in your script. Before asking how to output the info, learn how to write eggdrop Tcl scripts that won't choke on special characters.

Tip: when using [lindex] on a string, [split] the string (e.g. lindex [split $arg] 0) same for [lrange] (e.g. lrange [split $arg] 0 2) and then apply join to convert it back to a string (e.g. join [lrange [split $arg] 0 2]).
Look Fz I did'nt use it because I did'nt understand it more, don't take every user like you guys are. Everyone is not professional you think with a different way don't think that everyone is perfect and knows about TCL programming. I am trying to write a code and I had problems I asked for help here, I did'nt understand the points you mentioned so I ignored them. If I ask again and again you would shout more. It's not good to accuse someone it's bettter to help him more in detail in he does'nt understand.

Ok if still you guys can help me my question is not about lindex or lrange it's all solved and output is coming problem. All I want to ask you is how can I continue in the end part of the script how do I make it output.


Ok 1 more thing, the tcl is working fine but it has 1 issue which bothers alot. If i use my script like this it's works:

Code: Select all

proc script:notices11 {nick uhost hand text dest} {
global scriptchannel rusername rdate lastseen infoline email rflags Epithet lastquit rnicknames rhost rchannels currentnick
set currentnick [lrange $text 2 end]
regsub -all {\{\}} $rflags "" rflags
regsub -all {\{\}} $rdate "" rdate
regsub -all {\{\}} $infoline "" infoline
regsub -all {\{\}} $Epithet "" Epithet
regsub -all {\{\}} $rnicknames "" rnicknames
regsub -all {\{\}} $rhost "" rhost
regsub -all {\{\}} $rchannels "" rchannels
regsub -all {\{\}} $currentnick "" currentnick
regsub -all {\{\}} $lastquit "" lastquit
regsub -nocase {Registered on:} $rdate "\00303Registered on:\003" rdate
regsub -nocase {Last seen:} $lastseen "\00303Last Seen:\003" lastseen
regsub -nocase {Infoline:} $infoline "\00303Infoline:\003" infoline
regsub -nocase {Email address:} $email "\00303Email Address:\003" email 
regsub -nocase {Flags:} $rflags "\00303Flags:\003" rflags
regsub -nocase {Epithet:} $Epithet "\00303Epithet:\003" Epithet
regsub -nocase {Last quit hostmask:} $lastquit "\00303Last quit hostmask:\003" lastquit
regsub -nocase {Nickname\(s\):} $rnicknames "\00303Nickname(s):\003" rnicknames
regsub -nocase {Hostmask\(s\):} $rhost "\00303Hostmask(s):\003" rhost
regsub -nocase {Channel\(s\):} $rchannels "\00303Channel(s):\003" rchannels
regsub -nocase {Current nickname\(s\):} $currentnick "\00303Current nickname(s):\003" currentnick
putserv "PRIVMSG $scriptchannel :\00303Account information for:\003 \00307$rusername\003"
putserv "PRIVMSG $scriptchannel :\00303Registered on:\003 \00314$rdate\003"
putserv "PRIVMSG $scriptchannel :\00303Last Seen:\003 \00314$lastseen\003"
putserv "PRIVMSG $scriptchannel :\00303Infoline:\003 \00314$infoline\003"
putserv "PRIVMSG $scriptchannel :\00303Email Address:\003 \00314$email\003"
putserv "PRIVMSG $scriptchannel :\00303Flags:\003 \00314$rflags\003"
putserv "PRIVMSG $scriptchannel :\00303Epithet:\003 \00314$Epithet\003"
putserv "PRIVMSG $scriptchannel :\00303Last quit hostmask:\003 \00310$lastquit\003"
putserv "PRIVMSG $scriptchannel :\00303Nickname(s):\003 \00307$rnicknames\003"
putserv "PRIVMSG $scriptchannel :\00303Hostmask(s):\003 \00314$rhost\003"
putserv "PRIVMSG $scriptchannel :\00303Channel(s):\003 \00314$rchannels\003"
putserv "PRIVMSG $scriptchannel :\00303Current nickname(s):\003 \00307$currentnick\003"
}

putlog "ns info script loaded by iamdeath.."

Code: Select all

# -NS- Account information for hitshy: 
## -NS- Registered on: Sat Jul 30 13:21:23 2005
## -NS- Last seen: Right now!
## -NS- Infoline: None
## -NS- Email address: hitshy@msn.com
## -NS- Flags: +hc
## -NS- Epithet: a Webmaster
## -NS- Last quit hostmask: hitshy@208.98.5.219
## -NS- Nickname(s): Hitshy dean
## -NS- Hostmask(s): *@*
## -NS- Channel(s): 100:#snoopy 300:#opers 499:#NutShells 499:#music 100:#monitor 500:#leb ## -498:#lady 2:#jabal 400:#gudy ## 100:#exempt 500:#Druze 300:#Beirut 499:#a7la3alam
## -NS- Current nickname(s): hitshy
Now the thing is that, this script will work fine only if all the notices are recieved from NS, some users don't have ## -NS- Channel(s): and ## -NS- Current nickname(s): .. so the script halts .. is there any good idea so that, if any notice is not recieved from Ns for any user the script should still go on and paste the data collected?..

Thanks nml and FZ you've been soo helpful.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

If something is unclear, ask us to clarify it. Otherwize we don't have any options then to assume you either understand it or have no interrest of learning it. Also, ignoring important suggestions (such as proper use of list-commands) really discourages us from putting much further effort into the thread.
We might tell you to read a manpage at times, as these often explain how a command works very well, and if we were to explain it ourself, we'd probably write almost the same text. Should something be unclear on a manpage, say so and we'll try to explain that part.
We do expect you to put some effort into trying to solve the problem, where at the same time we gladly throw hints and pointers to whats wrong or might be causing the error. However, if ones sole interrest is to find someone to write it for him/her, "Script Request" would be a better forum.

That said, to your last query;
  • Which proc?
    Any valid name would do
  • How do I? (How do I trigger that proc?)
    Use a binding to trigger that last proc. Figure out what is the last output from NS for a query, and do all that code when it triggers. I would also recommend cleaning up your variables at that time.
I do not know the specs for NS output, so I cannot say which notice to trigger on, you'll have to figure that one out.
NML_375
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

I think I can explain you more only if you come to that network. I feel it difficult to explain what exactly the problem is with the script here. If you visit I can explain to you more. Let me know so I'll PrivateMessage you the server details.

thank you
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Ok I changed a few things and now it's working perfectly. Thanks alot guys for being soo helpfull..

iamdeath
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Just a few tips for you to take into consideration:

Code: Select all

set currentnick [lrange $text 2 end]
Here you're applying a list command on a string, to avoid problems with special characters use:

Code: Select all

set currentnick [join [lrange [split $text] 2 end]]
[split] turns the string to a list and [join] turns the list to a string.

Also

Code: Select all

set rusername [lindex $text 3]
you need to turn $text into a list, so you do

Code: Select all

set rusername [lindex [split $text] 3]
Hope this was more understandable for you... just apply these tips all over your script and it should be fine :)
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

Thanks alot FZ, I'll do it right now :D

iamdeath
Post Reply