|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Wed May 03, 2006 3:21 am
Bless/Fireproof script |
Looking to make a simple script to cycle through my equipment, take each piece off, cast a few spells on them, then wear them again. I'd like to make this work somehow with having to manually enter in my equipment sets for each character, but I'm not sure how this can be done effectively. There is a command to see what I'm wearing, but I don't think I can capture this info and reuse it because the keywords attached to the item don't neccesarily match the name seen when typing the eq command. I also need to factor in if a spell is not successfuly cast on an item so it will attempt to recast the spell before moving on to the next piece. This can all be done manually, but its a bit time consuming and annoying. Just looking for some guidance to get me started.
I had a spellup script for spells I was casting on myself, and I tried to modify that to work with my equipment, but I had little success. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed May 03, 2006 4:49 am |
That will take some work.
First we need some sample output to help guide you more.
But let's walk through the logic. Next you need a way of determining what the keywords for a piece of eq is. The simplest way to do it is the probably maintan an DB variable. Since you have multiple characters this may get extensive. It would be easier if you maintained an item database then it's a matter of looking up the info you got from 'identify'. Hopefully the keyword is available there.
Then it's just a matter of calling 'eq' to get a list of your Eq.
Now you didn't mention if you can cast the same spells on the EQ or same types of Eq. Once again the easiest way to do this is probably through a DB variable.
As for spell recast, that's a matter of storing the last spell, and do a trigger that recast's it' on failure.
I hope that helps. |
|
_________________ Asati di tempari! |
|
|
|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Wed May 03, 2006 2:42 pm |
At work right now, so I can't provide the sample output. But I can do that tonight when I get home.
I don't need to make this too sophisticated yet, as I've just started playing around with coding in zmud and I can add functionality as I get used to it.
For now, I can just prepopulate a few lists with the keywords for my equipment for each character. Eventually I'd like to find a way to do this dynamically in realtime depending on the character I have logged. But that can come later.
Not sure what you meant with your question about casting the same spells on the EQ or same types. Basically I just need to cycle through each piece of equipment, remove it, cast each of these spells (bless/fireproof) on it, and then wear it again. I'm guessing its not that hard to do, but I'm just not all that good with the language yet.
I have my db list, which contains my name of equipment. I can setup a variable that holds the number of items in my list. Then I can setup a routine that will start at the beginning of my list, remove the 1st item, cast the first spell, and if that's successful, it will then cast the next. If not, it will recast the first, and then move to the second. Once both are successful, it will decrease my numitem variable by one, and then move on to the next item in my list and repeat this cycle until my numitem variable is equal to zero. The theory of it seems pretty easy, I just don't know the syntax to accomplish this. Plus there might be a more efficient way to do this, I'm no programming genius. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed May 03, 2006 7:26 pm |
The reason I asked about spell-types was to verify that you'd be casting the same spells on all equipments (which you've just said is the case), if it depended on type (i.e. a spell that can only cast on metal weapons, evil boots, capes etc) or each item may or not have spell cast on it (i.e. you may not have wanted to cast fire proof on 'Sword of Fire', or a spell that applied to only a clan weapon).
|
|
_________________ Asati di tempari! |
|
|
|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Wed May 03, 2006 9:43 pm |
Oh, I see what you're saying now. For ease of setting up this script, I'm just going to cast them both on everything. Seems like it would be a bit more difficult to differentiate between the different pieces of equipment (even though manually now I do only cast one spell on certain items because they are already affected with one or the other). I'll be home soon from work so I'll give you some sample output so you can at least get me started. Does my logic at least look sound in terms of what kinds of variables/aliases/triggers I'll need?
|
|
|
|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Wed May 03, 2006 10:30 pm |
Ok, here's some sample output:
Successful bless casting:
An opal ring glows with a holy aura.
Item already affected by bless:
An opal ring is already blessed.
Successful fireproof casting:
You protect an opal ring from fire.
Item already is fireproofed:
An opal ring is already protected from burning.
Failure of either spell:
You lost your concentration.
What I see when I type eq:
You are using:
<used as light> xxx
<worn on finger> xxx
<worn on finger> xxx
<worn around neck> xxx
<worn around neck> xxx
<worn on torso> xxx
<worn on head> xxx
<worn on legs> xxx
<worn on feet> xxx
<worn on hands> xxx
<worn on arms> xxx
<worn as shield> xxx
<worn about body> xxx
<worn about waist> xxx
<worn around wrist> xxx
<worn around wrist> xxx
<wielded> xxx
<held> xxx
<floating nearby> xxx
<sheathed> xxx
Not sure what other output is needed. Any assistance that can be offered to get me going would be greatly appreciated. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed May 03, 2006 10:53 pm |
#CLASS AutoBless
#VARIABLE EqCount {0} {0}
#TRIGGER "EQAuto" {^You are using:$} {#VAR EqCount=0} "" {disable}
#COND {} {#IF (%begins(%line,"<")) {#ADD EqCount 1} {#STATE EQAuto 3;#SET EQAuto 3 1}} {looplines|param=20}
#COND {*} {#STATE EQAuto 0;#T- EQAuto;#SHOW Error in EQAuto during counting, please increase parameter number or other correction.}
#COND {unwield 1.;#LOOP %eval(@EqCount-1) {unwear 1.};cast bless 1.} {manual}
#COND {^{You protect |}*{ glows with a holy aura| is already blessed| is already protected from burning| from fire|You lost your concentration}.$} {#IF (%line="You lost your concentration.") {#STATE EQAuto 4;#SET EQAuto 4 0;cast bless 1.} {cast fireproof 1.}}
#COND {^{You protect |}*{ glows with a holy aura| is already blessed| is already protected from burning| from fire|You lost your concentration}.$} {#IF (%line="You lost your concentration.") {#STATE EQAuto 5;#SET EQAuto 5 0;cast fireproof 1.} {#ADD EqCount -1;#IF (@EqCount!=0) {wear 1.;#STATE EQAuto 4;#SET EQAuto 4 0;cast bless 1.} {wield 1.;#T- EQAuto}}}
#ALIAS Autobless {#T+ EQAuto;eq}
#CLASS 0
That should about do it. If I recall correctly the ROM codebase has this nice little thing about putting the stuff you stop wearing to the top of your inventory. Also the newest item picked up is at the top hence '1.' works for referencing it. This would of course not work if there is an item in the room because that is checked first. The command to start it would be "autobless".
As with all scripts I write in these forums it is off the top of my head and untested. Simply copy and paste and you should be up and going. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Wed May 03, 2006 11:09 pm |
Wow, that's a lot to swallow One thing I'm worried about, is that the item names I see when I type eq are not neccesarily the keywords that are used to wear and remove the equipment. For example, something in my inventory might look like:
<used as light> (Invis) (Glowing) (Humming) the Sceptre of Might
But the keywords for the item are only sceptre & might when I identify the item. So I'm not sure if there is a way to automate this script unless I predefine the keywords for each item in a list of sorts. Know what I mean? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Thu May 04, 2006 12:03 am |
does the last word in the line always work? if so, that would be easy to do
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Thu May 04, 2006 1:23 am |
Unfortunately, no. Here is what I was thinking could work. For each character I can setup an eq list once. Then anytime I switch out a piece of equipment using the wear command, I could capture the keyword and place it in the list for correct eq slot. Only problem with this is a couple of the eq slots have the same name (2 neck slots, two finger slots, etc). I dunno, I'm thinking I'll just have to manually update the lists as I go. The real time saver is going to be running through the equipment and casting the spells, not neccesarily dynamically updating my equipment list. Unless someone can think of a good way to do it
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu May 04, 2006 2:12 am |
Try it for yourself.
"unwear 1."
"unwear 1."
"look 1."
"wear 1."
"look 1."
"wear 1."
The script I wrote is based on using how the ROM codebase is written. If I incorrectly identified your mud type then I am sorry, but otherwise you should read through the notes about a script before dismissing it. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
demingm Beginner
Joined: 27 May 2005 Posts: 23
|
Posted: Thu May 04, 2006 2:43 am |
You'll have to forgive me, as I said I'm new to zmud and I didn't know your script worked that way. Trust me, I'm not dismissing anything, I'll take any help I can get. You did identify the codebase correctly, but it must've been modified extensively because what you're suggesting does not work as intended. I wish it did, then it wouldn't be so bad
|
|
|
|
|
|