| View previous topic :: View next topic |
| Author |
Message |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Wed May 17, 2006 6:46 pm Post subject: stop continution. [SOLVED] |
|
|
Hi,
I've been posting questons regarding this small script I've created it with the help of you guys, now there is only 1 problem coming up.
The code is:
| Code: | set ac(chan) "#channel"
set notifyusers "owner"
set ac(bot_username) "username"
set ac(owner_username) "owner"
bind dcc n bonus ac:bonus
bind notc - "USER: * ACCESS: *" ac:bonus_points
proc ac:bonus {hand idx arg} {
global ac baccess
set arg [split $arg]
set username1 [lindex $arg 0]
set reason1 [lrange $arg 1 end]
if {$username1 == ""} { putdcc $idx "Syntax: .bonus <CService Username> <Reason>"; return }
if {$username1 == "$ac(bot_username)"} { putdcc $idx "You can't bonus me or I can't modify myself."; return }
if {$username1 == "$ac(owner_username)"} { putdcc $idx "Do you think $ac(owner_username) needs modification?, get a life."; return }
if {$reason1 == ""} { putdcc $idx "Syntax: .bonus <CService Username> <Reason>. You're required to mention reason for bonus."; return }
puthelp "PRIVMSG X :ACCESS $ac(chan) $username1"
set baccess([string tolower $username1]) [list $hand $reason1]
}
proc ac:bonus_points {nick uhost hand arg dest} {
global ac baccess notifyusers
if {![isbotnick $dest]} {return 0}
if {![string equal -nocase X $nick]} {return 0}
set user [string tolower [lindex [split $arg] 1]]
if {![info exists baccess($user)]} {return 0}
foreach {handle reason} $baccess($user) {break}
set access [lindex [split $arg] 3]
puthelp "PRIVMSG X :MODINFO $ac(chan) ACCESS $user [expr {$access + 5}]"
if {$notifyusers != "" && $notifyusers != " "} {
foreach notfuser $notifyusers {
sendnote IDA_SYSTEM $notfuser "Bonus +5 given to $user by $handle in $ac(chan). The reason was: $reason"
}
}
} |
Now the thing is, when I type:
| Quote: | | .bonus <CService USername> <Reason> |
The bot is increasing/modifying +5 to him BUT whenver bot recieves this message, the bot starts modifying other people too.
| Code: | -X- USER: username ACCESS: 123 LU
-X- CHANNEL: #channel -- AUTOMODE: OP
-X- LAST SEEN: 0 days, 00:07:07 ago.
-X- End of access list |
So the bot will increase + 5 to " username ".. When the bot should'nt, it should only modify which is given in the partyline. The continuation of this script should stop, is that possible?. Now you must be asking why will the bot get that X notice again and again, well I've another TCL going on, which shows that data to the bot of all the usernames every minute.
I will be grateful to you if you kindly fix / help me out of it.
Thanks. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed May 17, 2006 6:53 pm Post subject: |
|
|
Add
| Code: | | unset baccess($user) |
at the end of the ac:bonus_points proc. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Wed May 17, 2006 6:55 pm Post subject: |
|
|
| ok let me try |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Wed May 17, 2006 6:57 pm Post subject: |
|
|
This is what I did:
| Code: | proc ac:bonus_points {nick uhost hand arg dest} {
global ac baccess notifyusers
if {![isbotnick $dest]} {return 0}
if {![string equal -nocase X $nick]} {return 0}
set user [string tolower [lindex [split $arg] 1]]
if {![info exists baccess($user)]} {return 0}
foreach {handle reason} $baccess($user) {break}
set access [lindex [split $arg] 3]
puthelp "PRIVMSG X :MODINFO $ac(chan) ACCESS $user [expr {$access + 5}]"
if {$notifyusers != "" && $notifyusers != " "} {
foreach notfuser $notifyusers {
sendnote IDA_SYSTEM $notfuser "Bonus +5 given to $user by $handle in $ac(chan). The reason was: $reason"
}
}
}
unset baccess($user) |
The bot crashed after .rehash
| Code: | [03:56] <Cricket`-> [04:00] can't read "user": no such variable
[03:56] <Cricket`-> while executing
[03:56] <Cricket`-> "unset baccess($user)"
[03:56] <Cricket`-> (file "bonus.tcl" line 37)
[03:56] <Cricket`-> invoked from within
[03:56] <Cricket`-> "source bonus.tcl"
[03:56] <Cricket`-> (file "Cricket.conf" line 251)
[03:56] <Cricket`-> [04:00] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR) |
|
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Wed May 17, 2006 8:39 pm Post subject: |
|
|
I do not think Sir_Fz meant outside of the proc, by "at the end of the ac:bonus_points proc" he meant just before the last closing brace.
| Code: | }
}
unset baccess($user)
} |
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Thu May 18, 2006 6:18 pm Post subject: |
|
|
yaaaaaaa! Thanks mate
it worked  |
|
| Back to top |
|
 |
|