|
parashurama Newbie
Joined: 26 Dec 2010 Posts: 3
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
parashurama Newbie
Joined: 26 Dec 2010 Posts: 3
|
Posted: 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. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
parashurama Newbie
Joined: 26 Dec 2010 Posts: 3
|
Posted: Tue Dec 28, 2010 10:38 pm |
Thank you. This worked great!
|
|
|
|
|
|