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
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Sat Dec 16, 2006 2:36 pm   

[1.24] Sending Variables to other windows
 
I am unable to have variables send to other windows such as chat windows.

1. Open a session
2. Create a new window from command line '#WINDOW Test'
3. Create a variable from command line 'Variable="Will this work"
4. Test that the variable is set '#SAY %time @Variable'
5. Try sending the same to the Test window ':Test:#SAY %time @Variable'

The contents of the variable is not displayed even though the result of %time is!

6. From the command line typing ':Test:#SAY %time This works' works as expected

I have tried many variations of to get this to work but cannot.

Is this a Bug or is there a way to do it which I cannot fathom?
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sat Dec 16, 2006 3:09 pm   
 
#EXEC {:Test:#SAY %time @Variable}

May be quirky, may be a bug, will let you pick.

May be quirky because of the way #EXEC treats variables
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=25777

May be buggy because even with #EXEC it trims spaces, but when you do
#EXEC {:Test:#SAY %time "@Variable"}
it stops the variable being expanded.
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Sat Dec 16, 2006 3:24 pm   
 
Thanks for the response, at least I can adapt my scripts to work now.

Personally I believe it to be a bug as #EXEC should not be necessary to accomplish the sending of a variable to another window.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1241

PostPosted: Sat Dec 16, 2006 5:06 pm   
 
The reason the other window isn't getting the value of the variable is probably because the variable is not being expanded in the window you sent it from, but instead is trying to be expanded in the window you are sending it too. Since the variable doesn't exist there, nothing is displayed. You therefore need to ensure you expand the variable in the first window. #EXEC is one way of doing that. Alternatively you need to ensure that the variable is able to be read from the other window.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sat Dec 16, 2006 5:10 pm   
 
Problem with that is that putting #EXEC around strips the spaces from the variable
If you then do what Zugg suggested in the post I linked to and put quotes around @variable then it stops it expanding and just shows it as literally "@Variable"
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1241

PostPosted: Sat Dec 16, 2006 5:58 pm   
 
How about if the variable is in a published package? Then it should be visible to both windows...
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Sat Dec 16, 2006 6:04 pm   
 
Settings (variables) in the main Mud window are not 'published'?
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1241

PostPosted: Sat Dec 16, 2006 6:09 pm   
 
Correct.
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