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
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Tue Jun 13, 2006 11:15 pm   

Calling Alias from Alias Presents Code Problem
 
Okay so im converting a few scripts. Basically i type an alias command

EXAMPLE

#ALIAS bob {recalculate}

#ALIAS recalculate {#ECHO HI BOB}
has to be
#ALIAS recalculate {#ECHO "HI BOB"} or #ALIAS recalculate {#ECHO {HI BOB}}

however in my aliases
it shows the commands instead but doesnt run the function.
The problem here is the compiler tab shows it as valid syntax, when i run the command individually its flawless working. however when called from within another alias it bombs and shows code only. Also putting this code into the #ALIAS itself works perfectly as well its only when calling it from an alias. Any explinations?

Code:

Recalculate alias
#VAR TempOutput {%null} shows 1? {""} works fine but EDITOR hates it
#FORALL @StatusElements {#VAR TempOutput %expand(@TempOutput,1)+%char(27)+"["+%i.Row+";"+%i.Column+"f"+%i.Content}
#STW {%expand(@TempOutput,1)} {Extender} {Tracker}


Code:

THIS IS MY DISPLAY TEXT WHEN ITS RUN.
New status ADDED

THEN IT SHOWS ME THE CODE FOR THE ALIAS INSTEAD OF RUNNING IT WHEN I TYPE IT EVERYTHING WORKS FINE

#VAR TempOutput "" {Extender}
#FORALL @StatusElements {#VAR TempOutput %expand(@TempOutput,1)+%char(27)+"["+%i.Row+";"+%i.Column+"f"+%i.Content}
#STW {%expand(@TempOutput,1)} {Extender} {Tracker}

Attempt to readd to test works properly but it doesnt call the alias so im not suprised
STATUS ALREADY ADDED


Last edited by edb6377 on Wed Jun 14, 2006 5:36 pm; edited 3 times in total
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed Jun 14, 2006 2:06 am   
 
Okay double checked this one by making a retarding alias.

#ALIAS trying {hoping}
#ALIAS hoping {#SHOW {yay}} works fine

#ALIAS trying {hoping}
#ALIAS hoping {#SHOW yay} shows the script.

So it seems that if it can't parse the syntax just right it shows the code instead of the result. Even though it runs by typing hoping just fine.

So instead of displaying a syntax error it displays the code. Which on some of my scripts can actually crash me out of the mud.


Last edited by edb6377 on Wed Jun 14, 2006 5:36 pm; edited 1 time in total
Reply with quote
Rainchild
Wizard


Joined: 10 Oct 2000
Posts: 1551
Location: Australia

PostPosted: Wed Jun 14, 2006 2:12 am   
 
Yeah, I noticed that too with some other scripts that didn't compile ... the code is displayed instead - it probably should pop up an info message "Fails to compile xxx" instead.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed Jun 14, 2006 2:23 am   
 
well heres the weird thing

That only works for say and show. I.E.

#ALIAS hoping {#VAR BOB 1} will show the code instead of running it properly as well.

I am trying to work out the specifics by making these stupid simple aliases. I am working on all my alias scripts since triggers are being a pain.

Hopefully i will have an answer soon.

Until then i cheated and just moved the ALIAS into the script that needed it and will fix it when the problem is fixed.
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Wed Jun 14, 2006 2:55 am   
 
Not that wierd .. it seems CMUD is a lot more stringent in regards to proper syntax which in my opinion is a good thing =)

Using your first example and adjusting modifying it with your last:
Code:
#alias bob {recalculate}
#alias recalculate {#var bob {Hi bob};#echo @bob}

The result when typing 'bob' on the command line is the expected 'Hi bob'.

Our days of hit and miss syntax seem to be gone Twisted Evil
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed Jun 14, 2006 4:57 am   
 
#ALIAS RECALCULATE {#ECHO {@BOB}} works fine anyways.. i posted that.

It only works on #SHOW and #ECHO so far at least that has been shown. Calling Aliases from within aliases gets screwed up with the new {} syntax requirements.

Try it with my alias i always had figured out the {} around the echo it seems almost all commands are now #COMMAND {} required.

VALUE FOR MY RECALCULATE ALIAS
Code:

#UNVAR TempOutput
#FORALL @StatusElements {#VAR TempOutput %expand(@TempOutput,1)+%char(27)+"["+%i.Row+";"+%i.Column+"f"+%i.Content}
#STW {%expand(@TempOutput,1)} {Extender} {Tracker}


Call it from another alias you will get code. Run it by itself it works fine. Or for that matter pick any one of the 3 lines and make it work lol.

To best understand where i was coming from i posted the code i converted after i posted this topic

http://forums.zuggsoft.com/phpbb/viewtopic.php?t=23755

This might help you understand most of these were resultant issues in trying to work around an obviously screwed up STWIN syntax when being called from inside a script.
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Wed Jun 14, 2006 9:37 am   
 
Simple calling of other aliases work as shown:
Code:
#alias test {test2}
#alias test2 {#var First {this};test3}
#alias test3 {#var second {seems};test4}
#alias test4 {#var third {to be working!};test5}
#alias test5 {#echo {@first @Second @third}}


Initiating the chain of aliases with test produces the correct result therefore I would suggest that the topic heading to be incorrect.

I have noticed and bug reported a possible problem with %char(27), if you do #echo %char(27) multiple times from the command line it appears that the first one works correctly and subsequent ones add an extra unknown character after the ']' however on reflection the first one also seems to add a carriage return.

[Edit] Having just looked at a table of ascii codes it seems that %char(27) is the code for escape therefore it displaying ] from the command line is definately a bug of some description.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed Jun 14, 2006 5:09 pm   
 
You still are missing the point. Which is why i gave you a link to what this post directly involved and why my first post showed the coding example i was having trouble with.

Code:

#alias test {test2}
#alias test2 {#var First {this};test3}
#alias test3 {#var second {seems};test4}
#alias test4 {#var third {to be working!};test5}
#alias test5 {#echo {@first @Second @third}}


(i cant even believe thats valid syntax lol)
#ALIAS TEST2 {#VAR first "this";test3} <-- isnt that what the syntax should be on text.

is still showing the same problem

you cannot call an alias if the syntax checker detects its wrong due to {} all your examples test hard coded examples not dynamic examples

#VAR second {%1};#ECHO @second also works just fine.
however thats now what i was discussing either.

Calling a valid alias such as the recalculate alias i asked you to see if you could get working shows the code. The syntax is proper and works just fine if i type recalculate and checks fine in the compiler code but if its called from within another ALIAS or TRIGGER it doesnt work properly at all.

Also putting the escape code by itself would cause that symbol to come up because the ansi code would be invalid. since most of those codes go in the form of <-[1;4f for example is create text on the 1 row 4 column unless you put the entire code it it also shows as invalid and reports that symbol. I would prefer it does this on the escape char anyways. If it sends the escape key sequence while its updating my windows it would wipe out whatever i was typing since typing and hitting esc clears the text line. I did report the same thing however and suggested making some change to the code. It does it with many of the ANSI chars sometimes its ] other times its ]- shrug strange things. Also if you do more than 1 in a row you would end up with <-<-<- thats going to produce ill affects. You will notice ZMUD does the same thing

in either case i will post a direct simplified example for you but the topic is valid.
A VALID SET OF ALIASES CANNOT BE CALLED FROM INSIDE AN ALIAS EVEN THOUGH THEY ARE OF VALID SYNTAX WHEN TYPED INDIVIDUALLY. there for my problem is calling an alias from inside another alias.

Notice the topic doesnt say [CMUD101} Bug report aliases yet? It says i am having a problem and before i submit it i would like to get eyes on it.

Thats because i havent confirmed a bug with it just a hunch.

Rainchild confirmed that it does happen in some of his scripts as well

So the problem remains and i am trying to post coding examples so people can work them out. I know how to run test coding having been coding with zmud for about 9 years now. I ran the same type of tests you did however in about 10 different cases valid aliases refuse to properly run when called from another alias but run perfectly when called via command line
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 11, 2006 9:16 pm   
 
Hmm, this is a wierd one.

Either I've already fixed it in 1.02 or else I can't reproduce it. All of edb's examples with #ECHO and #SHOW seem to work now for me.

So, give this another test when 1.02 is release and let me know if it's still an issue.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Wed Jul 12, 2006 8:39 am   
 
Okay will check it out certainly as its a core tracking script.

Just trying to seperate bugs from changes in coding structure
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Thu Jul 13, 2006 1:08 am   
 
This was the exact issue originally zugg. This is what you would want to test. And by all means if its a me problem let me know. I will do it on 1.02 if you dont anyways so either or :P

ALIAS : RECALCULATE
VALUE:
Code:
#VAR TempOutput {%null}
#FORALL @StatusElements {#VAR TempOutput %expand(@TempOutput,1)+%char(27)+"["+%i.Row+";"+%i.Column+"f"+%i.Content}
#STW {%expand(@TempOutput,1)} {Extender} {Tracker}


ALIAS: INIT
Value: Too long to list but includes recalculate alias.

When running INIT it shows the code for the recalculate alias. When i remove it from the INIT alias init works great then i type recalculate and it works great. It just doesnt like to be run from inside an alias.

VARIABLE STATUSELEMENTS (INCLUDED SCREENSHOT BECAUSE CODE FOR IT IS A LITTLE SILLY FROM ZMUD since CMUD doesnt like it)


SECONDARY PROBLEM WITH THIS ALIAS EXAMPLE
#VAR TempOutput {%null}
shows 1?
#VAR TempOutput {""} works fine but EDITOR hates it
#VAR TempOutput {} just got mad.[/img]
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jul 13, 2006 5:30 pm   
 
You shouldn't need to keep putting {} around everything. {} should only be used *instead* of "" when you want the string data expanded for variables. So, the correct syntax is:
Code:
#VAR TempOutput %null
#VAR TempOutput ""
#VAR TempOutput {}

v1.01 has a problem with {}, so the last example won't work yet. And maybe there was a bug that I've already fixed that was forcing you to use {}, but the above correct syntax seems to work fine in 1.02.

I'll check to see if this alias is in the MUD file you sent me. I don't want to have to type in all of that to test it.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Fri Jul 14, 2006 8:31 am   
 
everything is in that mud file that i would be working on..
_________________
Confucious say "Bugs in Programs need Hammer"
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