| View previous topic :: View next topic |
| Author |
Message |
bradleylauchlin Voice
Joined: 14 Apr 2008 Posts: 6
|
Posted: Sat Apr 19, 2008 9:29 pm Post subject: variable inside set variable command? [Solved] |
|
|
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 
Last edited by bradleylauchlin on Sat Apr 19, 2008 10:35 pm; edited 1 time in total |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sat Apr 19, 2008 9:43 pm Post subject: Re: variable inside set variable command? |
|
|
| 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 |
|
 |
bradleylauchlin Voice
Joined: 14 Apr 2008 Posts: 6
|
Posted: Sat Apr 19, 2008 10:34 pm Post subject: Duh |
|
|
Yeah, I hadn't even thought about arrays (/me slams forehead on desk). Of course. Thanks for the help  |
|
| Back to top |
|
 |
|