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.

Strip question

Old posts that have not been replied to for several years.
Locked
d
daltonc
Voice
Posts: 29
Joined: Wed Apr 27, 2005 8:50 pm

Strip question

Post by daltonc »

Ok, I am inserting data into my database as a value for a variable and when my bot loads up it sets the value to that variable. Anyways, if there is more than 1 word as the value it outputs it like this {command1 command2}

so If I type

@set commands command1
and then type @commands it says
command1

but if I type @set commands command1 command2
and then type @commands it says
{command1 command2}


When I look in the database there is no { or }
but its in the output where it has { and }

This is my line that ouputs the data..

putserv "notice $nick :[lrange [array get [string range $arg 1 end] $chan] 1 end]"

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

Post by Sir_Fz »

try

Code: Select all

[join [lrange [array get [string range $arg 1 end] $chan] 1 end]]
d
daltonc
Voice
Posts: 29
Joined: Wed Apr 27, 2005 8:50 pm

Post by daltonc »

Thanks, but now on my set command I am tryin to set a variable. Its giving me 'variable commands already exist'

Its like for some reason it wont overwrite. Any ideas why?

I have another command called set trigger.. and it overwrites the trigger just fine.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Can you show us more of your script so we can know what we're doing here.
d
daltonc
Voice
Posts: 29
Joined: Wed Apr 27, 2005 8:50 pm

Post by daltonc »

rgr, here ya, this is the part thats setting the custom commands and adding to the database..

Code: Select all


elseif {[string tolower [lindex [split $arg] 0]] == "$chan_trigger($chan)set"} {
                if {[isop $nick $chan]} {
                        set command_input [string tolower [join [lindex $arg 1 ]]]
                        set command_input_value  "[lrange $arg 2 end]"
                        putlog "Setting $command_input to $command_input_value for $chan"
                        set ${command_input}($chan) $command_input_value


                        set result [mysql_query "SELECT command_name FROM bot_commands WHERE command_chan='$chan' && command_name='$command_input'"]
                                if {[info exist result]} {

                                        foreach row $result {
                                                foreach element $row {
                                                     if {$chan_bot(${chan}) == "$botnick"} {
                                                        set update_command [mysql_query "UPDATE bot_commands SET command_value='$command_input_value' WHERE command_name='$command_input' && command_chan='$chan'"]
                                                        global $command_input
                                                        set ${command_input}($chan) $command_input_value
                                                        putlog "Set command value"
                                                        rehash
                                                        putnotc $nick "Set $command_input to '$command_input($chan)'"
                                                    }
                                                  }
                                                }
                                            }


thats just a bit of the code, its a huge proc, but uhh where it goes set ${command_input}($chan) its like not overwritting the variable.. like it should.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Visit http://www.peterre.com/characters.html, this should help you out.
Locked