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.

Searching for a script with !set <variable>

Old posts that have not been replied to for several years.
Locked
L
Longbow
Voice
Posts: 29
Joined: Thu Jan 13, 2005 9:24 am

Searching for a script with !set <variable>

Post by Longbow »

I'm looking for a script where you can set variables via bind pub.

Search as..

!set command off

If you know of any that contain this type of thing, post them here please.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

There is already a command for that, but through DCC.

Code: Select all

.tcl set <variable <value>
For your example:
!set command off

Code: Select all

bind pub - !set set:command

proc set:command {nick uhost hand chan text} {
 global mycommand
  if {[string equal -nocase "mycommand" [lindex $text 0]]} {
   set mycommand "[lindex $text 1]"
   }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

awyeah : .set <variable> <value> :P
Once the game is over, the king and the pawn go back in the same box.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Code: Select all

bind pub n !set command:set

proc command:set { n u h c t } {
set var [lindex [split $t] 0]
set mode [lindex [split $t] 1]
set $var $mode
}
?

Just a simple thing as i have a headache and i don't feel like coding at all :)
L
Longbow
Voice
Posts: 29
Joined: Thu Jan 13, 2005 9:24 am

Post by Longbow »

Thanks, but how would I add multiple entries...

bind pub - !bot bot:command

proc bot:command {nick uhost hand chan text} {
global mycommand
global myothercommand
if {[string equal -nocase "mycommand" [lindex $text 0]]} {
set mycommand "[lindex $text 1]"
} else {
[string equal -nocase "myothercommand" [lindex $text 0]]} {
set myothercommand "[lindex $text 1]"
}
}

:(
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 bot:command {nick uhost hand chan text} { 
global mycommand 
global myothercommand 
if {[string equal -nocase "mycommand" [lindex $text 0]]} { 
set mycommand "[lindex $text 1]" 
} elseif {[string equal -nocase "myothercommand" [lindex $text 0]]} { 
set myothercommand "[lindex $text 1]" 
} 
}
It has been a long time since I last wrote anything in TCL, but just wondering wouldn't the bot die if someone used !bot mycommand [die] ?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Maybe you should read MY post
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

True, splitting should do it :)

Code: Select all

proc bot:command {nick uhost hand chan text} { 
global mycommand myothercommand 
if {[string equal -nocase "mycommand" [lindex [split $text] 0]]} { 
set mycommand "[lindex [split $text] 1]" 
} elseif {[string equal -nocase "myothercommand" [lindex [split $text] 0]]} { 
set myothercommand "[lindex [split $text] 1]" 
 } 
}
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

caesar wrote:awyeah : .set <variable> <value> :P
Oh crap, thats right, lol. Should be:

Code: Select all

set [lindex $text 0] "[lindex $text 1]"
My one would set a variable of "mycommand" which you could replace by editing the script. But with this sort of command you can make as many as variables as you like.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

using set is a bad idea from pub .. but

if you make it at least don't for get to remove certain chars to avoid execution

Code: Select all

proc set_pub proc {nick host hand chan arg} {
  set arg [string map {\\ \\\\ \" \\\" \[ \\\[ \] \\\] \{ \\\{ \} \\\} \( \\\( \) \\\)} $arg]
  set  [lindex $arg 0] [join [lrange $arg 1 end]]
  putserv "PRIVMSG $chan :SET --> [lindex $arg 0] --> [join [lrange $arg 1 end]]
}

bind pub n !set set_pub
XplaiN but think of me as stupid
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

never mind didn't see MeTroiD script..
XplaiN but think of me as stupid
Locked