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.

TCL script error

Old posts that have not been replied to for several years.
d
defcon

TCL script error

Post by defcon »

hi there
i made my own little script..

bind pub - !gib get_data

proc get_data {rest nick uhost chan hand} {
if {![matchattr $hand v|v $chan]} {
return 0
}
set $wem [lindex $rest 0]
set $was [lrange $rest 1 end]
if {$restliche == 0} {
putserv "NOTICE $nick : Bedienung - !gib"
return 0
}
putserv "PRIVMSG $chan :\001ACTION gibt $wem $was\001"
}

the problem is.. when i type !gib there is notice from the bot
or !gib defcon Beer
thers is nothing...the only positive thing is.. when i load the script, there is no error message.

where is the error in the script ? please help me
greetz
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

proc get_data {rest nick uhost chan hand} {
should be

Code: Select all

proc get_data {nick uhost hand chan rest} {
and

Code: Select all

set $wem [lindex $rest 0] 
set $was [lrange $rest 1 end]
should be

Code: Select all

set wem [lindex [split $rest] 0] 
set was [join [lrange [split $rest] 1 end]]
and I think what you mean with if {$restliche == 0} { is if {$rest == 0} {
d
defcon

Post by defcon »

thats the answer from my bot in telnet session *g*


Tcl error [get_data]: wrong # args: should be "get_data nick uhost handchan rest"
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

It should be:
proc get_data {nick uhost hand chan rest} {
not like I guess you have:
proc get_data {nick uhost handchan rest} {
Once the game is over, the king and the pawn go back in the same box.
d
defcon

Post by defcon »

ok.. this error message is gone..
the netxt problem is, wenn i type for example "!gib defcon bier" .. nothing happens in the channel, and no error messi in the partyline.
:cry:
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Are you shure you have changed how Sir_Fz told you to?
Once the game is over, the king and the pawn go back in the same box.
d
defcon

Post by defcon »

bind pub - !gib get_data

proc get_data {nick uhost hand chan rest} {
if {![matchattr $hand v|v $chan]} {
return 0
}
set wem [lindex [split $rest] 0]
set was [join [lrange [split $rest] 1 end]]
if {$rest == 0} {
putserv "NOTICE $nick : Bedienung - !gib"
return 0
}
putserv "PRIVMSG $chan :\001ACTION gibt wem was\001"
}

yes, i did.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind pub v !gib get_data 

proc get_data {nick uhost hand chan rest} { 
  set wem [lindex [split $rest] 0] 
  set was [join [lrange [split $rest] 1 end]] 
  if {$rest == ""} { 
    putserv "NOTICE $nick : Bedienung - !gib" 
    return
  } 
  putserv "PRIVMSG $chan :\001ACTION gibt $wem $was\001" 
}
and be shure you have the v flag.
Once the game is over, the king and the pawn go back in the same box.
d
defcon

Post by defcon »

hmm... i have the v flag in channel
set wem [lindex [split $rest] 0]
set was [join [lrange [split $rest] 1 end]]
why is "wem" and "was" no variable ?

and here is it a variable:
putserv "PRIVMSG $chan :\001ACTION gibt $wem $was\001"
i don't understand this
d
defcon

Post by defcon »

when i load this script:
bind pub - !gib get_data

proc get_data {nick uhost hand chan rest} {
set wem [lindex [split $rest] 0]
set was [join [lrange [split $rest] 1 end]]
if {$rest == 0} {
putserv "NOTICE $nick : Bedienung - !gib"
return 0
}
putserv "PRIVMSG $chan :\001ACTION gibt $wem $was\001"
}
following happens:
(10:26) (netstat) !gib defcon bier
(10:26) ! %City_Bot gibt defcon bier
(10:27) (netstat) !gib bier
(10:27) ! %City_Bot gibt bier
(10:28) (netstat) !gib
(10:28) ! %City_Bot gibt
i thougt when $rest == 0, the bot should send a notice ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

via set you set an variable and via $ you call it.
Once the game is over, the king and the pawn go back in the same box.
d
defcon

Post by defcon »

aaaahhh.. ok, thx :)

but.. whats about the notice if $rest == 0 ?

there's noting, when i type !gib in the channel
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

According to that try with !gib 0 and something will happen. It should be if {$rest == ""} { as in you've said in the channel only !gib
Once the game is over, the king and the pawn go back in the same box.
d
defcon

Post by defcon »

aahh.. ok, i know.
cons.. u are realy a master ;)

well.. i would like to change the answer from the bot..

e.g. when i type !gib Nickname Beer

the bot shoul say:

City_Bot gives u a beer or 2, but don't drink to much.

or: !gib Nickname Döner

City_Bot gives u a big hot Döner Kebap

do u know what i mean ?

do u know if there is anywhere an existing script like this ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I see 3 german bartender tcl scripts in the TCL Archive.. pick one. :)
Once the game is over, the king and the pawn go back in the same box.
Locked