egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

variable inside set variable command? [Solved]

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
bradleylauchlin
Voice


Joined: 14 Apr 2008
Posts: 6

PostPosted: Sat Apr 19, 2008 9:29 pm    Post subject: variable inside set variable command? [Solved] Reply with quote

Is it possible to use a variable inside a set command?

I have a bot that is in about 10 channels that I am using. I want it to record a certain piece of information on that channel. That is working, however the problem I am facing is that if it is set on antoehr channel, it becomes the same for ALL channels. I could just make it a different proc for each of the 10 channels, however I want to be able to scale this out to more channels as needed, and it would be a lot of work once it gets bigger.

Is there anyway to use something like the following?

global record_$chan
set record_$chan

So if the channel name was test the variable it was actually using would be record_test

Let me know if anyone knows the way to pull this off.
THanks Smile


Last edited by bradleylauchlin on Sat Apr 19, 2008 10:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Apr 19, 2008 9:43 pm    Post subject: Re: variable inside set variable command? Reply with quote

Code:
global records
set records($chan) "etc"

Arrays can easily accomplish this. A single global variable array is better than a multitude of seperate global strings floating around.
Back to top
View user's profile Send private message
bradleylauchlin
Voice


Joined: 14 Apr 2008
Posts: 6

PostPosted: Sat Apr 19, 2008 10:34 pm    Post subject: Duh Reply with quote

Yeah, I hadn't even thought about arrays (/me slams forehead on desk). Of course. Thanks for the help Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber