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.

Name Trigger Help Request

Old posts that have not been replied to for several years.
Locked
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Name Trigger Help Request

Post by Majesty »

Hello there,
Im very new to TCL and this would be considered my 1st ever script. I need help in modifing it and tweaking as it's not working properly becuase it shows error with "elseif" and "else" if used instead of "elseif"

*optional*
What i would like more, is someone helping me out by telling me how to when using " !name" to automaticaly reappear in {putserv "PRIVMSG $chan :name is allias"}

Code: Select all

bind pub * !name announce

proc announce {nick uhost hand chan arg} {
if {$chan == "#YYYYY"} {putserv "PRIVMSG $chan :name is allias1"}

elseif {$chan == "#XXXX"} {putserv "PRIVMSG $chan :name is allias2 "}
}
the idea of this is to have a small database,specific for a channel, that when doing !name it shows an allias for that parson.

Thanks for your suppor, if i was bit unclear dont blame me .. i dont know how to realy explain it all. :) thx in advance.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
if {$chan == "#YYYYY"} {putserv "PRIVMSG $chan :$arg is allias1"} 

elseif {$chan == "#XXXX"} {putserv "PRIVMSG $chan :$arg is allias2 "} 
} 
That will display what you type after !name.

So !name blah =
blah is allias1 or allias2
r0t3n @ #r0t3n @ Quakenet
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Post by Majesty »

Tosser^^ wrote:

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
if {$chan == "#YYYYY"} {putserv "PRIVMSG $chan :$arg is allias1"} 

elseif {$chan == "#XXXX"} {putserv "PRIVMSG $chan :$arg is allias2 "} 
} 
That will display what you type after !name.

So !name blah =
blah is allias1 or allias2
alrite, then what about that error with "elseif " & "else"
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

oh yea, this will work.

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
  if {$chan == "#YYYYY"} {
    putserv "PRIVMSG $chan :$arg is allias1"}
    } elseif {$chan == "#XXXX"} {
    putserv "PRIVMSG $chan :$arg is allias2 "} 
  } 
}
Ok, thats it. It will work now.
r0t3n @ #r0t3n @ Quakenet
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Post by Majesty »

Tosser^^ wrote:oh yea, this will work.

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
  if {$chan == "#YYYYY"} {
    putserv "PRIVMSG $chan :$arg is allias1"}
    } elseif {$chan == "#XXXX"} {
    putserv "PRIVMSG $chan :$arg is allias2 "} 
  } 
}
Ok, thats it. It will work now.

Code: Select all

 [02:22] Tcl error in file 'eggdrop.conf':
[02:22] (Crusader): [02:22] wrong # args: should be "proc name args body"
 while executing
"proc announce {nick uhost hand chan arg} {
[0if {$chan == "#XXXXX"} {
putserv "PRIVMSG $chan :$arg is allias1"}
} elseif {$chan == "#YYY..."
[(file "scripts/Utopia.tcl" line 3)
invoked from within
"source scripts/Utopia.tcl"
(file "eggdrop.conf" line 1337)
* CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
there is still some mistake :\ help?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
 if {$chan == "#YYYYY"} { 
  putserv "PRIVMSG $chan :$arg is allias1"
 } elseif {$chan == "#XXXX"} { 
  putserv "PRIVMSG $chan :$arg is allias2 "
 }
}
notice the braces.
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Post by Majesty »

Sir_Fz wrote:

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
 if {$chan == "#YYYYY"} { 
  putserv "PRIVMSG $chan :$arg is allias1"
 } elseif {$chan == "#XXXX"} { 
  putserv "PRIVMSG $chan :$arg is allias2 "
 }
}
notice the braces.
Thank you , this works excellent.

I have question, how would a switch script if it suppose to work on the same basis ? that is if i type !name in #X it gives allias1
then if i type !name in #Y it gives allias 2.

Why would i like to use switch ? because i want to have a userlisf *
!name1,!name2,!Name3 etc.. and for every !name*** i want 2 alliases .
how could that be done? any suggestions? thanks in advance.
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Tosser^^ wrote:oh yea, this will work.

Code: Select all

bind pub * !name announce 

proc announce {nick uhost hand chan arg} { 
  if {$chan == "#YYYYY"} {
    putserv "PRIVMSG $chan :$arg is allias1"}
    } elseif {$chan == "#XXXX"} {
    putserv "PRIVMSG $chan :$arg is allias2 "} 
  } 
}
Ok, thats it. It will work now.
Tosser. for the last time stop giving help on here when you still have no idea wtf you are doing.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Majesty wrote:I have question, how would a switch script if it suppose to work on the same basis ? that is if i type !name in #X it gives allias1
then if i type !name in #Y it gives allias 2.

Why would i like to use switch ? because i want to have a userlisf *
!name1,!name2,!Name3 etc.. and for every !name*** i want 2 alliases .
how could that be done? any suggestions? thanks in advance.
Can you be clearer, I didn't quiet understand what you mean.
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Post by Majesty »

Sir_Fz wrote:
Majesty wrote:I have question, how would a switch script if it suppose to work on the same basis ? that is if i type !name in #X it gives allias1
then if i type !name in #Y it gives allias 2.

Why would i like to use switch ? because i want to have a userlisf *
!name1,!name2,!Name3 etc.. and for every !name*** i want 2 alliases .
how could that be done? any suggestions? thanks in advance.
Can you be clearer, I didn't quiet understand what you mean.
I want to make a script, that has a small database of people's names and their alliases! for example, my name is Marcel :)
So when somoene joins #XXX and types !marcel , the bot replies Marcel is ALIAS1!
BUt when the command !marcel is made from #YYYYYY the bot replies Marcel is ALIAS2.
I want to make a small database of people and their specific alliases.
It would be nice if i would add or edit through !add !edit, or i could as well edit in WordPad and add the names and their alliases, so when doing !name it will give me it's corresponding "allias"

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

Post by Sir_Fz »

This should do it, but it does not store the nicks in a file (try and do it yourself :wink: )

Code: Select all

bind pub - !add add:alias
bind pubm - !* show:alias
set alist [list]

proc add:alias {nick uhost hand chan arg} {
 global alist
 set anick [lindex [split $arg] 1]
 if {[lsearch -exact $alist "$anick $chan"] == -1} {
  lappend alist "$anick $chan"
 }
}

proc show:alias {nick uhost hand chan arg} {
 global alist
 set anick [lindex [split $arg !] 0]
 if {[search -exact $alist "$anick #AAA"] != -1} {
  puthelp "PRIVMSG $chan :$anick is alias1"
 } elseif {[lsearch -exact $alist "$anick #BBB"] != -1} {
  puthelp "PRIVMSG $chan :$anick is alias2"
 } else {
  puthelp "RIVMSG $chan :$anick is not an alias"
 }
}
Edit: Use !add <nick> to add the nick into the list (anyone can do it btw) and !nick to show in what alias he is (edit #AAA and #BBB).
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Post by Majesty »

Sir_Fz wrote:This should do it, but it does not store the nicks in a file (try and do it yourself :wink: )

Code: Select all

bind pub - !add add:alias
bind pubm - !* show:alias
set alist [list]

proc add:alias {nick uhost hand chan arg} {
 global alist
 set anick [lindex [split $arg] 1]
 if {[lsearch -exact $alist "$anick $chan"] == -1} {
  lappend alist "$anick $chan"
 }
}

proc show:alias {nick uhost hand chan arg} {
 global alist
 set anick [lindex [split $arg !] 0]
 if {[search -exact $alist "$anick #AAA"] != -1} {
  puthelp "PRIVMSG $chan :$anick is alias1"
 } elseif {[lsearch -exact $alist "$anick #BBB"] != -1} {
  puthelp "PRIVMSG $chan :$anick is alias2"
 } else {
  puthelp "RIVMSG $chan :$anick is not an alias"
 }
}
Edit: Use !add <nick> to add the nick into the list (anyone can do it btw) and !nick to show in what alias he is (edit #AAA and #BBB).

Thanks for support :D but i think tehre is somethin wrong :P since BOT is not replying to !add or !nick :(
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

My bad, change

Code: Select all

set anick [lindex [split $arg] 1]
to

Code: Select all

set anick [lindex [split $arg] 0]
and

Code: Select all

set anick [lindex [split $arg !] 0]
to

Code: Select all

set anick [lindex [lindex [split $arg !] 1] 0]
M
Majesty
Voice
Posts: 7
Joined: Sun Jul 10, 2005 4:34 pm

Post by Majesty »

Sir_Fz wrote:My bad, change

Code: Select all

set anick [lindex [split $arg] 1]
to

Code: Select all

set anick [lindex [split $arg] 0]
and

Code: Select all

set anick [lindex [split $arg !] 0]
to

Code: Select all

set anick [lindex [lindex [split $arg !] 1] 0]

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

Post by Sir_Fz »

Maybe it's a case issue, try changing

Code: Select all

"$anick $chan"
to

Code: Select all

[string tolower "$anick $chan"]
and the same with "$anick #AAA" and #BBB.
Locked