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


Joined: 05 Mar 2008
Posts: 16

PostPosted: Fri Jul 18, 2008 9:15 am   

Data Capturing
 
Hi there,

I have been tryign with rather limited success to implement a way of keeping tabs on my vials and their sips and contents, so i have com e to ask for some help on it.

When i do an elixlist command, i get the following text
Code:
H:3224 M:3224 E:15020 W:15020 XP:23% [b eb]elixlist

Vial           Elixir                           Sips        Months Left
-----------------------------------------------------------------------
vial85100      an elixir of health              60          47
vial95815      an elixir of speed               60          47
vial99855      empty                            0           11
vial104214     empty                            0           14
vial128131     empty                            0           49
vial130636     an elixir of speed               60          46
vial133394     empty                            0           17
vial135605     empty                            0           10
vial137773     empty                            0           19
vial139463     empty                            0           11
vial139988     empty                            0           17
vial141814     empty                            0           19
vial142556     empty                            0           20
vial142872     empty                            0           20
vial144750     an epidermal salve               60          52
vial144780     empty                            0           7
vial144814     an elixir of frost               60          52
vial144822     empty                            0           10
Type MORE to continue reading. (26% shown)


What i want to do with that, is have a status bar at the bottom that will show me i have 20 empties, 3 health 4 mana etc. I also want to capture the months left and the sips left for usage in sorting the vials out.
I want the script to add each "an elixer of health"'s vial id(vial85100) to a "health" variable that i can then use to move all health vials at once(same goes for speed, mana etc.) lastly i would like to implement a way to "feed to humgii" all vials that have less than 8 months left and are empty.

The basic setting up i would cope with, but i am battling with the data capturing, i can't get my patterns in the trigger to match up. Also, how should i store the data, what type of variables would you guys suggest?
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Fri Jul 18, 2008 1:59 pm   
 
The patterns:
Code:
^vial(%d)%s a salve of (%w)%s(%d)%s(%d)
^vial(%d)%s {a|an} (%w) salve%s(%d)%s(%d)
^vial(%d) %s {a|an} elixir of (%w)%s(%d)%s(%d)
^vial(%d)%s the venom (%w)%s(%d)%s(%d)


Common command for each:
#ADDKEY elixlist %1 %2

Alias to move them around:

Code:
<alias name="minev" id="1114">
  <value>$vc=0
#IF (%null(%2)) {#LOOPDB @elixlist {#IF (%val = %1) {#add $vc 1}};#SAY %1: $vc} {
#LOOPDB @elixlist {#IF (%val = %1) {%2 " " %key " " %-3}}}
</value>
</alias>


To use the alias:
'minev empty' at the command line will display the number of empties. Same goes for 'minev health' etc.
'minev health put in pack' at the command line will put each health vial (by ID number) in your pack. Or any other action you can think of, such as:
minev health drop
minev epidermal give to randomdude
minev frost throw north

(Just remember that the elixir/salve type always goes FIRST and if it is a "<verb> <vialID> TO <target>" syntax, then you put the action last, omitting the ID)

To display in the status window, you can do two things. You could turn this into a function to display the count.. or you could (better) display the total number of sips in the status window, rather that the number of vials.
To do this, add the following command to each of the trigs that capture the elixlist data:

Code:
#IF (%null(@elixlistSips.%2)) {#ADDKEY elixlistSips %2 %3} {#ADDKEY elixlistSips %2 {%eval(@elixlistSips.%2.1+%3)}}


Then in your status window:
%db(@elixlistSips, health)
%db(@elixlistSips, mana)
etc
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Fri Jul 18, 2008 2:07 pm   
 
Actually, to save you the hassle, this is my status window for it.

Code:
<stat name="Elixlist" showinbar="false" showinwindow="true" priority="12630" enabled="false" id="1126">
  <value>Health:       @elixlistSips.health        Frost:       @elixlistSips.frost
Mana:         @elixlistSips.mana        Venom:       @elixlistSips.venom
Immunity:     @elixlistSips.immunity        Speed:       @elixlistSips.speed
Levitation:   @elixlistSips.levitation

Epidermal:    @elixlistSips.epidermal        Caloric:     @elixlistSips.caloric
Mending:      @elixlistSips.mending        Mass:        @elixlistSips.mass
Restoration:  @elixlistSips.restoration

Xentio:       @elixlistSips.xentio
Vernalius: @elixlistSips.vernalius
Kalmia:       @elixlistSips.kalmia         Gecko:       @elixlistSips.gecko
Prefarar:     @elixlistSips.prefarar         Slike:       @elixlistSips.slike
Curare:       @elixlistSips.curare         Aconite:     @elixlistSips.aconite

Darkshade:    @elixlistSips.darkshade         Monkshood:   @elixlistSips.monkshood
Euphorbia:    @elixlistSips.euphorbia         Delphinium:  @elixlistSips.delphinium</value>
</stat>
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Sat Jul 19, 2008 4:25 pm   
 
thanks Caled, i will give this a shot, will post if i have any more question Very Happy
Reply with quote
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Tue Jul 22, 2008 4:38 pm   re
 
Ok, what i have done is create 3 different databases, vialcontents, vialsips, vialmonths.

vialcontents : lists vial id with what is in the vial
vialsips : vial id and how many sips are in the vial
vialmonths : vial id and how many months left on vial

what i want to do
When i type "minev empty 10 humgii" cmud must check which vials in @vialcontents are "empty", then it must take the vial id and check which of those vials have 10 or less months left in @vialmonths and "give to "whoever"(humgii in this case)

Possible?

otherwise i could run triggers directly off the elixlist, not sure which would be better.

^vial(%d)%s a salve of (%w)%s(%d)%s(%d)
#if (%2 = empty & %4 < 11) {#addkey oldvials vial%1} {}

Alias dvials
#loopdb {give %key to %1}


Confused

-edit does anyone else battle to post? i have to go through a loop of preview/post before at some stage the message does post.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Wed Jul 23, 2008 9:28 am   
 
Hm. Its possible, but not with the minev alias. That alias is already multitasking, so rather than increasing the complexity of the syntax needed to use it, lets use a different alias.
I like your idea too, by the way, as I've been meaning to write a script with this function for a while now (maybe 4 years >.>)
Lets try xml for a change.
Code:

<alias name="discardv" id="1277">
  <value>#LOOPDB @vialcontents {#IF (%val="empty") {#IF (%db( @vialcontents, %key) < $amt+1) {give %key to humgii}}}
</value>
  <arglist>$amt</arglist>
</alias>


I think that will work. Untested though.
_________________
Athlon 64 3200+
Win XP Pro x64
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