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


Joined: 03 Apr 2006
Posts: 29

PostPosted: Thu Jun 19, 2014 7:58 pm   

Sitting up a string variable and then getting it working with my aliases
 
Hello again,

I am trying to sit up a button which ask the yes and no question. Which works fine

#YESNO "How do you want to hitch your mount?" {Portable hitching post:PortablePost} {Weathered hitching post:WeatheredPost}

I believe the variable is an issue because when I click on Portable hitching post, it goes through the steps but skips over, #if (%ismember(%1,@Mounts)) section.

#var Mounts {pegasus|Unicorn|Tame}

#AL {PortablePost}
{
open @container
get post @container
drop post
#if (%ismember(%1,@Mounts)) {
dismount %1
hitch %1 post
}
close @container
}

#AL {WeatheredPost}
{
#if (%ismember(%1,@Mounts)) {
dismount %1
hitch %1 post
}
}
#Class 0

any idea what I am doing wrong here? Confused [/i]
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jun 19, 2014 11:40 pm   
 
You're not sending anything to be assigned to %1.
_________________
EDIT: I didn't like my old signature
Reply with quote
kent
Beginner


Joined: 03 Apr 2006
Posts: 29

PostPosted: Fri Jun 20, 2014 6:59 am   
 
A little tip on what I am looking for would be very helpful
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Fri Jun 20, 2014 6:56 pm   
 
In an alias, %1 refers to the first parameter passed in to the alias, %2 to the second, etc. So, for example, if you were to type "PortablePost foo bar", %1 would be "foo" and %2 would be "bar". In this case, your button is just running "PortablePost", without passing in any parameters. So when you get to this part of the code:
Code:
#if (%ismember(%1,@Mounts)) {
dismount %1
hitch %1 post
}

%1 is blank, and it doesn't do anything.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jul 03, 2014 9:14 am   
 
The problem with what you are doing is that there is no actual relationship between the hitching and the mount.
At least, in the script. You have a set of mounts that could be used, but you don't know which mount you are using.
Let's see if this works:
Code:

#VAR Mounts {pegasus|Unicorn|Tame}
;;
#ALIAS {GetMount} {
#VAR Mount %pick("p:Choose your mount:",@Mounts)
;;
#YESNO "How do you want to hitch your mount?" {Portable hitching post:PortablePost} {Weathered hitching post:WeatheredPost}
}

#ALIAS {PortablePost} {
open      @container
get  post @container
drop post
;;
dismount @Mount
hitch    @Mount post
}

#ALIAS {WeatheredPost} {
dismount @Mount
hitch    @Mount post
}

Now, this works, but obviously it isn't too useful. It does give you some idea of what you have to do.
_________________
Sic itur ad astra.
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