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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
thargy
Beginner


Joined: 10 Aug 2004
Posts: 20
Location: UK, Uganda

PostPosted: Thu Sep 16, 2004 9:42 am   

Passing commands to other windows
 
OK, so if I want to execute a command in a different window i do the following:

[codemychar:#TZERO[/code]

Great, but what if (as normally happens) my main window name changes for different chars? Well I can do this

Code:
#VAR MainWindow %window


To set a variable to the main window name (has to be run in the main window obviously). Followed by:

Code:
@MainWindow:#TZERO


This works great, except it sometimes creates a syntax error, and sometimes doesn't. This isn't dependent on the variable value, just on where the expression appears. I think it may be a problem with the syntax checker, but unsure.

Is there a better way to do this?

Thanks
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Sep 16, 2004 12:11 pm   
 
Quote:
This works great, except it sometimes creates a syntax error, and sometimes doesn't. This isn't dependent on the variable value, just on where the expression appears. I think it may be a problem with the syntax checker, but unsure.


Well when does it give an error and when doesn't it. but anyway try this

@{MainWindo}:#TZERO
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 16, 2004 6:25 pm   
 
Quote:
Code:
#VAR MainWindow %window

To set a variable to the main window name (has to be run in the main window obviously). Followed by:
Code:
@MainWindow:#TZERO


I must have missed something. Since you are already in the main window, obviously, then why do you need to redirect the command to the main window? That's where the command already goes, so you could just send the command.
Code:
#TZERO


You would only need to know the name of the main window if you were sending commands or text to it from another window. If that's a child window of a single character, then the main window is named 1.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
thargy
Beginner


Joined: 10 Aug 2004
Posts: 20
Location: UK, Uganda

PostPosted: Thu Sep 16, 2004 9:02 pm   
 
Sorry, I should have made it obvious, I thought by seperating the two pieces of code it made sense.

I set the variable with the main window name on initialisation (you can also set it to the character name as that is what the window defaults to)

There are many bits of code which then need to send information to the main window from other windows. For example my buttons in my conversation windows need to send tell commands, etc.

The syntax @MainWindow:<command> works fine, but does cause the pretty parser to complain of syntax errors (though the code still runs).

For example, a trigger that just has @MainWindow:#TZERO will show a syntax error in the editor, but will run fine.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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