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


Joined: 29 Jan 2016
Posts: 8

PostPosted: Thu Jun 09, 2016 11:31 am   

CMUD & Windows
 
Can someone see what I am doing wrong here?

I am attempting to make a window docked (I believe being the correct term according the the CMUD help files) inside my main window, this is the code I am using which works as intended in zMUD.

Code:
#if %window(Communication)==0 {#MAKEW Communication open "scrolling=yes|internal=yes|align=top"}


It wouldn't be a problem if this window wasn't docked if I could simply drag it to dock it as in zMUD, at one point I did so by dragging the window to some arrows which appeared in the middle of my main window but this is no longer working for whatever reason.

The main reason I forsook CMUD a few years ago in favour of zMUD was due to this general odd behaviour around windows.

EDIT:
Pinning my main window allowed me to dock my new window with the arrow method mentioned above but would still be interested to hear if there's something amiss with my command or another way makewindow can be used
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3778
Location: Pensacola, FL, USA

PostPosted: Thu Jun 09, 2016 1:21 pm   
 
Your expression should be in parenthesis.

#if (%window(Communication)==0)

And I see no reason why the docking system would fail you now.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Jun 10, 2016 5:05 pm   
 
I believe the %window function returns null when the window does not exist. Any of the following would be correct:
#IF (!%window(Communications)) {...}
#IF (!(%window(Communications))) {...}
#IF (%window(Communications)="") {...}
#IF (%window(Communications)=="") {...}

CMud does not see "" and 0 as equivalent because it will convert the 0 to a string "0" which does not equal "". However the empty test does provide false on both zero and null and negation works fine.

It is almost impossible to have too many parenthesis, and it is a good habit to get into typing them. The time spent typing a few hundred extra pairs of parenthesis over thousands of lines is much less then the time it takes to find a bug because a==7&&b||c!=3 did not evaluate in the order you expected.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Dasyr
Newbie


Joined: 29 Jan 2016
Posts: 8

PostPosted: Fri Jun 10, 2016 6:45 pm   
 
Thanks guys,

The reason the ( ) are missing is because I was using { } in zMUD to encase my statement and had to remove them to get my scripts to work in CMUD, the if check evaluates as intended as it stands.
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