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
newbie
Newbie


Joined: 22 Jul 2002
Posts: 3

PostPosted: Mon Jul 22, 2002 3:16 pm   

Variable Storage Question
 
I am trying to store a string, can include spaces and multiple words/characters, in a variable.

I have noticed only the first word gets stored.

So my question is this a limit of a zMUD variable or am I just doing something wrong?
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Mon Jul 22, 2002 3:52 pm   
 
From the command line...

#VAR VariableName {Stuff With Spaces All Put In With No Problems} {default if required, also with happy spaces} {ClassName}

The secret is the {}'s. Without them you've actually created a variable with a default you probably don't want and a Class that means nothing.

Have fun!

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

Core 2651: For those who prefer the future to the past.
Reply with quote
newbie
Newbie


Joined: 22 Jul 2002
Posts: 3

PostPosted: Wed Aug 07, 2002 5:13 pm   
 
Thank you Humpton.

Its good to know variables can handle strings. Yet I am having problems translating your command line example to fit my needs.

I am trying to use a trigger to capture output from the mud I play.

Sample of what I have so far, from memory so might be slightly inaccurate.

trigger: Soandso says, "(*)"
commands: #var repeat %1
say @repeat

So it would essentially repeat back what Soandso just said. I run into the problem with the variable only storing up to the first white space, which is what prompted me to wonder if variables just couldn't handle white space.

Any additional help appreciated.
Reply with quote
LEit
Novice


Joined: 27 Jul 2002
Posts: 38
Location: USA

PostPosted: Wed Aug 07, 2002 6:03 pm   
 
You still need the delimiters:
#var repeat {%1}
I think it will work with quotes too:
#var repeat "%1"
Reply with quote
newbie
Newbie


Joined: 22 Jul 2002
Posts: 3

PostPosted: Thu Aug 08, 2002 9:59 pm   
 
Thank you that worked.
Reply with quote
Apollyon
Wanderer


Joined: 02 Oct 2001
Posts: 76
Location: USA

PostPosted: Fri Aug 09, 2002 6:10 am   
 
why not just do this

#trigger {(*) says, "(*)"} {say %2}

i am pretty sure that would trigger off of all says from all persons(who dont emote says and change the say line) and repeat what is said, all without putting it into a variable, it could be faster too. you could also make a variable list of people who you want to repeat, so you dont repeat everything, and just have an #if in there to check if the person is in the list, if so then do the repeat

#alias {torepeat} {#IF (%ismember( %1, @names)) {#VAR names %delitem( %1, @names);#ECHO %1 has been removed from the list.} {#VAR names %additem( %1, @names);#ECHO %1 has been added to the list.}}
#trigger {(*) says, "(*)"} {#IF (%ismember( %1, @names)) {say %2}

if you do those 2 above lines then you can be on the mud, say you want to repeat someone just type:
torepeat Bob
If he isnt on the list it will add him, and you will be able to repeat everything he says, now if he is already on the list it will delete his name from the list, easy way of doing it instead of going through the whole list.
to show the list in the names variable type:
#alias {showlist} {say I repeat all words spoken by @names.}

hope that works

--------------------------------------------------

"They tell Soze they want his territory - all his business. Soze looks over the faces of his family... Then he showed these men of will what will really was."
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