Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Aug 03, 2007 10:10 am   

[1.34] Acessing cross module variable based on variable name
 
It's confusing buy here's what I want to do.

I have Module1 and Modul2.

In an event in Module1 I want to assign a variable Test in Module2.

Now if I explicitly type
Code:
//Module2/Test = 400


However if I want to do it based on a variable (say a parameter passed to the event I can't). Assuming a valid local variable '$name' the following doesn't work because CMUD treats it like a commented line.
Code:
//$Name/Test = 400
#VAR //$Name/Test 400


So am I missing something or is it a bug? (I'm guessing there's probably another way to do it, but it's late.
_________________
Asati di tempari!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Aug 03, 2007 10:57 am   
 
Firstly, provided both modules can see each other and there aren't any other variables called test, you don't need to do it explicitly, even across packages. So don't if you don't have to.

Secondly, it's the implicit concatenation that's buggering it up. This will work:

#var %concat("//",$Name,"/Test") {a new value}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Aug 03, 2007 9:19 pm   
 
I'll try the #VAR command.

The reason I want to explicitly assign it is that I eventually plan to put these in the package library so I don't want to assume what else may be there. For my local I can control, but in the wild, who knows.

[Edit] That worked. Thanks Fang. I actually was trying that last night, but I guess I was too tired to think it through properly.
_________________
Asati di tempari!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net