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
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Aug 18, 2008 4:56 pm   

[2.36] #MXP send tag - parsing error
 
From the help file:

#MXP This is a <send 'hello'>test</send>
will create a hyperlink called "test", but now, when you click on it, the command "hello" is sent to the MUD instead.

Ok, that sample works, but this not:
#MXP This is a <send 'hello'>(test)</send>
Parse error: illegal token (test)</send>

This also works:
#MXP This is a <send 'hello'>test)</send>

Resume: there is a problem with opening parenthesis.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Aug 18, 2008 5:36 pm   
 
You need to put {} around your argument for #MXP:

#MXP {This is a (test)}

That tells CMUD to treat it as a string and not try to evaluate expressions on the command (the parenthesis are used in CMUD to indicate an expression).

For example:

#SHOW (1+1)

displays "2" because it uses the parenthesis to evaluate an expression. Whereas

#SHOW {(1+1)}

displays "(1+1)" because the {} indicate a string value. All CMUD commands work like this, not just #SHOW or #MXP.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Aug 18, 2008 5:43 pm   
 
Ok, then consider this:

A function (#FUNC) with return type String (literal):
#RETURN "#MXP 1 (Apply changes)",
where (Apply changes) is properly formatted link within send tag.

Should #EXEC on that function result evaluate it?
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Aug 18, 2008 7:20 pm   
 
Yes. Again, you need to put {} around your MXP argument:

#RETURN "#MXP 1 {(Apply changes)}"

Otherwise when you call #EXEC to execute the #MXP command, the #MXP command will still see the parens instead of the {} braces.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Aug 18, 2008 8:49 pm   
 
Ok, thanks!
The problem was in that function didn't throw any error message, just blank result and I've found the source of it only when tried the script from that function in the command line.
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