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


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Sun Jun 08, 2008 9:38 pm   

Alias with # in parms
 
I'm having trouble with an alias when there is a # in the parms.

For example, I have a Alias called qc, it added the parms to a stringlist

typing "qc show skills farming" on the command line works fine with parse arguments turned on, but typing "qc show skills language#southern" does not work.

If I turn off parse arguments, typing "qc show skills language#southern" works fine, but triggers that use this alias now break.

so my trigger has the following line "qc show skills %1", with the option to turn off parsing, the %1 value gets ignored. so if %1 farming, this no longer works. when %1 = language#southern, this does not work in either case.

Any ideas on how to fix this so it works when a # in included in the parms, and works both at the commandline and when used inside a trigger where I do need the %1


alias qc
Code:
MagicWork/QueuedCommands/QcList=%additem(%params, @MagicWork/QueuedCommands/QcList)


trigger
~* You think your%s({@SkillChecks/SkillListing})%sskill has improved. ~*$

Code:
$SkillIncreased=%subchar(%trim(%1)," -#'>","_____")
#VAR %concat("@",$SkillIncreased) %eval( @{%concat("SkillChecks/SkillCountVariables/",$SkillIncreased)}+1) {_nodef} {SkillChecks|SkillCountVariables}
#Window skills %1 @{%concat("SkillChecks/SkillCountVariables/",$SkillIncreased)}
Qc show skills %1
#COLOR 11
_________________
Talahaski


dartmud.com 2525
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Sun Jun 08, 2008 9:44 pm   
 
The best thing I could think of was changing the trigger to use

Qc show skills %replace(%1, "#", "~#")
_________________
Talahaski


dartmud.com 2525
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 09, 2008 5:53 pm   
 
When typing special characters on the command line, you need to put " around the argument to your alias, like this:

qc show skills "language#southern"

(with Parse Arguments turned ON).

Obviously if Parse Arguments is OFF, then none of your argument like %1 are going to get expanded...because you have told CMUD *not* to parse the arguments to the alias.

The solution to this is to create two different aliases, one for using on the command line, and one for using in scripts. Turn OFF the parse arguments for your command line alias. For example:
Code:
#ALIAS qc_internal {do whatever your current qc script does here}
#ALIAS qc {qc_internal}

qc_internal is a normal alias (with Parse arguments ON). The "qc" alias is for using on the command line, and you would turn OFF the parse arguments and also turn on the Auto Append option. In your other triggers and scripts, you would call the qc_internal alias instead of calling the qc alias.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 11, 2008 6:49 pm   
 
Not quite on topic, but...
Talahaski, I wanted to let you know that I just uploaded my Dartmud Imps package to the package library. Even if you want to continue writing your own, you might get some ideas from my package. Enjoy! Very Happy
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Fri Jun 13, 2008 1:01 am   
 
Rehab, I would love to review this. Where did you post it? I don't see it on the wiki.
_________________
Talahaski


dartmud.com 2525
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Jun 13, 2008 1:14 am   
 
Is this a Dartmud wiki? His package is in the CMUD package library - click Library on the toolbar, click Get Latest From Library, wait a bit while it does its thing. Then type "Rahab" in the author box and presto. You'll need to log in with your forum credentials to download it.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Talahaski
Enchanter


Joined: 10 Oct 2000
Posts: 656
Location: USA

PostPosted: Fri Jun 13, 2008 1:29 am   
 
Cool, I never used CMUD package libraries. I think I installed it, although I'm not sure how to "see" the scripts inside it.
_________________
Talahaski


dartmud.com 2525
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Jun 13, 2008 1:31 am   
 
If you're logged into a session when you click Install Package, it's automatically added to that session and should appear in the Package Editor like all your other packages. If you're not, you'll need to manually add it to your session first by opening it with the Editor (should be in your My Games\CMUD\packages folder), then it'll appear there as normal.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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