Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Request for suggestions on project: Spell Queue

Request for suggestions on project: Spell Queue

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Magnum   Canada  (580 posts)  Bio
Date Fri 14 Dec 2001 09:56 AM (UTC)
Message
Ok, I'm thinking of doing a major-revamp on my large script file. I am considering creating a spell queue.

There is sufficient output from the mud I play to detect when spellcasting has begun and ended, as well as spellcasting failure messages.

I would need to set up either a multidimensioned array (if possible), or 3 seperate arrays, to accomodate the following values:

SpellName, SpellTarget, SpellPriority.

So far, I would expect to create the following functions/subroutines to handle spellcasting with the queue:

- Add_Spell
- Drop_Spell (all spells on 'target')
- Pause_Casting
- Resume_Casting
- Resume_Casting_Delayed
- Clear_Queue
- Save_Last_Spell

Before casting, a flag would be checked to make sure casting is enabled (and not paused). Resume_Casting_Delayed would be called when the spell was interrupted due to movement. I wouldn't want to restart casting right away in case of further movement, so I would establish a timer to resume after... say 5 seconds.

I will probably set up variables for about 10 priority levels. (Top, HealMe, HealOther, Blessings, Defense, Hide, Offense, Misc, Bottom). I would have subroutines for each spell that sets the priority then calls the Add_Spell. I see more flexibility in creating variables for each priority level so that if I want to switch them around, I can do it in one spot (if hardcoded), or via alias (if softcoded). I may make a special subroutine/alias for casting a spell with the priory included with the alias. For example "cast 9 teleport nick".

I am confident I could write the code for everything I mentioned above. Here's where I am uncertain:

What's the best way to run through the spell queue? I see three options, and I'll list them in the order from what I guesstimate would be most efficient to least efficient:

It's important to note, I don't want to lose the order of spells with the same priority rank.

1. Sort the queue after every casting, or when a spell is added. Essentially, a for-next loop run once for each priory level. First run, it looks for any 10's, and places them at the top, then it searches for 9's, and places them after the 10's, etc... down to 1. Tough to maintain order of spells with same rank during sorting - prolly would need second array set.

2. Scan the array each casting. A For-next loop that starts at 'Nextspell' [a pointer], and runs through the array (wrapping around to the beginning when needed). When it finds a 10, it casts it, then... increases nextspell by 1. When adding a spell, I would work 'backwards' from nextspell, looking for the first blank spot. Ack, casting order would get messed up. Assuming I resolve that, if no 10 is found, it scans again, looking for a 9, etc, etc...

Actually, I don't think #2 is viable, I don't see a way, offhand, to keep spells with same priority in order. I was probably trying to brainstorm a cast-on-the-fly-while-doing-a-shellsort when I came up with this idea.

3. Make an array for each priority level. If my queue can stack 20 spells, I would need 3 * 20 * 10 data fields. That's 600 fields! This may not be a good option...

Another thing I just realized, is that Add_Spell could 'insert' the spell at a certain level in the queue, then push all the rest down.

---
This is one of those times where you are trying to finish a 'session' before going to bed. My brain is starting to turn to mush. As I wrote out my options, I think I have eliminated the latter two. I'll leave this posting here and come back to brainstorm further before I formulate my plan and begin writing the code. When I'm all done, I'll prolly post the code here as an example for others.

Magnum. (Now half-asleep)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Fri 14 Dec 2001 10:16 AM (UTC)
Message
Before I hit the sack, I thought I would just add...:

Although option 3 would consume a lot of memory, it would be the easiest to code. I could use the "nextspell" pointer I mentioned above without fear of randomizing the order of spells with the same priority. I would need one pointer for each array though, adding yet even more variables to my script.

If I put the set of pointers in an array of it's own, I could probably create LESS script, by utilizing the same code to access each array set. (Just pass different values to the functions that manage the queue).

Oh, I would prolly need an array of "NextEmpty" pointers as well. Over 618 variables if I implement option 3.

More script, or more memory? (I am guessing script.)

Going to bed... Magnum.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 16 Dec 2001 09:49 PM (UTC)
Message
I think that in VBscript you can have multi-dimensional arrays, so you could probably implement it with them, which would be fairly simple, and not take too much memory.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #3 on Fri 21 Dec 2001 12:31 PM (UTC)
Message
Well, I've gotten bored again with "Ages of Despair". I tried out a new mud for myself, "Realms of Despair". ROD is a SMAUG based MUD. Frankly, I don't know how anyone stands it, because I find it so spammy! That place DEMANDS gag triggers! (...and a KEEP flag for inventory).

...Anyway, when I get bored with actual playing, I turn to playing with scripts. I just finished taking some time to read up on arrays at msdn.microsoft.com, and after brainstorming, I think the most efficient way to create a spell queue is as follows:

Dim arrSpellsPointer(1 To 20)
Dim arrSpells(1 To 20, 1 To 4)

The 4 fields in the array represent: Priority, Mana, Spell, Target. This particular array would be able to stack up to 20 spells. I don't think I would ever need to stack more than that. (More on this later).

One thing that I have never mentioned before, and should: Ages of Despair uses a system where there is a delay after issuing the command to cast a spell (or use a skill). The player is informed that "You begin concentrating", and after a delay "You have finished concentrating on the spell". I will use triggers on these lines to tell the script when to cast a new spell.

Getting back to the programming:

All of the actual spells to be cast, and their arguments, are stored in arrSpells. Every time a new spell is added to the queue, it must be resorted. The order they should be cast in, is stored in arrSpellsPointer. For example:

arrSpellsPointer:
1: 3
2: 4
3: 2
4: 1

What this means, is that the spell in 'slot' 3 of arrSpells will be cast first. When it is complete, the spell in 'slot' 4 will be cast. Now suppose a new spell is added to arrSpells. The array would be resorted, and you might end up with this (in ArrSpellsPointer):

1: 2
2: 1
3: 3

Now the spells would be cast from arrSpells, in the order of slot 2, slot 1, slot 3.

Does this seem like the most efficient way to handle this project? If you can think of a better way, please let me know!

...To make the arrays more flexable, I could make them dynamic. [ Dim arrSpells() ]. I would then initialize the array in my script initialization routine [ ReDim arrSpells(1 To 1, 1 To 4) ], and then expand the stack to as large as needed [ ReDim Preserve arrSpells(1 To x, 1 To 4) -- Where x is the size of the stack ]. This would expand the size of the satck dynamically as needed, though it would not shrink. -- Well, I *could* shrink it down to 1 again whenever it is empty.

I have also reconsidered all the subroutines I would need to interface with the Spell Queue. I now have this list:

Casting_On, Casting_Off,
PauseCasting_On, PauseCasting_Off,
PauseCasting_Toggle, PauseCasting_Off_byTimer,
Add_Spell, Drop_spell [all spells on same target],
Set_Last_Spell,
Cast_Spell,
Recast_Last_Spell [In case of fizzle, etc.]

I think that concludes all the prep. work. Next thing to do is get started on the programming.

I've been documenting my brainstorming here as a service to those who can learn from my process. (I'll gladly cease on request). Hopefully, my next post will be the actual code. I know it'll be big, so I may wait till the next time I am bored with the MUD.

- Magnum.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #4 on Tue 26 Feb 2002 12:41 PM (UTC)
Message
If anyone is interested, I have actually had this project complete for some time now. Because of the complexity of the script, and because the script demands a large amount of triggers and aliases to work, I never came back to follow up here.

I ended up emulating an array, using mushclient variables. The following script consists of three subroutines that accomplish that task:

Wait a sec, I already posted my array emulation script!
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=713

In the end, I ended up writing all of the following script subroutines for the spell queue:

Sub Casting_True (thename, theoutput, arrWildcards)
Sub Casting_False (thename, theoutput, arrWildcards)
Sub PauseCasting_True (thename, theoutput, arrWildcards)
Sub PauseCasting_False (thename, theoutput, arrWildcards)
Sub Toggle_PauseCasting (thename, theoutput, arrWildcards)
Sub PauseCasting_False_ByTimer (TimerError)
Sub PauseCasting_True_ByTimer (thename, theoutput, arrWildcards)
Sub Display_Spell_Queue (thename, theoutput, arrWildcards)
Sub Clear_Spell_Queue (thename, theoutput, arrWildcards)
Function InarrSpellsPointer (PointerValue)
Function IsSP (PriorityLevel)
Sub Sort_Spell_Queue
Sub Add_Spell (Spell, Target, CP, Priority, Echo)
Sub Add_Spell_Manually (thename, theoutput, arrWildcards)
Sub Drop_Spell_ByTarget (thename, theoutput, arrWildcards)
Sub Reattempt_Failed_Spell (thename, theoutput, arrWildcards)
Sub Cast_Spell (thename, theoutput, arrWildcards)

A lot! 'Casting_False' is called by quite a few triggers. "You have finished concentrating on the skill." probably makes the most calls, but also any time a skill or spell fails with a unique output line, that line must be triggered to call 'Casting_False' so that the spell queue will resume functioning.

Every skill or spell requires an alias that calls a small script, which adds that spell or skill to the queue. For example:

Sub Attempt_Heal_Wounds (thename, theoutput, arrWildcards)
Add_Spell "heal wounds", LCase(Trim(arrWildcards(1))), 125, SP_HealOther, -1
End Sub

(Skills and Spells on Ages of Despair essentially function in the same manner. -- Make attempt, and wait for results)

For the moment, I won't post the entire script here. As I said, the script requires MANY aliases and triggers. I am still a little relunctant to share it because I am not sure I want others on AOD asking for support frequently. :) Lastly, I get the feeling this is more of a diary entry than anything else. I'm doubting that anyone who reads this cares about this project. LOL.

Here's a couple of more script subroutines that are called by the spell queue, but they are general purpose text-formatting routines.:

' ------------------------------------------------------------
' STRING MANIPULATION
' ------------------------------------------------------------
Function PadLeft (String, Length)
Dim StringLength
Dim x
StringLength = Len(String)
If StringLength < Length Then
For x = 1 to Length - StringLength
String = " " + String
Next
End If
PadLeft = String
End Function

Function PadRight (String, Length)
Dim StringLength
Dim x
StringLength = Len(String)
If StringLength < Length Then
For x = 1 to Length - StringLength
String = String + " "
Next
End If
PadRight = String
End Function

My Display_Spell_Queue sub calls them so that i can output the spell queue in a nice chart format. I needed to pad spaces to either the beginning or ending of strings to make it look nice.

If you are really interested in this project, let me know, and perhaps I'll post my script and help you get it working. Maybe! :)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #5 on Wed 27 Feb 2002 07:06 AM (UTC)

Amended on Wed 27 Feb 2002 07:07 AM (UTC) by Shadowfyr

Message
Hmm. Didn't find the space() command huh? Try:


Function PadLeft (String, Length)
  Dim StringLength
  StringLength = Len(String)
  PadLeft = space(Length - StringLength) + String
End Function

Function PadRight (String, Length)
  Dim StringLength
  StringLength = Len(String)
  PadRight = String + space(Length - StringLength)
End Function


You remind me of a guy I knew from highschool, always doing things the hard way. lol
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #6 on Fri 03 May 2002 06:11 PM (UTC)
Message
Part 1:

' ------------------------------------------------------------
'   SPELL QUEUE
' ------------------------------------------------------------
Sub Casting_True (thename, theoutput, arrWildcards)
	World.SetVariable "Casting", True
	World.SetVariable "CastingStatus", "Busy: Y"
	Display_StatusLine()
End Sub

Sub Casting_False (thename, theoutput, arrWildcards)
	World.SetVariable "Casting", False
	World.SetVariable "CastingStatus", "Busy: N"
	Display_StatusLine()
	Cast_Spell "Casting_False", theoutput, arrWildcards
End Sub

Sub PauseCasting_True (thename, theoutput, arrWildcards)
	World.SetVariable "PauseCasting", True
	World.SetVariable "PauseCastingStatus", "Skill/Spell Attempts: Paused"
	World.SetVariable "PCSS", "SQ: Off"
	World.Note World.GetVariable("PauseCastingStatus")
	Display_StatusLine()
	World.EchoInput = vbsTrue
End Sub

Sub PauseCasting_False (thename, theoutput, arrWildcards)
	World.SetVariable "PauseCasting", False
	World.SetVariable "PauseCastingStatus", "Skill/Spell Attempts: Working"
	World.SetVariable "PCSS", "SQ: On"
	World.Note World.GetVariable("PauseCastingStatus")
	Display_StatusLine()
	World.EchoInput = vbsTrue
	Cast_Spell "PauseCasting_False", theoutput, arrWildcards
End Sub

Sub Toggle_PauseCasting (thename, theoutput, arrWildcards)
	If World.GetVariable("PauseCasting") Then
		PauseCasting_False "Toggle_PauseCasting", "-", "-"
	Else
		PauseCasting_True "Toggle_PauseCasting", "-", "-"
	End If
End Sub

Sub PauseCasting_False_ByTimer (TimerName)
	Reattempt_Failed_Spell "PauseCasting_False_ByTimer", "-", "-"
	PauseCasting_False "PauseCasting_False_ByTimer", "-", "-"
End Sub

Sub PauseCasting_True_ByTimer (thename, theoutput, arrWildcards)
	If Not CombatFlee Then
		PauseCasting_True "PauseCasting_True_ByTimer", theoutput, arrWildcards
	End If
	Casting_False "PauseCasting_True_ByTimer", theoutput, arrWildcards
	If Not CombatFlee Then 
		World.AddTimer "PauseCastingTimer", 0, 0, 1, "", 5, "PauseCasting_False_ByTimer"
	Else
		Reattempt_Failed_Spell "PauseCasting_True_ByTimer", "-", "-"
	End If
	CombatFlee = False
End Sub

Sub Display_Spell_Queue (thename, theoutput, arrWildcards)
	Dim x
	Dim Index
	Dim OutputString
	World.EchoInput = vbsFalse
	If World.GetVariable("InParty") Then
		World.Send "to party emote"
		World.Send "Spell Queue"
		World.Send "-----------"
		World.Send " ## | Spell Name                | Target         | CP  | Rank | Echo"
		World.Send "--------------------------------------------------------------------"
	Else
		World.Note "Spell Queue"
		World.Note "-----------"
		World.Note " ## | Spell Name                | Target         | CP  | Rank | Echo"
		World.Note "--------------------------------------------------------------------"
	End If
	For x = World.GetVariable("arrSpellsPointer_LB") to World.GetVariable("arrSpellsPointer_UB") -1
		OutPutString = PadLeft(CStr(x), 3) & " | "
		Index = CStr(MCGetArray("arrSpellsPointer", x)) & ",1"
		OutPutString = OutPutString & PadRight(MCGetArray("arrSpells", Index), 25) & " | "
		Index = CStr(MCGetArray("arrSpellsPointer", x)) & ",2"
		OutPutString = OutPutString & PadRight(MCGetArray("arrSpells", Index), 14) & " | "
		Index = CStr(MCGetArray("arrSpellsPointer", x)) & ",3"
		OutPutString = OutPutString & PadLeft(MCGetArray("arrSpells", Index), 3) & " | "
		Index = CStr(MCGetArray("arrSpellsPointer", x)) & ",4"
		OutPutString = OutPutString & PadLeft(MCGetArray("arrSpells", Index), 3) & "  | "
		Index = CStr(MCGetArray("arrSpellsPointer", x)) & ",5"
		OutPutString = OutPutString & PadLeft(MCGetArray("arrSpells", Index), 3)
		If World.GetVariable("InParty") Then
			World.Send OutPutString
		Else
			World.Note OutPutString
		End If
	Next
	If World.GetVariable("InParty") Then
		World.Send "."
	End If
	Display_StatusLine()
	World.EchoInput = vbsTrue
End Sub

Sub Clear_Spell_Queue (thename, theoutput, arrWildcards)
	MCDelArray "arrSpellsPointer"
	MCDelArray "arrSpells"
	World.SetVariable "arrSpellsPointer_LB", 1
	World.SetVariable "arrSpellsPointer_UB", 1
	World.SetVariable "arrSpells_LB1", 1
	World.SetVariable "arrSpells_UB1", 1
	World.SetVariable "arrSpells_LB2", 1
	World.SetVariable "arrSpells_UB2", 5
End Sub

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #7 on Fri 03 May 2002 06:13 PM (UTC)
Message
Part 2:

Function InarrSpellsPointer (PointerValue)
	Dim x
	InarrSpellsPointer = False
	For x = World.GetVariable("arrSpellsPointer_LB") to World.GetVariable("arrSpellsPointer_UB")
		If MCGetArray("arrSpellsPointer", x) = PointerValue Then
			InarrSpellsPointer = True
		End If
	Next
End Function

Function IsSP (PriorityLevel)
	Dim x
	Dim Index
	Dim TempValue
	IsSP = -1
	For x = World.GetVariable("arrSpells_UB1") to World.GetVariable("arrSpells_LB1") Step -1
		Index = CStr(x) & ",4"
		TempValue = MCGetArray("arrSpells", Index)
		If CInt(TempValue) = CInt(PriorityLevel) Then
			If NOT InarrSpellsPointer(CStr(x)) Then
				IsSP = x
			End If
		End If
	Next
End Function

Sub Sort_Spell_Queue
	Dim CurrentSlot
	Dim FirstRun
	Dim Index
	Dim x
	MCDelArray("arrSpellsPointer")
	World.SetVariable "arrSpellsPointer_LB", 1
	World.SetVariable "arrSpellsPointer_UB", 1
	For x = SP_Top to SP_Bottom
		FirstRun = True
		Do
			If NOT FirstRun Then
				If CurrentSlot <> -1 Then
					Index = CInt(World.GetVariable("arrSpellsPointer_UB"))
					MCSetArray "arrSpellsPointer", CStr(Index), CStr(CurrentSlot)
					World.SetVariable "arrSpellsPointer_UB", Index + 1
				End If
			End If
			FirstRun = False
			CurrentSlot = IsSP(x)
		Loop Until CurrentSlot = -1
	Next
	If CStr(MCGetArray("arrSpellsPointer", "1")) = Empty Then
		Clear_Spell_Queue "Sort_Spell_Queue", Empty, Empty
	End If
End Sub

Sub Add_Spell (Spell, Target, CP, Priority, Echo)
	MCSetArray "arrSpells", World.GetVariable("arrSpells_UB1") & ",1", Spell
	MCSetArray "arrSpells", World.GetVariable("arrSpells_UB1") & ",2", Target
	MCSetArray "arrSpells", World.GetVariable("arrSpells_UB1") & ",3", CP
	MCSetArray "arrSpells", World.GetVariable("arrSpells_UB1") & ",4", Priority
	MCSetArray "arrSpells", World.GetVariable("arrSpells_UB1") & ",5", Echo
	World.SetVariable "arrSpells_UB1", World.GetVariable("arrSpells_UB1") + 1
	World.SetVariable "arrSpellsPointer_UB", World.GetVariable("arrSpellsPointer_UB") + 1
	Sort_Spell_Queue
	Cast_Spell "Add_Spell", Empty, Empty
End Sub

Sub Add_Spell_Manually (thename, theoutput, arrWildcards)
	Dim Arguments
	Dim Index
	Dim x
	Arguments = Split(arrWildcards(1), ", ")
	If UBound(Arguments) = 4 Then
		For x = LBound(Arguments) to UBound(Arguments)
			Index = CStr(World.GetVariable("arrSpells_UB1")) & "," & CStr(x +1)
			MCSetArray "arrSpells", Index, CStr(Arguments(x))
		Next
		World.SetVariable "arrSpells_UB1", World.GetVariable("arrSpells_UB1") + 1
		World.SetVariable "arrSpellsPointer_UB", World.GetVariable("arrSpellsPointer_UB") + 1
	Else
		World.Note "---"
		For x = LBound(Arguments) to UBound(Arguments)
			World.Note CStr(x+1) & ": " & Arguments(x)
		Next
		World.Note "---"
		World.Note "Error: 5 arguments should be provided seperated by ', ' ."
		World.Note "(Spell, Target, CP, Priority, Echo)."
	End If
	Sort_Spell_Queue
End Sub

Sub Drop_Spell_ByTarget (thename, theoutput, arrWildcards)
	Dim x
	Dim Index
	Dim TempValue
	If World.GetVariable("LastTarget") <> Empty Then
		For x = World.GetVariable("arrSpells_UB1") to World.GetVariable("arrSpells_LB1") Step -1
			Index = CStr(x) & ",2"
			TempValue = MCGetArray("arrSpells", Index)
			If TempValue = World.GetVariable("LastTarget") Then
				Index = CStr(x) & ",4"
				MCSetArray "arrSpells", Index, 0
			End If
	Next
	Sort_Spell_Queue
	End If
End Sub

Sub Reattempt_Failed_Spell (thename, theoutput, arrWildcards)
	Dim AttemptMessage
	Dim Sendline
	World.SetVariable "SkillCounter", World.GetVariable("SkillCounter") + 1
	SendLine = World.GetVariable("LastSpell")
	If World.GetVariable("LastTarget") <> Empty Then
		SendLine = SendLine & " " & World.GetVariable("LastTarget")
	End If
	Casting_True "Reattempt_Failed_Spell", theoutput, arrWildcards
	World.EchoInput = vbsTrue
	World.Send SendLine
	World.EchoInput = vbsFalse
	AttemptMessage = " failed. Attempt [" & Cstr(World.GetVariable("SkillCounter")) & "] to: " _
		& World.GetVariable("LastSpell") & " " & World.GetVariable("LastTarget")
	If World.GetVariable("InParty") Then
		World.Send "party emote" & AttemptMessage
	Else
		World.Note "You" & AttemptMessage
	End If
	World.EchoInput = vbsTrue
End Sub

Sub Cast_Spell (thename, theoutput, arrWildcards)
	Dim OutputLine
	Dim SpellSlot
	If (Not World.GetVariable("Casting")) AND (Not World.GetVariable("PauseCasting")) Then
		World.SetVariable "SkillCounter", 1
		SpellSlot = CStr(MCGetArray("arrSpellsPointer", "1"))
		If SpellSlot <> Empty Then
			World.SetVariable "LastSpell", MCGetArray("arrSpells", SpellSlot & ",1")
			OutPutLine = World.GetVariable("LastSpell")
			World.SetVariable "LastTarget", MCGetArray("arrSpells", SpellSlot & ",2")
			If World.GetVariable("LastTarget") <> Empty Then
				OutPutLine = OutPutLine & " " & World.GetVariable("LastTarget")
			End If
			Casting_True "Cast_Spell", theoutput, arrWildcards
			World.EchoInput = vbsTrue
			World.Send OutPutLine
			World.WriteLog OutPutLine
			World.EchoInput = vbsFalse
			If MCGetArray("arrSpells", SpellSlot & ",5") = 0 Then
				If World.GetVariable("InParty") Then
					World.Send "party emote is attempting: " & OutPutLine
				End If
			End If
			MCSetArray "arrSpells", SpellSlot & ",4", 0
		End If
		Sort_Spell_Queue
	End If
	World.EchoInput = vbsTrue
End Sub

' ------------------------------------------------------------
' ------------------------------------------------------------

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #8 on Fri 03 May 2002 06:21 PM (UTC)
Message

' ------------------------------------------------------------
'   SPELL PRIORITY RANKINGS - Lower numbers get cast first.
' ------------------------------------------------------------
Const       SP_Top = 1		'This constant should aways be 1.
Const    SP_HealMe = 2
Const SP_HealOther = 3
Const     SP_Bless = 4
Const   SP_Defense = 5
Const       SP_Sac = 6
Const      SP_Hide = 7
Const   SP_Offense = 8
Const      SP_Misc = 9
Const    SP_Bottom = 10		'This constant should always be highest.


' ------------------------------------------------------------
'   HEALER SPELLS
' ------------------------------------------------------------
Sub Attempt_Accelerate_Healing (thename, theoutput, arrWildcards)
	Add_Spell "accelerate healing", LCase(Trim(arrWildcards(1))), 50, SP_Bless, 0
End Sub

Sub Attempt_Attend_Wounds (thename, theoutput, arrWildcards)
	Add_Spell "attend wounds", LCase(Trim(arrWildcards(1))), 20, SP_HealOther, -1
End Sub

Sub Attempt_Cause_Wounds (thename, theoutput, arrWildcards)
	Add_Spell "cause wounds", LCase(Trim(arrWildcards(1))), 169, SP_Offense, -1
End Sub

Sub Attempt_Circle_Of_Privacy (thename, theoutput, arrWildcards)
	Add_Spell "circle of privacy", LCase(Trim(arrWildcards(1))), 140, SP_Misc, 0
End Sub

Sub Attempt_Cure_Wounds (thename, theoutput, arrWildcards)
	Add_Spell "cure wounds", LCase(Trim(arrWildcards(1))), 40, SP_HealOther, -1
End Sub

Sub Attempt_Heal_Wounds (thename, theoutput, arrWildcards)
	Add_Spell "heal wounds", LCase(Trim(arrWildcards(1))), 125, SP_HealOther, -1
End Sub

Sub Attempt_Health_Blessing (thename, theoutput, arrWildcards)
	Add_Spell "health blessing", LCase(Trim(arrWildcards(1))), 90, SP_Bless, 0
End Sub

Sub Attempt_Injure (thename, theoutput, arrWildcards)
	Add_Spell "injure", LCase(Trim(arrWildcards(1))), 10, SP_Offense, -1
End Sub

Sub Attempt_Lesser_Party_Heal (thename, theoutput, arrWildcards)
	Add_Spell "lesser party heal", LCase(Trim(arrWildcards(1))), 110, SP_HealOther, -1
End Sub

Sub Attempt_Sacred_Guardian (thename, theoutput, arrWildcards)
	Add_Spell "sacred guardian", LCase(Trim(arrWildcards(1))), 100, SP_Bless, 0
End Sub

Sub Attempt_Spherical_Healing (thename, theoutput, arrWildcards)
	Add_Spell "spherical healing", LCase(Trim(arrWildcards(1))), 150, SP_HealOther, -1
End Sub

Sub Attempt_Sober (thename, theoutput, arrWildcards)
	Add_Spell "sober", LCase(Trim(arrWildcards(1))), 50, SP_Misc, -1
End Sub

Sub Attempt_Study_Corpse (thename, theoutput, arrWildcards)
	Add_Spell "study corpse", Empty, 0, SP_Sac, -1
End Sub
' ------------------------------------------------------------
Sub Attempt_All_Bless (thename, theoutput, arrWildcards)
	Attempt_Accelerate_Healing "Attempt_All_Bless", theoutput, arrWildcards
	Attempt_Health_Blessing "Attempt_All_Bless", theoutput, arrWildcards
	Add_Spell "heal wounds", LCase(Trim(arrWildcards(1))), 125, SP_Bless, -1
End Sub
' ------------------------------------------------------------


There are still pieces of code I haven't provided, such as the subroutines that determine "InParty", and the subroutine "Display_StatusLine" which displays information on my status line. Those are not all of the healer spells above, and I have more subroutines for other guild skill\spells in my script.

As said, this script requires MANY aliases and triggers, which I have not provided here...

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #9 on Fri 03 May 2002 10:54 PM (UTC)
Message
If anyone wants to post scripts on the MUSHclient web page I can set aside an area for that, especially if you don't have access to your own web server.

Send me the file in an email along with a suitable description to be placed on a web page pointing to the script file (eg. language, installation instructions, what it does, how to use it).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


24,537 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.