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
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Mon Jan 28, 2002 3:25 am   

multiple triggers w/ alarms.... (need help)
 
Here is a question that might make you need to put on your thinking caps....

First off here is the situation. A casting character casts a number of spells then they have to re-memorize the spells with a max number that they can 'memorize'.

So, I am trying to set up a button that fires off a trigger or triggers that will go through the char. list of spells and re-'memorize' the spells up to maximum.

The mud will list the names of the spells and how many that I have currently 'memorized'.

The character memorizes the spells with the following format-
Memorize '{spellname}' spellbook # <--(number of times to memorize from 1 to 20.)

I am looking for a way to 'memorize' the first spell in the list to max then move on to the next and ect. till the char spells are all at full.

Any help is appreatiated.... Thank you in advance.

Jester_fool
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Mon Jan 28, 2002 3:36 am   
 
What does the MUD output look like with regard to the list of spells? Also, what does the MUD output look like for the number of spells memorized message?

Troubadour
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Tue Jan 29, 2002 1:02 am   
 
To view the spells and the number currently memorized you send to the mud 'examine book'

The list of spells then shows up. But, it is a multiple page return so that you need to send a 'return' to the mud. The list for spells looks as such-

(the following is an example)

1) chill touch [13]
2) detect invisibility [32]
3) invisibility [ 2]
4) infravision [ 2]

thus, showing that 'chill touch' is 'mem'ed 13 times, 'detect invisibility' 32 times, and continuing down the list. The char at current has 43 spells that cover 3 pages.

When you 'mem' spells you can 'mem' up to 20 at a time as long as you dont excede your limit. Using the example of 'Detect invisibility' the char can 'mem' up to 41(40+1 bonus). When you attempt to mem over this number the mud replies with-

You may only memorize that spell 40 times at your level.

This also shows up when current # memed + number you are trying to mem is greater then the total that you can currently memorize. (i.e. currently memed 32 then send to the mud 'memorize 'detect invisibility' spell 10')

So, I guess to cover the attempting of trying to over mem you would need to set it up some way to make sure that it doesn't move on to the next spell unless the last attempt was to memorize the spell once.

The affect of memorization also stops the char from sending commands to the mud. Giving the message-

You cannot use that command while memorizing a spell.

and the amount of time meming is variable according to the level of the spell and number meming. So, I figure an alarm must be used to move on and attempt to mem again.

I hope that is enough info to help if not leave a reply with what else is needed.

Thanks,
J_F
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Tue Jan 29, 2002 3:05 am   
 
We will also need to know if there is anyway to tell what the maximum possible to memorize is both total for the character and per spell. The line that tells when to scroll to next page will be needed as the way to correctly handle this is to collect all data then preform processing. Also any formuli you have in regards to how long an actual memorize command will take would be useful, as we don't want the ALARM to go off to soon and we don't want it waiting 2hrs if it only takes 1 minute. Since I expect we will have the ALARM going off early more often then not we will have to create a queue for all the spells, a successful memorization message would make the queue much easier to implement, but is not required. Also since you say it locks you out from doing anything alse when memorizing and memorizing your whole spell book could take a while, I think it would be a nice idea to popup a little YESNO with the approximate total memorizing time.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Jan 29, 2002 7:46 am   
 
My recommendation is to store all the spell/memorization information to a record variable first, then begin memorization as needed.


#VAR limit 40
#AL memspells {#T+ Get_Spell_List; #VAR allspells ""; examine book}

#TR {^%d~) (*) ~[(%d)~]$} {#ADDKEY allspells "%1" %2} {Get_Spell_List}
#TR {A MUD message indicating the end of a page.} {#SEND %cr} {Get_Spell_List} "prompt"
#TR {A MUD message indicating the end of the list.} {#T- Get_Spell_List; process_spells} {Get_Spell_List}

#AL process_spells {
#LOOPDB @allspells {
#MATH needmem (@limit - %val)
#WHILE (@needmem > 0) {
Memorize '%key' spellbook %min(20, @needmem)
#MATH needmem (@needmem - %min(20, @needmem))
}
}
}


The three triggers should be placed in a class named Get_Spell_List, normally disabled. The two aliases and the variable @limit should be outside this class.

The alias memspells enables the Get_Spell_List class and examines the book.

Each spell and the number of times it is currently memorized is captured to the variable @allspells. When the end of the list is encountered, the Get_Spell_List class is disabled, and the process_spells alias is fired, stepping through each spell, calculating the number of memorizations needed and performing that memorization.

I don't know what conditions would prompt you to abort memorization and try again, so I didn't address this.

Troubadour
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Tue Jan 29, 2002 6:04 pm   
 
Vijilante,

The mud sends the following message when I have reached the end of the page.

*** Return to continue, (q)uit, (b)ack, (r)efresh, or # (1/3) ***

The maximum total for the spell only shows up when you have either reached the maximum number or attempt to mem over the max number.

It then gives the message-

You may only memorize that spell ## times at your level.

but the total memorized in the list shows up as-

#) Spell name [##(+1)]

considering the fact that ## is the same number in both cases for the spell. The char is able to mem one more spell then said in the max mem message.
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Tue Jan 29, 2002 6:28 pm   
 
ok, stupid question. This is the first time I have entered a muliple line command.

All I need to do is simply copy the entire thing starting with

#VAR limit 40

to

}

but, when I do such and then go look to see the trigers it ends up with multiple new folders... perhaps I did something wrong or didn't copy it right. I will try it again...

[edit- fixed the spacing was wrong when pasted]
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Tue Jan 29, 2002 6:48 pm   
 
Now I have the triggers,veriables, and alias created in zmud.

I ran it the first time by sending the command- 'memspells' (thats what I wanted right?)

The script sends the command 'examine book' to the mud. It scrolls through to the first page and stops.

so when I enter 'memspells' this is what I have returned to me...

(copyied directly from mud)
>examine book
You see nothing special..
The spellbook, belonging to Darmond, contains the following:

1) chill touch [13]
2) detect invisibility [41]
3) invisibility [ 2]
4) infravision [ 2]
5) magic missile [ 0]
6) armor [ 0]
7) continual light [ 0]
8) burning hands [ 0]
9) precognition [ 0]
10) strength [ 0]
11) shocking grasp [ 0]
12) polymorph self [ 0]
13) chameleon [ 0]
14) fireball [ 0]
15) summon [ 0]
16) waterbreathing [ 0]
17) color spray [ 0]
18) lightning bolt [ 0]
19) giant strength [ 3]
20) fly [ 4]


*** Return to continue, (q)uit, (b)ack, (r)efresh, or # (1/3) ***

(Characters name is Darmond, have few spells currently memorized, due to a death)

I hope that helps. Maybe suggest tweaks in the script?

Thank you for putting up with me still.
Jester_Fool
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 30, 2002 5:57 pm   
 
For
#TR {A MUD message indicating the end of a page.} {#SEND %cr} {Get_Spell_List} "prompt"
put
#TR {Return to continue} {#SEND %cr} {Get_Spell_List} "prompt"

You could also use the #CR command in place of {#SEND %cr}.


LightBulb
All scripts untested unless otherwise noted
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Wed Jan 30, 2002 6:32 pm   
 
The script is working somewhat. It currently sends the #CR command way to quickly to the mud.

The mud also does not show when I reach the end of my spell list, so the process_spells is not working nor is it finishing the trigger (at least that is what I think)

Thank you again, and keep up the good work!
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Jan 30, 2002 6:50 pm   
 
You'll probably have to post what the mud
does show at the end of the list.
A $$ line works well to find the end.

TonDiening
Uses 6.16
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Wed Jan 30, 2002 7:10 pm   
 
TonDiening,
The closest thing that I can think of that shows up when the list is compleate is the prompt for my character.

All,
Would it be safe to use the prompt as the end for the 'memspells' trigger or is there a way to use last spells name? (but then I would have to enter then neme correct?)

I'll just keep ploding on...

PS I also need a way to perform the #CR with a wait time or an alarm that slows it down a second or two.

High spirits, like a ghost on drugs,
J_F
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Jan 30, 2002 9:24 pm   
 
If you don't have a blank line between the
list and your prompt then you could
use a toggling folder to capture the end.

To delay the #CR slam it into an alarm
trigger. #ALARM +2 {#CR} would give you
a #CR in 2 seconds.

TonDiening
Uses 6.16
Reply with quote
Jester_fool
Newbie


Joined: 28 Jan 2002
Posts: 8

PostPosted: Thu Jan 31, 2002 11:37 pm   
 
Everything is fireing off for the 'memspelss' trigger so far, but then when it gets to the end of the list nothing new happens (the process_spells trigger was supposed to fire right (If I read the 'memspells' trigger correctly)).

So, any help trouble shooting this new problem is appreatiated.

Thanks,
Jester_Fool
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Feb 01, 2002 12:34 am   
 
Have you set the pattern for the trigger that will fire when you get to the end of the list? If so, to what?

If there is a blank line at the end, you can use that, like it was suggested before. A pattern of:
^$

should do. If there is not blank line, you can use your prompt with no problems. Just put in a pattern that will match your prompt and be sure to select the Trigger on Prompt option in the Options tab for the trigger.

Kjata
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