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


Joined: 01 May 2003
Posts: 20

PostPosted: Wed May 07, 2003 6:43 am   

Interrupting A trigger
 
I use scrolls in GS3, and I seem to collect them by the boatful. I need to create a way to scroll through them, and read each one, then match the spell number to what I'm looking for.

The idea I've come up with is basically, to create a command that will move down and read the scrolls, one by one, and then a trigger would match the spell number with the one on the correct scroll, and then take it out and interrupt the trigger.

Complicating matters is of course, that gemstone doesen't have 1.scroll, 2.scroll, but rather first, second, third, etc...making #loop more or less useless to me.

So what I'm asking I guess, is how do I go about interrupting a trigger that is running?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed May 07, 2003 8:06 am   
 
Show some mudoutput for how it shows in your inventory.

[url=""]Vijilante's number converter can be used for the first/second etc issues:[/url]
quote:

#CLASS {NumberConvert}
#ALIAS ConvertNumber {#IF (@Factors="") {#ADDKEY Factors @TempExportFactorList;#UNVAR TempExportFactorList};#LOOPDB @Factors {NWord=%replace(@NWord,%key,%val)};NWord=%eval(@NWord)}
#VAR Factors {}
#VAR TempExportFactorList {one=1|two=2|twen=2|three=3|thir=3|four=4|for=4|five=5|fif=5|six=6|seven=7|eight=8|nine=9|ten=10|eleven=11|twelve=12|teen=+10|ty=*10|-=+}
#VAR NWord {} {}
#CLASS 0

To use it just put the word into NWord and call ConvertNumber. It should be able to handle hundreds, thousands, millions, billions, etc by adding the appropiate factor. The Factors variable is actually a record var, but my experience says they don't transfer well in the forums hence the temp list.




Ton Diening
Reply with quote
Kaishaku
Beginner


Joined: 01 May 2003
Posts: 20

PostPosted: Wed May 07, 2003 9:10 am   
 

Mud output is below. What I want to do is basically type something akin to "scroll 101" and/or "scroll bravery". Have to scan throught the scrolls (Up to the 11th scroll, since for some reason, we in the world of Elanthia are unable to couth higher then that), and then match what I'm looking for and grab it. Thanks Ton.


> open tube
Ok, it opened.

> look in tue
In the scroll tube you see a piece of aged paper, an aged parchment, a tattered scroll, an old scroll, an obscure scroll, a sheet of ancient vellum, a smeared scroll, an ancient scroll, a dark scroll, a torn palimpsest, a charred scroll, a tattered scroll, a tattered scroll, an ancient scroll, a charred scroll, an old scroll, a burnt scroll, a charred scroll, a smeared palimpsest, a light scroll, a light scroll, an old scroll, a torn scroll, a smeared scroll, a burnt parchment, a faded scroll, a yellowed scroll, a faded scroll, a sheet of torn vellum, an aged scroll, a smeared scroll, a piece of light paper, a dark scroll, an aged scroll and a burnt scroll.

> read first scroll
It takes you a moment to focus on the tattered scroll.
On the tattered scroll you see
(219) Spell Shield
(211) Bravery
(206) Darkness

>read second scroll
It takes you a moment to focus on the old scroll.
On the old scroll you see
(105) Poison Resistance
(110) Unbalance
(108) Stun Relief
(117) Spirit Strike
(103) Spirit Defense

>read third scroll

It takes you a moment to focus on the obscure scroll.
On the obscure scroll you see
(701) Blood Burst
(403) Lock Pick Enhancement
(412) Weapon Deflection
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed May 07, 2003 7:48 pm   
 
1)
I want to do is basically type something akin to "scroll 101" and/or "scroll bravery".

Choose an example from what you pasted. How must you refer to the scroll to get it from the tube? Show me with (211) Bravery. Does the game let you 'get 211 from tube / recite 211'?

2)
So we scroll with words up to 11 and remember with variables what it finds then we can play with the variables to cough off what you have. Rechecking when you get out of sync or get new ones.



> open tube
Ok, it opened.

> look in tue
In the scroll tube you see a piece of aged paper, an aged parchment, a tattered scroll, an old scroll, an obscure scroll, a sheet of ancient vellum, a smeared scroll, an ancient scroll, a dark scroll, a torn palimpsest, a charred scroll, a tattered scroll, a tattered scroll, an ancient scroll, a charred scroll, an old scroll, a burnt scroll, a charred scroll, a smeared palimpsest, a light scroll, a light scroll, an old scroll, a torn scroll, a smeared scroll, a burnt parchment, a faded scroll, a yellowed scroll, a faded scroll, a sheet of torn vellum, an aged scroll, a smeared scroll, a piece of light paper, a dark scroll, an aged scroll and a burnt scroll.

> read first scroll
It takes you a moment to focus on the tattered scroll.
On the tattered scroll you see
(219) Spell Shield
(211) Bravery
(206) Darkness


I'm assuming that you are seeing all tattered scrolls with 'read first scroll. Does this mean you sort scrolls names in groups of 11 in each container?



Ton Diening
Reply with quote
Kaishaku
Beginner


Joined: 01 May 2003
Posts: 20

PostPosted: Wed May 07, 2003 11:30 pm   
 
Lets say I want to get the scroll with bravery. I'd type >get scroll. If I wanted the one lock pick enhancement, I'd type > get third scroll.

I'd want it to scroll also through scrolls, papers, parchmnets, vellums, palimpset, so on and so forth. But figured I'd kludge that in once I had an idea of how I was going to do this. The pre-names on the various scrolls are: dark, light, ancient, smeared, yellow, torn, charred, faded, aged, tattered, old, burnt and faded. As you can see, it's quite a handful.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu May 08, 2003 12:52 am   
 
Probably best to use something generic to handle lists something akin to Charbal's/Kjata's enhanced status window extender thing.

I'll see if I can just crank out a kludge. Something you could play with.

Ton Diening
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu May 08, 2003 3:22 am   
 
This is what I came up with after dinner / not a Lightbulb to the point-make sense-simple solution-as usual:



For later use but you'll get the idea, capture what your tube has:
#TRIGGER {^In the scroll tube you see (*).$} {#VAR TubeItems "";#VAR TubeItems %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( "%1", "a ", ""), "an ", ""), "sheet of ", ""), "piece of "), ", ", "|"))), " and ", "|");#VAR TubeItemCount "";#FORALL @TubeItems {#ADD TubeItemCount.%word( %i, 2) 1}}

Generates a list of objects in it:
#VAR TubeItems {aged paper|aged parchment|tattered scroll|old scroll|obscure scroll|ancient vellum|smeared scroll|ancient scroll|dark scroll|torn palimpsest|charred scroll|tattered scroll|tattered scroll|ancient scroll|charred scroll|old scroll|burnt scroll|charred scroll|smeared palimpsest|light scroll|light scroll|old scroll|torn scroll|smeared scroll|burnt parchment|faded scroll|yellowed scroll|faded scroll|torn vellum|aged scroll|smeared scroll|light paper|dark scroll|aged scroll|burnt scroll}

A count of those things so you could automate the scrolling through them:
#VAR TubeItemCount {paper2parchment2scroll27vellum2palimpsest2}



When you are reading the scrolls it is key to capture which one it is:
#ALIAS read {#VAR Reading {%-1};#IF (%pos( "scroll", {%-1})>0) {#T+ TriggerSrollCapture};~read %-1}

Generates a variable to track which scroll is being looked at:
#VAR Reading {fourth scroll}

Trigger that processes the information:
#TRIGGER "TriggerSrollCapture" {It takes you a moment to focus on the (%w) scroll.} {#TEMP {^$} {#STATE TriggerSrollCapture 0;#T- TriggerSrollCapture}} "" {disable}
#COND {On the %w scroll you see} {#VAR Scrolls.List %addkey( @{Scrolls.List}, %word( @Reading, 1), @Word_to_NumberConvert(%word(@Reading,1)))} {disable}
#COND {~((%d)~) (*)$} {#ADDITEM Scrolls.Kinds @NoSpace({%2});#ADDITEM Scrolls.%word( @Reading, 1) @NoSpace({%2});#ADDITEM Scrolls.[@NoSpace(%2)] %word( @Reading, 1)} {looppat|param=99|disable}

Generates the master variable which has all the information when everything is read in:
#VAR Scrolls {ListKinds}



The messy part happens when you want to grab a spell and use it. Assumes that once you get that scroll all the spells on it are toast. It uses a 'key' called @Scrolls.List which links the original order the scrolls were read in to what the order has become. So if you took out the first scroll, then it figures out that the second scroll should be refered to as the first.

#ALIAS recitescroll {#VAR ChosenSpell %pick( 'p:Choose', @{Scrolls.kinds});#IF (@ChosenSpell!=%null) {#VAR ChosenScroll %item( @{Scrolls.[@NoSpace(@ChosenSpell)]}, 1);get @Number_To_WordConvert(%db( @{Scrolls.List}, @ChosenScroll)) scroll;#FORALL @{Scrolls.@ChosenScroll} { #IF (%numitems( @{Scrolls.%i}) > 1) {#VAR Scrolls.%i %delitem( @ChosenScroll, @{Scrolls.%i});#VAR Scrolls.List %delkey( @{Scrolls.List}, @ChosenScroll)} {#DELKEY Scrolls %i;#DELITEM Scrolls.Kinds %i;#VAR Scrolls.List %delkey( @{Scrolls.List}, @ChosenScroll)}};#DELKEY Scrolls @ChosenScroll;#FORALL "first|second|third|fourth|fifth|sixth|seventh|eighth|nineth|tenth|eleventh" {#IF ((%iskey( @{Scrolls.List}, %i)) AND (@Word_to_NumberConvert(%i) > @Word_to_NumberConvert(@ChosenScroll))) {#VAR Scrolls.List %addkey( @{Scrolls.List}, %i, %eval( %db( @{Scrolls.List}, %i)-1))}};#IF ((%iskey( @{Scrolls.List}, %i)) AND (@Word_to_NumberConvert(%i) > @Word_to_NumberConvert(@ChosenScroll))) {#VAR Scrolls.List %addkey( @{Scrolls.List}, %i, %eval( %db( @{Scrolls.List}, %i)-1))}} {#SH Error no spell chosen}}

Generates the following variables:
#VAR ChosenSpell {Blood_Burst}

#VAR ChosenScroll {second}

Note ChosenSpell has all spaces converted to '_'



Various functions used to remove spaces, convert numbers to words, words to numbers:
#FUNC NoSpace {%replace( "%1", " ", "_")}
#FUNC Word_to_NumberConvert {%if( %1=first, 1, %if( %1=second, 2, %if( %1=third, 3, %if( %1=fourth, 4, %if( %1=fifth, 5, %if( %1=sixth, 6, %if( %1=seventh, 7, %if( %1=eighth, 8, %if( %1=nineth, 9, %if( %1=tenth, 10, %if( %1=eleventh, 11, 12)))))))))))}
#FUNC Number_to_WordConvert {%case( %1, first, second, third, fourth, fifth, sixth, seventh, eighth, nineth, tenth, eleventh, twelveth)}



I'll email you a demo .mud file if interested in the goobly goop.
All in all probably best to do it yourself you so can fix it if things break ^_^

Ton Diening
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