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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat May 23, 2009 5:45 am   

[3.08] #nn loops within #ifs
 
Code:
#if (1) {#2 {#echo "test"}}


This code does not appear to be running, I ran into it when I got an "Argument still on stack" error in another script. Putting it into the command line makes it output "16."

Both

Code:
#2 {#echo "test"}


and

Code:
#if (1) {#echo "test"}


appear to work on the other hand.
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Sat May 23, 2009 5:58 am   
 
Hmmm I get the same problem

additionally

Code:
#if (1) { #2 {#echo "test"}} {#print test2}


Generates an invalid token error, and

Code:
#if (1)  { #echo "test"} {#2 #print test2}


sends.... 52 then 16
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat May 23, 2009 6:06 am   
 
Using #loop nn seems to be fine however.

Here's the compiled code for both:

Code:
#if (1) {#2 {#echo "test"}}


Code:

0000   PUSHEXP   0016
0008   JUMP   0036
0016   INT   1
0024   SETEXP   0   0
0036   PUSHLOC   0052
0044   JUMP   0112
0052   INT   2
0060   PUSHLOC   0076
0068   JUMP   0100
0076   LITERAL   "test"
0088   CMD   echo   (1)
0100   CMD   repeat   (2)
0112   CMD   if   (1)


Code:
#if (1) {#loop 2 {#echo "test"}}


Code:
0000   PUSHEXP   0016
0008   JUMP   0036
0016   INT   1
0024   SETEXP   0   0
0036   PUSHLOC   0052
0044   JUMP   0124
0052   INT   2
0060   INT   1
0068   SWAP   
0072   PUSHLOC   0088
0080   JUMP   0112
0088   LITERAL   "test"
0100   CMD   echo   (1)
0112   CMD   loop   (3)
0124   CMD   if   (2)


The later having 2 extra lines:

Code:
0060   INT   1
0068   SWAP   
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 01, 2009 6:41 pm   
 
Confirmed and added to bug list for next version.
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Tue Jun 02, 2009 1:03 pm   
 
hmm just found a further case where #xxx causes problems

From command line:

Code:
#trigger {test} {#2 jump}


In the PE I get a trigger with pattern "#2 jump" and 16 sent to the mud
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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