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


Joined: 27 Feb 2008
Posts: 13

PostPosted: Sat Mar 15, 2008 6:49 am   

need a little help
 
I just switched to cmud, from zmud and know virtually nothing about coding so here is my question

#ALIAS spi {outp @%1;#if {@inmists} {#wa @misttime};spit @%1 at @targ;#if {not @inmists} {inp @%1}}

I used to be able to use this to outpouch and spit any poison, each poison was assigned a variable such as

ac was acaana, y was yarl etc.
so spi ac would outpouch and spit acaana at my target this doesn work in cmud how do I change it so it does
I don't want to have to type out the whole name of the poison or make alot of aliases to spit different poisons

so any input would be appreciated, thanks in advance
Reply with quote
shalimar
GURU


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

PostPosted: Sat Mar 15, 2008 8:00 am   
 
try @{%1}
_________________
Discord: Shalimarwildcat
Reply with quote
panurge
Beginner


Joined: 27 Feb 2008
Posts: 13

PostPosted: Sat Mar 15, 2008 8:20 am   
 
still doesn't work
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Mar 15, 2008 4:16 pm   
 
Instead of creating a new variable for each item ac,y etc
I would keep them all the items in a sorted stringlist
Code:
#var stufflist {karfar|shirolos|erasmus|kly|mouurark|mandrake|kaskamak|yake|ajkara|surnamen|resik|grimleaf|acaana|yarl}
#var stufflist %sort(@stufflist)

Now my list would look like this
acaana|ajkara|erasmus|grimleaf|karfar|kaskamak|kly|mandrake|mouurark|resik|shirolos|surnamen|yake|yarl

Code:
#alias spi($var) {
#local $found ""
#for @stufflist {
 #if %begins(%i,$var) {
  $found = %i
  #break
  } {}
}
#if (not %null($found)) {
 outpuch $found
 #if (@inmist) {#wa @mistime} {}
 spit $found
 #if (not @inmist) {inpouch $found} {}
 }
}


Using the above list and alias
spi ac would output
Quote:
outpuch acaana
spit acaana
inpouch acaana

To get yarl you would have to do
spi yar, since the prefixes y or ya would find yake using my list
Using this method you would only have to type in enough of the word to uniquely index the item you want to spit

It is important that if you add new items to the list you then sort the list.
Also this is case sensitive so Yarl is not the same as yarl.
although you can just use %lower to overcome that issue.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
panurge
Beginner


Joined: 27 Feb 2008
Posts: 13

PostPosted: Sat Mar 15, 2008 11:23 pm   dharkael
 
so you play avalon?
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sun Mar 16, 2008 12:16 am   
 
Nope just googled it.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
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