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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
srelov
Newbie


Joined: 06 Jul 2002
Posts: 9

PostPosted: Sat Jul 06, 2002 3:20 am   

capturing strings from commandline. & adding
 
Well I thought I answered my own question, but I guess I didn't, anyone got a suggestion on how to accomplish the following:
#alias tguild {guildspeak ~{growls harmlessly~} %string}.

Where I type something like this
tguild hey buggers hows life?
and I get:
Srelov [guild line] {growls harmlessly} hey buggers hows life?
on the guildspeak line. the guild line tag is added automatically by the mud via the command. the string works fine as long as I don't try to add tags before the %string but if I add tags before the %string it doesn't print the %string. any direction and help would be appreciated.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jul 06, 2002 5:11 am   
 
#AL tguild {guildspeak ~{growls harmlessly~}}

There isn't any %string predefined variable in 6.16, there might be in the beta versions, but in any case it's not needed here.

LightBulb
Senior Member
Reply with quote
srelov
Newbie


Joined: 06 Jul 2002
Posts: 9

PostPosted: Sat Jul 06, 2002 6:20 am   
 
Well, unfortunately it doesn't, it doesn't capture anything after the command. and the %string shown in the help files isn't working either. I am using the beta yes. thanks. for the offer of help though. I guess I'll keep trying

quote:

#AL tguild {guildspeak ~{growls harmlessly~}}

There isn't any %string predefined variable in 6.16, there might be in the beta versions, but in any case it's not needed here.

LightBulb
Senior Member



--------------------
Freddo Srelov Frelov
--------------------
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Sat Jul 06, 2002 9:08 am   
 
Try:
#alias tguild {guildspeak ~{growls harmlessly~} "%-1"}


 - Charbal
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jul 06, 2002 11:37 am   
 
The only %string in the beat version is an function, not a predefined variable. Functions need parameters to be sent to them inside of parenthesis, or at least have an empty set of parenthesis.

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jul 06, 2002 3:11 pm   
 
What do you mean "it doesn't capture anything"? I thought the purpose of your alias was to add {growls harmlessly} to the beginning of a guildspeak line.

The alias I suggested does exactly what you SAID you wanted it to do
quote:
Where I type something like this
tguild hey buggers hows life?
and I get:
Srelov [guild line] {growls harmlessly} hey buggers hows life?

Next time, try the suggested script first.

I should add that I'm using the public version (6.16), where "any text following the aliasname that is not used as a parameter is appended to the results of the alias expansion", so that I don't need to use the numbered parameter "%-1". It's possible there's a bug (or a change) in the beta version which would require the use of %-1. That's why questions about beta versions should be placed on the beta forum.

LightBulb
Senior Member
Reply with quote
srelov
Newbie


Joined: 06 Jul 2002
Posts: 9

PostPosted: Sat Jul 06, 2002 6:07 pm   
 
I'm not trying to offend you here, I didn't just blindly refute your offer. I've tried it. Yes I'm trying to get it to add that to the beginning of a guildspeak line in addition to adding whatever else I type after the alias to follow the flag. but it doesn't add the 'whatever else I type after the alias' another example I'm trying to do is to set an alias to put things in a container, so I put the following
#alias stuff {put %string in boh}.
hoping to be able to type something like:
stuff ring
stuff ring 1
stuff ring 10
any of those the alias would put the number of item I have specified into the container. ktaja explained the fallacy of my thinking.

Where you and I are differeing is the use of the beta versus the use of the public. I didn't realize when I posted that the %string was the beta only.

Anyways, if anyone knows of a way to accomplish what I'm trying to do (capture a string of words that follows an alias I type in the command line and add it to the text within the alias) prior to the beta versions I'd appreciate any suggestions. And for those I've offended by askign a question that had beta info on the general forum I apologize, but the suggestion offered does not work on my beta versus your public. Thanks for your help.
quote:

What do you mean "it doesn't capture anything"? I thought the purpose of your alias was to add {growls harmlessly} to the beginning of a guildspeak line.

The alias I suggested does exactly what you SAID you wanted it to do
quote:
Where I type something like this
tguild hey buggers hows life?
and I get:
Srelov [guild line] {growls harmlessly} hey buggers hows life?

Next time, try the suggested script first.

I should add that I'm using the public version (6.16), where "any text following the aliasname that is not used as a parameter is appended to the results of the alias expansion", so that I don't need to use the numbered parameter "%-1". It's possible there's a bug (or a change) in the beta version which would require the use of %-1. That's why questions about beta versions should be placed on the beta forum.

LightBulb
Senior Member



--------------------
Freddo Srelov Frelov
--------------------
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jul 06, 2002 8:40 pm   
 
I'm not offended by the question. I was simply attempting to explain why you would have been better served to use the beta forum. Namely, that there may be differences in the beta version which make solutions based on the public version unusable.

I know from experience, including testing within the last 24 hours of the exact script, that my suggestion works in the public version. I have no reason to believe it wouldn't also work in the beta version, so I was under the impression that you had obviously not even tried it. That's what offended me. If I'm wrong, I apologize.

One or both of these aliases should answer your original question. They are interchangeable in the public version but the second should work even if the beta version does have a bug.
#AL tguild {guildspeak ~{growls harmlessly~}}
#AL tguild {guildspeak ~{growls harmlessly~} %-1}
What either of these does is when you type in:
tguild hey buggers hows life?
What gets sent to the mud is:
guildspeak {growls harmlessly} hey buggers hows life?
According to your post, the Mud should then output:
Srelov [guild line] {growls harmlessly} hey buggers hows life?
Of course, it's possible that { and } are special characters for the Mud too.

For your latest question,
#AL stuff {#IF (numparams > 1) {put %2 %1 in boh} {put %1 in boh}}

LightBulb
Senior Member
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jul 06, 2002 11:14 pm   
 
LightBulb's first suggestion (the one without %-1) does work in the beta version as expected. There is no differece in this aspect between the public version and the beat version because nothing has been changed regarding this. The poblem lies in an apparent misconception that you have on how aliases work in zMUD. Why don't you try looking at Introduction to Aliases in the help file and the help entry for the #ALIAS command. Everything about %1..%n and %-1..%-n is explained there. Also, I repeat again, the only %string in any version of zMUD is a function, and it does not work as you want it to.

Kjata
Reply with quote
srelov
Newbie


Joined: 06 Jul 2002
Posts: 9

PostPosted: Sat Jul 06, 2002 11:31 pm   
 
Then I guess version is just being uncooperative because it's not working when I impliment it. Thanks anways.
quote:

LightBulb's first suggestion (the one without %-1) does work in the beta version as expected. There is no differece in this aspect between the public version and the beat version because nothing has been changed regarding this. The poblem lies in an apparent misconception that you have on how aliases work in zMUD. Why don't you try looking at Introduction to Aliases in the help file and the help entry for the #ALIAS command. Everything about %1..%n and %-1..%-n is explained there. Also, I repeat again, the only %string in any version of zMUD is a function, and it does not work as you want it to.

Kjata



--------------------
Freddo Srelov Frelov
--------------------
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Jul 07, 2002 4:42 am   
 
What Mud is this? And what guild?

Have you checked to see what happens when you type
guildspeak ~{growls harmlessly~} hey buggers hows life?
at the command line? At this point I strongly suspect the "problem" is with your Mud's use of special characters.

LightBulb
Senior Member
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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