Hello all, I need help setting up triggers so that when they go off they check first for herb/salve balance before eating/drinking the cure. I've heard this has been done alot for Zmud, but the posts I've seen confused me a little, if someone can show me how to set it so that it checks before using the cure I'd appreciate it, thanks!
Best thing to do is to use scripting either through the main script file or in a plugin. Here's an example script in Python, with comments:
from time import clock
class Balance(object):
""" This is the main balance class. All types of balances
(herb, salve, tree, focus, etc.) can be derived from it. """
def __init__(self, timer):
""" This is called when a new balance is created. We set the
initial state for the given balance to True, and supply the timer
period for the balance - the time it takes to recover this balance.
herbBalance = Balance(2.0)"""
self.state = True
self.timer = timer
self.offTime = clock()
def __setattr__(self,name, value):
""" This is for internal use only, it is called when the value of self.state
is changed """
if name == "state":
if value:
object.__setattr__(self, name, value)
if globals().has_key("CureAfflictions"):
CureAfflictions()
else:
if self.state:
self.offTime = clock()
object.__setattr__(self, name, value)
def CheckTime(self):
""" Checks how much time has passed since the balance's been set False,
if it's been longer than self.timer then we set it back to True. This method
if for internal use only, you'll never have to use it """
if (clock() - self.offTime) >= self.timer:
return True
else:
return False
def TimerExpired(self):
""" Called to figure out whether the balance timer has expired """
if not self.state:
self.state = self.CheckTime()
#Create a herb balance
herbBalance = Balance(2.0)
#Create a list to hold afflictions you have
afflictions = []
def SaveAffliction(name, value):
""" This can be called by triggers to set/reset afflictions. To set an affliction use:
SaveAffliction("curare", 1)
To reset it:
SaveAffliction("curare", 0) """
global afflictions
if value:
if name not in afflictions:
afflictions.append(name)
else:
if name in afflictions:
afflictions.remove(name)
def CureAfflictions():
""" Call this to cure afflictions according to priority or just how they appear in the
list. """
global afflictions, herbBalance
#If we have herb balance then cure prioritized
if herbBalance.state:
if "curare" in afflictions:
world.Send("outr bloodroot")
world.Send("eat bloodroot")
#set herb balance false
herbBalance.state = False
elif "aconite" in afflictions:
world.Send("outr goldenseal")
world.Send("eat goldenseal")
#set herb balance false
herbBalance.state = False
Then from your affliction triggers you could send to Script, and send
SaveAffliction("aconite", 1)
to note that you now have stupidity, and
SaveAffliction("aconite", 0)
to note that you are no longer stupid. The only other thing you'll need is either a prompt trigger or a plugin with OnPluginPartialLine event defined, either of these should call the TimerExpired method for each balance object, i.e. like this:
herbBalance.TimerExpired()
As long as the CureAfflictions function can recognize all the afflictions by name, and you have triggers for all afflictions, the script will take care of all the gruesome details automatically by curing whatever you have when you have a corresponding balance.
Is all that actually how it looks or was that just a global example? For the triggers I posted earlier, can you show me what that would look like when done in Python as you have said?
Given that Stupidity is known as "aconite" in your script. The affliction is saved in a list by the SaveAffliction function, but is actually cured by the CureAfflictions one, so that's where you'll need to add more afflictions to be cured at.
Hm, I don't know, do a forum search for it, otherwise if someone remembers they could post it... It wasn't long ago, although I may be totally off and it could have been something different... Maybe look at the plugins page, it should be there.
Try doing a forum search using keywords based on the afflictions or their cures. For example, there are quite a few results if you search the forums for "goldenseal".
Hmm, this thread seem relevant, don't know if his plugin does what you want...
As yet, there's no plugin for healing these affliction MUDs, I'm working on one right now though. The repetitive postings on this subject is starting to drive me nuts too. I've never done a real plugin before, but if it passes muster, I'll submit it. Hopefully it'll stem the "How do I make herb balance" tide.
Of got a kind of "beta" version of the "herb balance" plugin. When I try it, it seems to work well, but I don't know about other people. I have one other person testing it right now, but he's been delayed a bit. Would it be possible to submit this plugin? I could then post on a few boards related to Aetolia and see if anyone else would be willing to download it and test it. If it's alright to submit works in progress, where do I submit it to?
Most are his own, but there are a few by other authors. In order to get him to a host a plugin for you, you would have to use the form on his contacts page to send him a message. If he is interested (and likely would be), he will respond via Email, and tell you that you can reply and attach the plugin file to that reply Email.
This can be somewhat combersome for works in progress that may require frequent updating.
As of this posting, Nick does not have any automated method of submitting [updated] plugins for hosting.
So... if you can build your own web page somewhere, then it may be advisable to do that, and host your own plugins there, and provide a link personally to friends. You could also publish the link in your signature like I do.
If you are unable to build your own web page anywhere, then I would be willing to host the file for you on my webpage. See what I have now for current examples of how I do that. (URL is in my sig.)
Still, you would be relying on me to accept your Email, then FTP the stuff up to my website. As Shadowfyr will acknowledge, sometimes it can take me a couple of days to getting around to do this... Heh. So, best bet is host it yourself somewhere if you can. At least for now.
I am reminded of web sites for popular games, where visitors can upload game maps for usage by other players. Such sites usually have a setup where the uploaded maps are available immediately to other visitors. Perhaps one day Nick may be able to arrange a similar setup, except for plugins.
If someone has a static IP, and feels like running MC (perhaps on a seperate computer), someone could wip up a chat plugin to allow plugins to be transferred like that. (an automated plugin where you connect, and upload your plugin, download others, etc).
I guess then someone could mirror it to a webpage occassionally too (or, with scripts, could update the webpage immediately).
Alright, I'm slow, but I finally got my password issues with my ISP worked out and have access to my own webspace. Here's the plugin address: http://home.cogeco.ca/~tchristensen38/Aetolia_affliction_healer.xml
This is still a work in progress. It's designed for Aetolia, but, with some simple modding, it could be made to work on any IRE MUD. I'd love any feedback anyone has. I'm actually a little proud of it, though I imagine there will be some bugs in it. As those get submitted to me, I will try to make updates.
If anyone feels so inclined and wants to look at the scripting and so on and tell me if there's any way to make things more parsimonious, I'd love that. I'm all for parsimony in scripting.
Please send any questions, bugs, via the forum's "e-mail this user" function. Take care all.
I get this error when trying to load a script with my Sub's for the triggers....
Error number: -2146827256
Event: Execution of line 1 column 1
Description: Invalid character
Line in error:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fcharset0 Courier New;}{\f3\fswiss\fcharset0 Arial;}}
Called by: Immediate execution
When I loaded the vbs file, mushclient added that whole part itself for some reason to the beggining of it.
Open it up in a text editor. Looks like RTF stuff.
Are you sure you saved it as vbs? (You might think you saved it as vbs, but it actually had something else appended to the end, if you have file extensions hidden, youll have to get creative with opening/saving, and you might see "script.vbs" but in reality its "script.vbs.rtf" or whatever)
But yeah, see if you cant delete the extra stuff (or just make a new file) in a text editor (not word, and not wordpad, notepad if nothing else, or MCs notepad).
ok, did it in Notepad and didn't get that error...now I'm getting this one and whenever I try something that does script I get a big red pop up that says my script is not enabled...even though it is...
Error number: -2146827276
Event: Execution of line 57 column 5
Description: Expected 'If'
Line in error:
end Sub
Called by: Immediate execution
following is the first part of the script I made, it's based on the one in this post earlier.
Sub herbhealing (a, b, c)
Dim value, spell, anorexia, aeon
anorexia = world.getvariable ("affliction_anorexia")
aeon = world.getvariable ("affliction_aeon")
If aeon = "on" Then
Exit Sub
If anorexia = "on" Then
Exit Sub
End If
For Each v In world.GetVariableList
value = world.GetVariable (v)
If Left (v, 11) = "affliction_" Then
spell = Mid (v, 12)
If value = "on" Then
Select Case spell
Case "stupidity" world.sendpush "eat pennyroyal"
Case "slickness" world.sendpush "eat calamus"
Case "paralysis" world.sendpush "eat kombu"
Case "confusion" world.sendpush "eat pennyroyal"
case "epilepsy" world.sendpush "eat kombu"
Case "dizziness" world.sendpush "eat kombu"
Case "recklessness" world.sendpush "eat horehound"
Case "justice" world.sendpush "eat reishi"
Case "paranoia" world.sendpush "eat pennyroyal"
case "hallucinations" world.sendpush "eat pennyroyal"
case "generosity" world.sendpush "eat galingale"
case "claustrophobia" world.sendpush "eat wormwood"
case "vertigo" world.sendpush "eat myrtle"
Case "dementia" world.sendpush "eat pennyroyal"
case "clumsiness" world.sendpush "eat kombu"
case "agoraphobia" world.sendpush "eat wormwood"
case "peace" world.sendpush "eat reishi"
Case "hemophilia" world.sendpush "eat yarrow"
Case "lethargy" world.sendpush "eat yarrow"
Case "relapsing" world.sendpush "eat yarrow"
Case "arteries" world.sendpush "eat yarrow"
Case "healthleech" world.sendpush "eat horehound"
Case "dissonant" world.sendpush "eat horehound"
Case "addiction" world.sendpush "eat galingale"
Case "gluttony" world.sendpush "eat galingale"
Case "rigormortis" world.sendpush "eat marjoram"
Case "torn" world.sendpush "eat marjoram"
Case "vapors" world.sendpush "eat kombu"
Case "nerves" world.sendpush "eat kombu"
Case "hypochondria" world.sendpush "eat wormwood"
Case "vestiphobia" world.sendpush "eat wormwood"
Case "sensitivity" world.sendpush "eat myrtle"
Case "weakness" world.sendpush "eat marjoram"
Case "lovers" world.sendpush "eat galingale"
Case "deafness" world.sendpush "eat faeleaf"
Case "blindenss" world.sendpush "eat faeleaf"
End Select
Exit Sub
End If
End If
Next
End Sub if
Sub stupidityon (a, b, c)
world.setvariable "affliction_stupidity", "on"
anorexia = world.getvariable ("affliction_anorexia")
aeon = world.getvariable ("affliction_aeon")
If aeon = "off" Then
If anorexia = "off" Then
world.sendpush "eat pennyroyal"
End If
end Sub
Sub stupidityoff (a, b, c)
world.setvariable "affliction_stupidity", "off"
End Sub
-------------------
this is just the beggining...please tell me what I've done wrong here if anything, thanks
Is that if there a copy error?
Also, which line is 57? Is there anything above this in the file?
If it says your script isnt enabled, enable it, save the world, close it, and reopen it (maybe restart MC, if you feel like it). And see if its still enabled.
You can go check the world file if its enabled. It should be. If its not in the world file, add it. Since it could be an issue with saving the world file with the enabled set.
Although I highly doubt that.
ack, where I placed that "if" was line 57..forgot to mention that...I checked and everything is enabled it said. I saved the world and restarted everything and it still says I dont have script enabled. minus that stupidityon/off Sub, can you show me how that first Herbhealing Sub is supposed to go? Thanks again
YIPPY!! I figured out the errors..and my afflictions get healed..but when I get herbbalance back it's not curing my left over afflictions like it should...following is the "herbhealing" Sub...if anyone can tell me what I may be doing wrong, thank you
Sub herbhealing (a, b, c)
Dim value, spell, anorexia, aeon
anorexia = world.getvariable ("affliction_anorexia")
aeon = world.getvariable ("affliction_aeon")
If aeon = "on" Then
Exit Sub
If anorexia = "on" Then
Exit Sub
End If
For Each v In world.GetVariableList
value = world.GetVariable (v)
If Left (v, 11) = "affliction_" Then
spell = Mid (v, 12)
If value = "on" Then
Select Case spell
Case "stupidity" world.sendpush "eat pennyroyal"
Case "slickness" world.sendpush "eat calamus"
Case "paralysis" world.sendpush "eat kombu"
Case "confusion" world.sendpush "eat pennyroyal"
case "epilepsy" world.sendpush "eat kombu"
Case "dizziness" world.sendpush "eat kombu"
Case "recklessness" world.sendpush "eat horehound"
Case "justice" world.sendpush "eat reishi"
Case "paranoia" world.sendpush "eat pennyroyal"
case "hallucinations" world.sendpush "eat pennyroyal"
case "generosity" world.sendpush "eat galingale"
case "claustrophobia" world.sendpush "eat wormwood"
case "vertigo" world.sendpush "eat myrtle"
Case "dementia" world.sendpush "eat pennyroyal"
case "clumsiness" world.sendpush "eat kombu"
case "agoraphobia" world.sendpush "eat wormwood"
case "peace" world.sendpush "eat reishi"
Case "hemophilia" world.sendpush "eat yarrow"
Case "lethargy" world.sendpush "eat yarrow"
Case "relapsing" world.sendpush "eat yarrow"
Case "arteries" world.sendpush "eat yarrow"
Case "healthleech" world.sendpush "eat horehound"
Case "dissonant" world.sendpush "eat horehound"
Case "addiction" world.sendpush "eat galingale"
Case "gluttony" world.sendpush "eat galingale"
Case "rigormortis" world.sendpush "eat marjoram"
Case "torn" world.sendpush "eat marjoram"
Case "vapors" world.sendpush "eat kombu"
Case "nerves" world.sendpush "eat kombu"
Case "hypochondria" world.sendpush "eat wormwood"
Case "vestiphobia" world.sendpush "eat wormwood"
Case "sensitivity" world.sendpush "eat myrtle"
Case "weakness" world.sendpush "eat marjoram"
Case "lovers" world.sendpush "eat galingale"
Case "deafness" world.sendpush "eat faeleaf"
Case "blindenss" world.sendpush "eat faeleaf"
End Select
Exit Sub
End If
End If
Next
end if
end sub
Hey everyone,
Coming across Ked's example script put me on a good start but the Save affliction fuctions isnt working for me. Whenever I set the trigger of nothing happens. Anyone lend me some assistance please?