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
Genmiltiad
Newbie


Joined: 04 Jun 2010
Posts: 4

PostPosted: Fri Jun 04, 2010 6:09 pm   

Trying to setup global variables in a second module
 
Im trying to use variables from the main Achea window in multiple windows. I am testing using the health guage in another window at the moment. What I did as mentioned below is setup another module outside the others and set it to a global package. I then defined global version of my hp variables @hpg and @maxhpg and assigned them

@hpg = @hp
@maxhpg = @maxhp

referencing the hp/maxhp vars from the Achea module to the global variables.

The vars hpg and maxhpg seem to get the value from the hp and maxhp variables.... but the guage wont update dynamically like the guage does in the main window. Any tips here? I know they have the current values because if I just redo the guage it shows the current valies in hp and maxhp but it wont update by itself.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jun 04, 2010 8:37 pm   
 
It won't work. Variables defined within a window will not be seen outside of that window. To make a variable seen by other windows or modules, you must put the variable into a module, not a window.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jun 04, 2010 8:47 pm   
 
Pretty sure you misread something there, Rahab. He's having trouble getting his buttons to recognize the variables in the module, not the other way around.

My guess is that perhaps he forgot to update his button so that it's using the hpg variables. My suggestion is to do away with the hpg nonsense and move his hp variables and whatever triggers populate those variables out to the module.

It's quite possible that this is just a really old bug that got fixed a long time ago in the current beta cycle.
_________________
EDIT: I didn't like my old signature
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sat Jun 05, 2010 1:22 pm   
 
Oops, you're right. I thought the variables were in window. Embarassed
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