|
Pyron Beginner
Joined: 11 Mar 2003 Posts: 19 Location: USA
|
Posted: Sat Jul 22, 2006 2:01 pm
[1.03] #IF not parsing commands? |
Here's what I got:
%item(@gemdirs,@dirnum);#ad dirnum 1;#if (@dirnum >= %numitems(@gemdirs)+1) {endgembot} {mine}
This works fine and dandy. When the if statement in this is true, it calls the alias endgembot, which it does fine.
Alias endgembot:
#add runcount 1;#switch (@runcount >= @maxruncount) {cast air portal to 3;#alarm +5 {mineorg}} (@runcount < @maxruncount) {#alarm +5:00 {domine}} (@treegem = 1) {cast air portal to 8;#alarm +5 {dotreegem}};#t- Gembot
When Cmud processes the endgembot alias, it sends everything to the mud as one command. It doesn't error or anything, it just doesn't modify the variable or run the switch command, it just passes it through to the mud as if I typed it into the command line and turned parsing off...
However, if I type the alias: endgembot into the command prompt, it works just fine... |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Sat Jul 22, 2006 5:23 pm |
Code: |
When Cmud processes the endgembot alias, it sends everything to the mud as one command. It doesn't error or anything, it just doesn't modify the variable or run the switch command, it just passes it through to the mud as if I typed it into the command line and turned parsing off... |
This is similar to a topic i posted as well.
It seems if calling an alias from inside another one it seems to have this behavior i posted a really indepth example about running an alias inside an alias. I havent quite gotten my hands or head wrapped around why. Its weird that the script compiler (Parsing) sees it properly when executed individually but now when its inside certain types of commands and i can only assume it has something to do with the actual code for when the parent command is compiled that makes it invalid.
I have a feeling that It might be as simple as a lack of knowledge on new techniques for proper syntax when using these commands or a lack of knowledge on new commands that make this obselete are better sources for this problem but i hope he gets a chance to look at this since its been kinda fuzzy since 1.01
i.e.
#ALIAS bob {ANOTHERALIAS} might be ok when its compiled though
#ALIAS Anotheralias {commands that are here}
so it becomes when its compiled (Zugg could probably shed some light on this entire problem)
#ALIAS bob {{commands that are here}} becomes invalid syntax and thusly the CODE is spit out.
or in your example upon compiling / checking the codes.
Code: |
%item(@gemdirs,@dirnum);#ad dirnum 1;#if (@dirnum >= %numitems(@gemdirs)+1) {endgembot} {mine}
|
Becomes ?
Code: |
%item(@gemdirs,@dirnum);#ad dirnum 1;#if (@dirnum >= %numitems(@gemdirs)+1) {#add runcount 1;#switch (@runcount >= @maxruncount) {cast air portal to 3;#alarm +5 {mineorg}} (@runcount < @maxruncount) {#alarm +5:00 {domine}} (@treegem = 1) {cast air portal to 8;#alarm +5 {dotreegem}};#t- Gembot } {mine}
|
Realize please thats no attempt at coding that just merely a
representation of whats in my head. I pretend to have no idea how zuggs setup for the way code is processed. This is something i have been trying to get a good simple example zugg can reproduce. |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
acaykath Wanderer
Joined: 03 Aug 2005 Posts: 84
|
Posted: Sat Jul 22, 2006 5:32 pm |
My ifs don't parse either. I put
#IF (%1<1){%1=1}{}
<more commands here>
And that is the exact text that was sent to the mud. I also find that other things are parsing, like most of the special characters like . for speedwalking. |
|
|
|
Pyron Beginner
Joined: 11 Mar 2003 Posts: 19 Location: USA
|
Posted: Sat Jul 22, 2006 6:16 pm |
I tried that too, Edb... still no luck. It just, kind of, well..... confuddles me :)
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Sun Jul 23, 2006 5:48 pm |
acaykath wrote: |
My ifs don't parse either. I put
#IF (%1<1){%1=1}{}
<more commands here>
And that is the exact text that was sent to the mud. I also find that other things are parsing, like most of the special characters like . for speedwalking. |
Assuming you used this command verbatim in CMUD, it would be expected that it wouldn't work, even under the best of circumstances. You need spaces between your braces at the very least. |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Sun Jul 23, 2006 8:06 pm |
Yeah i noticed it but didnt say anything either
#IF (%1<1) {%1=1} {} would be correct and the {} wont work sometimes i have noticed so
#IF (%1<1) {%1=1} {#NOOP} would probably have to be used. |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Mon Jul 24, 2006 2:49 am |
Why wouldn't {} work In all cases...?
He could even write
#IF (%1<1) {%1=1}
and leave off the final {} and expect it to work. |
|
_________________ The Seaworthy |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Mon Jul 24, 2006 7:49 am |
{} wont work in all cases because if i remember right unless he fixed it in 1.03 (which im fairly sure hasnt been yet) there existed a bug with {} and {""} not working as expected. I had to but #NOOP in some, the reason i typically do that is so when my script is completed i can put in what to do if its not that.
You have to remember this is beta software. Just because it should work doesnt mean it will work. And what he have gotten used to with ZMUD might not be the way it stands now. |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jul 24, 2006 5:02 pm |
First, edb, the compiled aliases don't work like you said. It never "combines" the aliases like that. When you have:
Code: |
#ALIAS bob {ANOTHERALIAS}
#ALIAS Anotheralias {commands that are here} |
then what you get with the "bob" alias is simply a reference to the Anotheralias alias. Look at the Compiled Code tab for each of these aliases and you should see the ALIASREF code and see how it works. It *never* does anything like #ALIAS bob {{commands that are here}}
The {} was fixed in 1.03 to return a null string just like "" when it's parsing string arguments. The syntax {""} probably won't be valid because this doesn't make sense...it's like having extra quotes around a string. So use {} or "" but not both. If you find a place where {} doesn't work, submit a specific but report about it because it will probably depend on exactly what command it's being used with.
And yes, you should be able to leave the {} off from the #IF statement and it should still work. But the spaces that Larkin mentioned are definitely needed.
Anyway, I'm still looking for a simple way to reproduce the problem where aliases don't get executed. Even when an alias doesn't compile it shouldn't be echoing the alias text, but I will give your specific example a try and see what I can learn. |
|
|
|
edb6377 Magician
Joined: 29 Nov 2005 Posts: 482
|
Posted: Mon Jul 24, 2006 6:16 pm |
I realize thats not the way it works. However ib elieve he understand what i was saying
Replacing the ALIAS call in the first alias should reproduce the error which leads me to believe either the compiler isnt seeing it properly or we are making a syntax error in how we institute it. Since each alias works independently but not when called from another alias
I.E.
Code: |
%item(@gemdirs,@dirnum);#ad dirnum 1;#if (@dirnum >= %numitems(@gemdirs)+1) {#add runcount 1;#switch (@runcount >= @maxruncount) {cast air portal to 3;#alarm +5 {mineorg}} (@runcount < @maxruncount) {#alarm +5:00 {domine}} (@treegem = 1) {cast air portal to 8;#alarm +5 {dotreegem}};#t- Gembot } {mine}
|
is the alias command without calling the alias and i believe thats formatted improperly.
So why it works when you call the alias but not when you put the alias contents in its place is beyond me and thats what i was eluding to. |
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Mon Jul 24, 2006 8:52 pm |
Maybe it just wont call another alias as overprotection of a recursive loop happening?
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|