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
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Tue May 31, 2011 4:50 am   

CMUD aliases inside of classes (not accessible via /aliasname ?)
 
I thought this wasnt the case, but after moving some of my scripts to classes today my aliases require /classname/aliasname to trigger now... Am I missing something simple? I spent a good hour going through the class and alias help files and cant find any mention of that being required....

Thanks!
and sorry for the noobish sounding question
_________________
-Karl
Reply with quote
shalimar
GURU


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

PostPosted: Tue May 31, 2011 5:18 am   
 
you shouldn't need to use the / at all, just the alias name by itself should call it
_________________
Discord: Shalimarwildcat
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Sat Jun 04, 2011 4:36 am   
 
shalimar wrote:
you shouldn't need to use the / at all, just the alias name by itself should call it

Ahh I did not realize that, I knew regular aliases worked that way, never tried once I removed the alias and put it in a class

which isnt ideal since I was aiming to alias real in game commands with /realcommand on/off to turn on classes/such for those skills.... and not interfere with the games commands...

is there a way to prevent aliases from triggering without / then?
_________________
-Karl
Reply with quote
shalimar
GURU


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

PostPosted: Sat Jun 04, 2011 5:17 am   
 
you can use #T- to turn off and #T+ to turn on any setting, including aliases and classes
_________________
Discord: Shalimarwildcat
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Sat Jun 04, 2011 5:39 am   
 
I wasnt looking for alternative on/off switches, I was looking for ways to use logical named aliases w/o blowing away in game commands

"gather" is not an alias... "/gather" is... I dont see why no / should even be triggering anything...

if there is no way to avoid that behavior that ill just have to change alias names, but... it really does not make sense
_________________
-Karl
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Sat Jun 04, 2011 12:14 pm   
 
Just like in Windows if you type a command it searches various places for a match and if it finds one it runs the command such is the fact that CMUD does the same.

You happen to have chosen a character that is used to reference classes which are the same as directories in Windows/*nix if you do /command in *nix then you are likely to run a command that exists in the root directory and it won't search elsewhere for a match. Also you may have chosen to use that character due to having used tf, I myself many years ago did exactly the same when moving from tf to zMUD until I realised there was no point.

Now on to helping you overcome your problem, don't precede the alias name with a slash but instead name it exactly the same as the in game command. What you then do is build logic into the alias such that it achieves the desired outcome.

For instance with gather.

#alias gather {#if (%1=%null) {#SEND gather} {#if (%1="on") {#T+ gather} {#T- gather}}}

What that will do is if you type gather into the command line in CMUD it will recognise that no parameter was supplied to the gather alias and send gather directly to the mud and hence use the mud gather command. If you do gather on then CMUD will turn the gather class on other wise gather followed by anything else will turn the gather class off.

If gather on the mud requires a parameter to be sent along with it then just alter the logic to achieve what you need.

Feel free to ask for more help if you can't figure out the logic your require.
_________________
Taz :)
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Sat Jun 04, 2011 4:12 pm   
 
Taz, I have done this, it just goes against my way of doing things to override in game commands - and from what I remember back in zMUD days this was not the case, never used tf tho?

It would be nice if the /-less alias was an option you could enable/disable --- Really dislike the obfuscation it causes :(
_________________
-Karl
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Jun 06, 2011 3:59 pm   
 
You cannot name an alias "/something" because in Cmud, the / means something. If you try to name an alias /newalias, the alias name will be "newalias" within the class "/", in other words, the top level of the package. The same would be true if you tried to use any other Cmud symbol in a variable name. "#something" will work, I believe.
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 5:15 am   
 
when I started with zMUD aliases were always triggered by /aliasname not just typing "aliasname" in the input box... thats what I was saying... I'd much rather all aliases trigger by /[name] and NEVER by "name"
_________________
-Karl
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jun 08, 2011 5:39 am   
 
zMUD has never worked that way, perhaps you are confusing it with another client?
_________________
Discord: Shalimarwildcat
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 7:09 am   
 
shalimar wrote:
zMUD has never worked that way, perhaps you are confusing it with another client?


I didnt start using classes until CMUD so I never knew "alias" didnt mean /command so I guess so --- its disappointing though

I've always understood "alias" to be a user defined command, hence the drive to want to use / in front of them (it gave the appearance of working similar to most IRC clients)
You should be able to create an alias w/o it affecting the plain text sent to the mud, thats what otherwise why have #ONINPUT

Regardless, I've already paid and invested too much time to try recreating my scripts in another client so its a moot point

but an option to prevent #alias'd commands from triggering without a command prefix would be major win in my book
_________________
-Karl
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Wed Jun 08, 2011 8:55 am   
 
What about prefixing all your aliases with z ?

zcrawl could be an alias.

crawl could be a regular mud command.
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jun 08, 2011 10:47 am   
 
the trick to not call an alias from inside itself is ~aliasname, the tilde prevents an infinite loop

reguardless of how you thought it worked, hopefully it has been made clear now.

and don't be so quick to give up on CMUD, there are plenty of folks on this forum who are willing to help
_________________
Discord: Shalimarwildcat
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 3:36 pm   
 
hogarius wrote:
What about prefixing all your aliases with z ?

zcrawl could be an alias.

crawl could be a regular mud command.


The idea was to keep the actual trigger commands the same as the in game command they enabled/disabled/whatever CMUD options for... currently I coded around it, but extra code is/was undesirable guess now it its required if I wanna keep this idea going

Shalimar: I'm not giving up, just disappointed there isnt an option for this - From the docs its made to sound like ONINPUT is required to override userinput when in fact thats not the case since clearly aliases allow similar functionality as #ONINPUT:%^text

Now if only #COND worked properly with ONINPUT I could probably not code around this for every alias I write :/
_________________
-Karl
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 08, 2011 5:24 pm   
 
Aliases have always allowed you to override user input, even back to the early days of Zmud. The docs are saying that #ONINPUT is _one_ way to do it, but I don't see any place that implies that this is the _only_ way to do it. #ONINPUT is best used when you want to match a pattern--if you want to match a specific string, then #alias is much more efficient. And the behavior we have been describing has not changed since Zmud. Even under Zmud you could not have created aliases that started with /.
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 5:34 pm   
 
Rahab wrote:
Aliases have always allowed you to override user input, even back to the early days of Zmud. The docs are saying that #ONINPUT is _one_ way to do it, but I don't see any place that implies that this is the _only_ way to do it. #ONINPUT is best used when you want to match a pattern--if you want to match a specific string, then #alias is much more efficient. And the behavior we have been describing has not changed since Zmud. Even under Zmud you could not have created aliases that started with /.


Please stop saying I am claiming to create aliases that start with /

I have and have only said that I created aliases that were matching in game commands -- I always was under the impression that these aliases ONLY triggered when typing /[aliasname] (see explanation in earlier comments) so when I started moving aliases to classes, this broke since apparently the / is actually a root class reference (assuming based on class path stuff mentioned before)

so to clarify:

mud command: "gather"

CMUD:
#alias gather {......} [note: no / in the name]

command line:
"gather" fires CMUD alias
"/gather" fires CMUD alias <--- this was only way I ever used #alias's before
_________________
-Karl
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 08, 2011 8:17 pm   
 
Ah, my apologies. That was not clear to me, which made some of what you were saying rather confusing. My fault--now I understand.
Reply with quote
tekky
Beginner


Joined: 08 Feb 2006
Posts: 25

PostPosted: Wed Jun 08, 2011 8:24 pm   
 
Rahab wrote:
Ah, my apologies. That was not clear to me, which made some of what you were saying rather confusing. My fault--now I understand.


No problem, equally confusing for me the past week as I ran into these problems

slowly... working them out though

thanks again for all your help (and patience)
_________________
-Karl
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