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
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Sun Feb 15, 2015 9:57 pm   

database variable help
 
Hi everyone, and thanks for reading/posting here for this ahead of time!
I'm a bit stuck on assimilating a trigger/variable/alias callback feature for my mud. I want to automate the upgrading aspect of my skills based on i forgot and am not optimizing my guild experience.
In essence, im unsure how to make, and use a database variable, and make a multi-state trigger capture what it see and put that into a database variable, i DO know simple triggers, and functions.

so here's the issue(s):

1: i need to collect 1 or ALL of the following information and put it into a variable, i assumed a database variable would be best due to the amount of captures/variables it would take to do it individually would be in excess of 50.
2: once captured, and stored into the variable(s), to have an alias call the information from the variable and make it "enhance" the skill called from the database.
example: (alias) skillset %0, which would be skillset manifestation, (%dbget(manifestation, 1000000) (unsure how this works, which is why im here lol)

3:ok, the trigger portion: has to be a multistate, and as i stated above it needs to go into a database or many many variables... unsure how to make this happen.


if someone could show me actual code examples of how to make this happen i would be very very appreciative of any and all help!! thanks again.

===============THE ACTUAL INFORMATION FROM MUD=================


the part that needs to be captured:

--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
-- You are the strong wind --
-- --
-- Form : Air Elemental Size : 68 Next Size : 95% (581) --
-- --
-- Used Energy : 196044 Energy to Spend : 49123 --
-- Link Energy : 1744394 Lifetime Energy : 1946123 --
-- --
-- You can also shift into a Fire Elemental, size 100 --
-- --
-- Manifestation : 2/3(200000) Continuance : 0/100(100) --
-- Control : 100/104(30000) Cohesion : 2/5(8500) --
-- Resistance : 4/10(20500) Vortex : 0/50(500) --
-- Resolve : 1/50(1250) Intensity : 1/6(3750) --
-- Efficacy : 13/14(1080000) Blast : 0/6(1500) --
-- Elucidation : 0/11(450) Vinculum : 0/5(2500) --
-- Equipollence : 0/20(250) Focus : 0/10(250) --
-- Finesse : 0/16(103182) --
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--


The aliases, i have made so far....(which DO work)

skset -> #var setskill %0 (setskill manifestation)

then i trigger off the hpbar feed for energy gained:

#IF (@gcon < @gxpsp) {enhance @setskill}

sooooooo yeah, i hope this made sense, and thanks again for reading/posting...
Reply with quote
apfinger
Novice


Joined: 19 Nov 2006
Posts: 40

PostPosted: Wed Feb 25, 2015 9:44 am   
 
I am unfamiliar with multi-state triggers. Do you mean a trigger that can capture multiple lines?

One way, which is probably a bit cumbersome:

#CLASS skillInfoClass 0
#VARIABLE skillInfo
#TRIGGER getSkillInfoStart {--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--} {#T+ skillInfo}
#TRIGGER {-- (%w) : (%n)/(%n)~((%n)~) [|(%w) : (%n)/(%n)~((%n)~) ]--} {skillInfo.%1 = %2|%3|%4; #IF (!%null(%5)) {skillInfo.%5 = %6|%7|%8}} skillInfoClass
#TRIGGER getSkillInfoStop {--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--} {#T- skillInfo} skillInfoClass

Something like that ought to closely accomplish your task.
1) Create a class that starts out disabled.
2) Create an empty variable that belongs outside the disabled class
3) Create a trigger outside the class that enables the class.
4) Create a trigger that belongs to the class to capture the skill information
5) Create a trigger that belongs to the class to disable the class.

In step #4, "skillInfo.%1 = %2|%3|%4" ought to set the variable skillInfo with the property %1 and give that property the value %2|%3|%4
In step #4, "skillInfo.%5 = %6|%7|%8" only gets set if %5 is not null
Using your text example, you'd have:
skillInfo
Manifestation : 2|3|200000
Continuance : 0|100|100
Control : 100|104|30000
...
...
Finesse : 0|16|103182

If any of your skills are more than 1 word, you'll need to switch %w with * and concat the string before trying to make a multi-word key name.
When you need to access the data in an alias or trigger:

You can use %dbkeys(@skillInfo) to get a list of all the keys in skillInfo (Manifestation, Continuance, etc)
You can use %dbkey(@skillInfo, 1) to get the 1st key (Manifestation)

%db(@skillInfo, Manifestation) will return a string list: 2|3|200000

So, you can do something like:
#VAR firstSkillNum %item(%db(@skillInfo, %dbkey(@skillInfo,1)), 1)

firstSkillNum ought to be the value 2.

I'm 99.9% positive there's a cleaner way to do all that, and I haven't tested syntax and such, so it may need some debugging. The cMud manual ought to be enough to sort out anything that doesn't work.

Good luck
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 175

PostPosted: Tue Mar 03, 2015 11:10 pm   
 
oh my, ill have to pick this apart, thank you very much for the help! iull get back when i actually am able to implement this...
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