| View previous topic :: View next topic |
| Author |
Message |
wubmerlin Voice
Joined: 04 Nov 2007 Posts: 6
|
Posted: Sun Nov 04, 2007 11:57 am Post subject: set $var with $arg ... |
|
|
Hello i wan tto know if this is possible
| Code: | bind pub - !rules pub_rules
set public_rules "test public"
set private_rules "test private"
set pm_rules "test pm"
proc pub_rules { nick uhost hand chan arg } {
global public_rules pm_rules private_rules
if {[string tolower [lindex $arg 0]] != ""} {
#HERE IS MY PROBLEM !!!!!!
set set_rules $[string tolower [lindex $arg 0]]_rules
#END OF PROBLEM
puthelp "PRIVMSG $chan :[string toupper [lindex $arg 0]] Rules"
puthelp "PRIVMSG $chan :$set_rules"
} |
I want to grabmy var with the arg, example if i type !rules public
$arg = public
i want to set:
set set_rules $$arg
Like this : set set_rules $public_rules
And i dont want set it with if $arg == public ... i want it like this b/c i have 250 rules to set and i want to clean my code ( already done with the IF )
Thanks alot ! |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Nov 04, 2007 12:20 pm Post subject: |
|
|
I think that you can have a solution with eval or subst, but I can't give you the correct syntax you need.
Peharps anyone else? _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
wubmerlin Voice
Joined: 04 Nov 2007 Posts: 6
|
Posted: Sun Nov 04, 2007 12:51 pm Post subject: |
|
|
Just for your information i just got it !
REPLACE:
| Code: | #HERE IS MY PROBLEM !!!!!!
set set_rules $[string tolower [lindex $arg 0]]_rules
#END OF PROBLEM
|
BY:
| Code: | #NO MORE PROBLEM !!!!!!
set set_rules [string tolower [lindex $arg 0]]_rules
set set_rules [set $set_rules]
#END
|
Enjoy ! |
|
| Back to top |
|
 |
|