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


Joined: 26 Dec 2010
Posts: 3

PostPosted: Sun Dec 26, 2010 11:51 pm   

Buy ammount based on inventory
 
Hello,

I'm very new to cmud so I hoped someone would help me make an alias that would do the following:

When I type the alias I want to check how many scrolls of a certain kind and if amount is over 6 then do nothing.
If under 6, buy so the total will be 6.

Should be simple enough but dunno how.

Hope anyone have the time to help me.

Cheers
Reply with quote
shalimar
GURU


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

PostPosted: Mon Dec 27, 2010 3:07 am   
 
Well how would you co about checking?

i assume you can do something like 'read my scrolls' to get an output of what all you have.
Then its just a matter of using triggers to populate a variable.

Code:
#TR {This is a scroll of '(*)'.} {
$numScrolls=(@{scroll.%1}+1)
#ADDKEY scroll {%1=$numScrolls}
}


Then the alias needs to reset your checking variable, queue commands to reload the variable, and then test against a given scroll name

Code:
#ALIAS scrollCount($scrollName) {
scroll=%null
read my scrolls
#WAIT 10000
$scrollTest=@{scroll.$scrollName}
#IF ($scrollTest<6) {#LOOP (6-$scrollTest) {buy $scrollName scroll}}
}


in this example if you wanted to check for scrolls of detect invisible it would be sent the command like so:

scrollCount "Detect Invisible"

-edited for brackets, but not tested
_________________
Discord: Shalimarwildcat
Reply with quote
parashurama
Newbie


Joined: 26 Dec 2010
Posts: 3

PostPosted: Mon Dec 27, 2010 10:22 am   
 
Thanks for the help, but I cant get it to work properly.

This is the item in my belt that I want to check against:

[2] a scroll of recall

Struggeling to capture the number into the $numScrolls variable.

Edit : And I just need to check for recall scrolls, no need to check for others even though the possibilty of choosing
what scroll to check was nice.
Reply with quote
shalimar
GURU


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

PostPosted: Mon Dec 27, 2010 11:30 am   
 
ignore what i did before, delete it and try this instead:

Code:
#ALIAS checkScrolls {
#TEMP "scrollCheck" {~[(%d)~] a scroll of recall} {#IF (%1<6) {#LOOP (6-%1) {buy scroll of recall}}}
look in belt
}


this won't help if you happen to have 0 of them however, or if it displays differently with only one
_________________
Discord: Shalimarwildcat
Reply with quote
parashurama
Newbie


Joined: 26 Dec 2010
Posts: 3

PostPosted: Tue Dec 28, 2010 10:38 pm   
 
Thank you. This worked great!
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