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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Shezmu
Wanderer


Joined: 23 Apr 2010
Posts: 53

PostPosted: Wed Feb 02, 2011 12:27 am   

#VAR in another window
 
Okay, let me see if I can explain this properly.

I have a variable in a class in my main window. I have a script in that window that totals up my current ammo count, and creates a new small window "ammocount" with the #EXECWIN command, then populates the totals of each type of ammo with #WIN ammocount Steel @blahblah...

I created a button on the ammocount window to switch ammo types, and want to store the value in a variable in my main window. But it seems to only want to store it to a variable under the "ammocount" window. How do I get it to apply the value to the variable in my main session window?

Let me know if doesn't make sense and I'll try to snap a screenshot.
Reply with quote
Myrkul
Wanderer


Joined: 21 Aug 2008
Posts: 85

PostPosted: Wed Feb 02, 2011 2:05 am   
 
[edit][/edit]


Last edited by Myrkul on Thu Apr 14, 2011 11:08 pm; edited 1 time in total
Reply with quote
Shezmu
Wanderer


Joined: 23 Apr 2010
Posts: 53

PostPosted: Wed Feb 02, 2011 2:40 am   
 
Doesn't // begin a comment, ignored by CMud?
Reply with quote
Myrkul
Wanderer


Joined: 21 Aug 2008
Posts: 85

PostPosted: Wed Feb 02, 2011 3:39 am   
 
[edit][/edit]


Last edited by Myrkul on Thu Apr 14, 2011 11:09 pm; edited 1 time in total
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Feb 02, 2011 12:45 pm   
 
Actually, you can't access a variable in one window from another window. You can access a variable in a window from a module, or a variable from a module in another module or a window, if they can see each other (there are settings on which can see which). It doesn't matter which package the window or module are in.
Reply with quote
Shezmu
Wanderer


Joined: 23 Apr 2010
Posts: 53

PostPosted: Wed Feb 02, 2011 12:55 pm   
 
Myrkul was right. //window/class/variable worked, but when I first tried that, it wasn't working. Figured out why, I had a space in the name of my window. It was AVATAR Shezmu. I renamed it to just AVATAR and it worked fine. Thanks for the help.
Reply with quote
Myrkul
Wanderer


Joined: 21 Aug 2008
Posts: 85

PostPosted: Wed Feb 02, 2011 2:19 pm   
 
[edit][/edit]


Last edited by Myrkul on Thu Apr 14, 2011 11:09 pm; edited 1 time in total
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Feb 02, 2011 6:36 pm   
 
Also the // comments require a space after the // for it to always be recognized as a comment. So if you use // for comments, get in the habit of putting a space between the // and the comment.

Putting spaces in Variable, Alias, Window, or other names is generally a bad idea. Because CMUD uses spaces as delimiters for many commands. With a Window you can set the "Caption" of the window in the settings to be anything you want including spaces. So thing of the "Name" as the short name without spaces and not just the visible Caption.

Finally, you *can* access variables in other windows using this syntax. The //window/class/var syntax overrides the normal CMUD scoping rules. So you can access anything this way, but it's not recommended. Settings within Windows are meant to be private.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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