Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
drider1969
Newbie


Joined: 07 Dec 2003
Posts: 7
Location: USA

PostPosted: Sun Dec 07, 2003 7:43 pm   

Want to create skill based autopractice script
 
I am trying to figure out how to capture and parse the skill list so that I can trigger and practice skills that are lacking. The practice screen output is in the form:
----------------------------------[Spells]----------------------------------
acumen 95% adamant 95% adroitness 95%
black hand 95% blindness 29% brawn 95%
chill touch 72% colour spray 30% continual light 95%
create fire 95% create spring 95% dispel magic 95%
dragon wit 95% elven beauty 95% extradimensional por 66%
faerie fire 28% faerie fog 95% float 95%
fly 95% galvanic whip 95% identify 95%
infravision 95% invis 95% locate object 95%
magic missile 19% midas touch 66% mystical vision 95%
ogre might 95% rapture 95% refresh 75%
remove invis 92% sagacity 95% sapience 95%
shield 60% sleep 94% slink 95%
spectral furor 86% teleport 19% trollish vigor 95%
valiance 19% ventriloquate 19% weaken 92%
word of recall 55%
----------------------------------[Skills]----------------------------------
climb 19% cook 19% defensive style 19%
dig 19% evasive style 19% mount 19%
search 24% second attack 45% standard style 19%
strike 70% swat 63%
----------------------------------[Weapons]----------------------------------
bludgeons 50% flexible arms 60% long blades 50%
pugilism 19% short blades 95% talonous arms 60%
You have 13 practice sessions left.

With 3 skills per line.
What I want to be able to do is to iterate through the lines and capture values and percentages and then if not max, practice them. Most specifically spells.

From what I have read I would do something like this:
#CLASS {practice}
#TRIGGER {start practice} {#t+ dopractice}
#CLASS 0
#CLASS {dopractice}
capture data
#VAR skill1=%1
#VAR level1=%2
#VAR skill2=%3
#VAR level2=%4
#VAR skill3=%5
#VAR level3=%6

Loop on skill versus skill list such that
#IF skill1 = "sanctuary" AND level1 < sancmaxvalue
then if check mana >= sancmana then cast sanc


Basically it will check a spell/skill against the list if the skill is not at the pre-defined max (to be captured from slist output for the char) it will practice that skill once. It will also have a trigger that if the char runs out of mana casting, the char will sleep. Same for food and water. All in the same class so other chars that are not practicing will not get affected when they run out of mana.

While this can be done my hand bu just doing sleep/wake then practice a set list, I want to create a more automagic script. Do not have the Zmud knowledge yet to capture the text or loop through a var list, but I wanted to ask for pointers. I have read the help and tutorials, but I am still a bit confused... Thus I thought I would ask...
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 08, 2003 7:02 pm   
 
First, create a record-variable of your current spells. The simplest method of handling the shorter lines (1 or 2 skills, instead of 3) is to make separate triggers for them. Italics indicates I don't know the correct command or pattern, so I guessed. You left out a lot of details.
#TR {-~[Spells~]-} {#T+ SpellList}
#CLASS SpellList disable
#TR { ([a-z ]) (%d)~% ([a-z ]) (%d)~% ([a-z ]) (%d)~%} {#ADDK SpRec {%1} {%2};#ADDI SpList {%1};#ADDK SpRec {%3} {%4};#ADDI SpList {%3};#ADDK SpRec {%5} {%6};#ADDI SpList {%5}}
#TR { ([a-z ]) (%d)~% ([a-z ]) (%d)~% ([a-z ]) (%d)~%} {#ADDK SpRec {%1} {%2};#ADDI SpList {%1};#ADDK SpRec {%3} {%4};#ADDI SpList {%3}}
#TR { ([a-z ]) (%d)~% ([a-z ]) (%d)~% ([a-z ]) (%d)~%} {#ADDK SpRec {%1} {%2};#ADDI SpList {%1}}
#TR {-~[Skills~]-} {#T- SpellList}
#CLASS 0
This script will update the variables whenever you check the skill list, but won't initiate any other action.

You'll need another record-variable with the maximums for each spell. You didn't provide any details on slist, so you'll have to write that one yourself. I've assumed you have these values in a record named @SpMax.

Once you have your variables, it's just a matter of going through the list. Loop commands aren't desirable, since you need to wait for the completion of each cast before doing the next. Instead, use a numerical variable to keep track of where you are.
#AL autoprac {#T+ AutoPractice;#ADD PracIndex 1;autoprac2}
#CLASS AutoPractice disable
#AL autoprac2 {#IF (@PracIndex > %numitems( @SpList)) {#VAR PracIndex 1;practice;#ALA "PracAlarm1" +1 {autoprac3}} {autoprac3}}
#AL autoprac3 {#IF (%db( @SpRec, %item( @SpList, @PracIndex)) < %db( @SpMax, %item( @SpList, @PracIndex))) {cast %item( @SpList, @PracIndex);#ADD PracIndex 1} {#ADD PracIndex 1;autoprac2}}
#TR {You don't have enough mana to cast that spell} {sleep;#ADD PracIndex -1;#ALA "PracAlarm2" +5 {wake;autoprac2}}
#TR {You lost your concentration} {autoprac2}
#TR {That spell needs a target} {autoprac2}
#TR {You utter the words} {autoprac2}
#TR {You are hungry} {eat bread}
#TR {You are thirsty {cast create spring;drink}
#AL endprac {#UNTR PracAlarm1;#UNTR PracAlarm2;#T- AutoPractice}
#CLASS 0

Good luck. I've already spent a couple hours on this, so I hope you'll be able to take it from here on your own.
Reply with quote
drider1969
Newbie


Joined: 07 Dec 2003
Posts: 7
Location: USA

PostPosted: Tue Dec 09, 2003 8:13 pm   
 
Thanks! Once I get it working I get it posted as I am sure that it can be modified for most any mud Smile
Reply with quote
drider1969
Newbie


Joined: 07 Dec 2003
Posts: 7
Location: USA

PostPosted: Sun Dec 14, 2003 6:18 pm   
 
I am still trying to get the data collection in properly. Here is the line I am parsing:
Spell: magic missile %: 64 Max: 95 MinPos: fighting
Spell: ventriloquate %: 19 Max: 95 MinPos: standing

I am using 2 triggers to capture the practiced level and max as it seems to be a spacing issue and I have no clue how to fix. The triggers are:
#TRIGGER {Spell~: ([a-z ]) ~%~: (%d ) Max~: (%d)} {
#ADDK SPLVLC {%1} {%2}
#ADDK SPLVLM {%1} {%3}
#ADDI SPLVLI {%1}
}
#TRIGGER {Spell~: ([a-z ]) ~%~: (%d ) Max~: (%d)} {
#ADDK SPLVLC {%1}{%2}
#ADDK SPLVLM {%1}{%3}
#ADDI SPLVLI {%1}
}

These 2 triggers work quite well, but the problem I am having is that on a new run, they do not update. I/e I practice ventriloquate and it goes from 19 to 20, the database still has 19. I have tried to do a #DELKEY SPLVLC {%1} to delete the key before updating as well as #ADDKEY SPLVLC {%1}{}. Nothing seems to clear out the database field. What has happened is that that script that checks for practicing gets outdated data and loops. Any suggestions?

Also any way to work with the spell line so that 2 triggers are not required? It is a single digit to double digit issue as the max field is column aligned.

Thx
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Dec 15, 2003 7:39 am   
 
There are many different wildcards available, as listed in the Pattern Matching topic. The appropriate one for matching multiple spaces is %s.
I would change the first trigger to:
#TRIGGER {Spell: ([a-z ]) ~%:%s(%d)%sMax:%s(%d)} {
#ADDK SPLVLC {%1} {%2}
#ADDK SPLVLM {%1} {%3}
#ADDI SPLVLI {%1}
}
The second trigger should be deleted. It probably doesn't work anyway. The only difference I see between your two triggers is that the second one leaves out the REQUIRED space between sections of the #ADDKEY command.

None of these triggers does anything to a database. The information is stored in three variables named @SPLVLC, @SPLVLM, and @SPLVLI. The first two are database-variables (or record-variables), which simply means they have a format similar to database records, not that any database gets changed. The third is a list-variable, which means it has the format of a stringlist.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Mon Dec 15, 2003 10:45 am   
 
this looks alot like the Mage Practice list for Realms of Dispair.

I would not practice teleport unless you have an AV alt to rescue your character, It can be quiet dangerous as I once landed under a mountain with doom, and another time in a cave with a firy tempered red dragon. Luckuly The Imm's Love me and helped me out or I would have been tost.

Hopefully this is your game, Give me acouple of days and I will get you a script that will nock your block off.(i love this mud)

check out my leveling script in the finished scripts part of this forum, it automatically places protective spells on you as you loos them up till level 38 (i am only level 40 in this mud)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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