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
➜ General
➜ Triggers and Scripting..
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Sun 23 Jun 2002 02:25 PM (UTC) |
Message
| Alright First off I am trying to make a trigger automaticaly get items as I walk by, This works great most the time except when the Item name gets split onto two lines.
eg.
Regimental fencing chamber.
You could progress eastwards. A trash tub sits here. There are two potion
bottles here.
Ok Now If I had a Trigger to get POTION BOTTLES Well When the word POTION is at the end of the first line and BOTTLES is at the start of the next line it does not match.
Is there a way to get MUSHClient to realize that some sentences etc. continue to the next line?
I am trying to work out a script so that When I am attacked I will automaticly drink my correct potion
They are three types of potion DARK PALE AND CLEAR they recover 80 40 and 20 Health respectivly
Colonel Garek of the Cardinal's Foot Guards takes a slash at you, hitting as
you just fail to parry.
Your health is now 88.
That is what I see when Someone attacks me So I have a max health of 124 So I want to drink the proper potion because drinking a dark potion has a 6 second recycle rate where clear only has 2 ... Problem Is When I drink potion I get...
You take a sip of clear healing draft from a potion bottle.
The healing liquid infuses you with a warm glow.
Your health is now 108.
So If I just match on the your health is line It trys to drink again when I drink the first time which creates a longer wait time because it says I cannot drink but that time is added to the previous time in which till I can drink again
Also people can feint Where it looks just like a hit but your health stays the same I don't want to drink on them either..
Colonel Garek of the Cardinal's Foot Guards lunges at you, just hitting as you
barely fail to parry.
Your health is now 124.
That's a feint...
Ok What I have for script so far is....
Sub DRINK (thename, theoutput, thewildcards)
Dim MyHealthOld
Dim MyHealth
MyHealthOld = World.GetVariable ("HEALTHOLD")
MyHealth = World.GetVariable ("HEALTH")
world.note "Health Before: " & MyHealthOld & "---" & "Health Now: " & MyHealth & "---" & "Damage Taken: " & MyHealthOld - MyHealth
If MyHealthOld = MyHealth Then
world.note "FEINT"
world.SetVariable "HEALTHOLD", MyHealth
elseif MyHealth > 103 and MyHealth < 124 then
world.note "CLEAR"
world.SetVariable "HEALTHOLD", MyHealth + 20
elseIf MyHealth > 83 and MyHealth < 104 then
world.note "PALE"
world.SetVariable "HEALTHOLD", MyHealth + 40
ElseIf MyHealth > 0 and MyHealth < 84 then
world.note "DARK"
world.SetVariable "HEALTHOLD", MyHealth + 80
End If
End Sub
Any Help would be Greatly Appreciated in theese matters, Thanks
Bill | Top |
|
Posted by
| Krenath
USA (76 posts) Bio
|
Date
| Reply #1 on Mon 24 Jun 2002 07:15 PM (UTC) |
Message
| There's no easy way to tell MUSHclient a sentence wraps to another line. The problem is the fact that MUSHclient has no way to tell if it's part of the original sentence or a totally new one.
If you have some definite pattern you can use to identify the start of a sentence and another pattern that can be used to definitely identify the end, then it's possible to create some triggers to do the following:
1. look for the beginning of a sentence and enable additional triggers if found
2. second trigger grabs all lines until the end of the sentence is found, appending the lines to a variable as it goes.
3. third trigger looks for the end of the sentence, then disables the second and third triggers and performs the required action on the completed sentence.
As far as your health goes, write a trigger that stores your health in a variable whenever it sees "Your health is now *". Then create a timer that triggers every 3 seconds and, based on the difference between your current health and your max health, decides what potion to use. You'll also want a variable to store the last potion used and the time you used it so the script can determine when the recycle rate has expired.
Such a timer/trigger combination would ensure tht you continued to heal until completely healthy, rather than healing only when damaged. |
- Krenath from
bDv TrekMUSH
ATS TrekMUSH
TNG TrekMUSE
TOS TrekMUSE | Top |
|
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Reply #2 on Mon 24 Jun 2002 09:28 PM (UTC) |
Message
| I think I kinda understand what your saying... 1 Problem is though that
Dark Potion Which recovers 80 Health Takes 6 Seconds become I can sip another potion after sipping it
Pale TAkes 4seconds
and Clear takes 2 Seconds
Well I figured... Hmm I dunno I am lost Mainly I just want a trigger that will keep me completly full on health in a fight so I will not have to worry about remember which potion to drink and typing the right kind etc. so that I can concentrate more on fighting. many people have triggers for it but they all are very very well buggy.. etc. I can easily work around them and cause them more problems than they can deal with and easily win in a fight because of it..
Hmm I will play around and see what I can get and post my code but if there was any chance you could post the code of how to do it It would be greatly appreciated
Thanks,
Bill | Top |
|
Posted by
| Shadowfyr
USA (1,790 posts) Bio
|
Date
| Reply #3 on Mon 24 Jun 2002 10:45 PM (UTC) |
Message
| Check to see if your mud has an option to turn off 'auto-wrap'. Some do, some don't.
When they don't it can be a serious pain in the backside. Mine has a similar (though less complicated) problem with channels, some of which I wanted to custom color. Took me several tries to fix it. However, your problem may not be fixable unless you can get the mud to stop wrapping the text and have mushclient handle it instead. :p | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #4 on Tue 25 Jun 2002 03:03 PM (UTC) Amended on Tue 25 Jun 2002 03:06 PM (UTC) by Magnum
|
Message
| Here's how I might do it:
First, see if you can make a trigger that grabs your FULL health automatically from the mud output, then store it in a variable. You could also create an alias to store the value manually, if you want. Maybe call the variable "HealthFull"
Trigger: Your health is now *.
Call: Health_Monitor
Sub Health_Monitor (TriggerLine, MudOutput, arrWildcards)
Dim HealthDif
World.SetVariable "HealthNow", arrWildcards(1)
HealthDif = CInt(World.GetVariable("HealthFull") - CInt(World.GetVariable("HealthNow")
If NOT World.IsTimer("PotionTimer") Then
If HealthDif > 80 Then
World.Send "drink dark"
World.AddTimer "PotionTimer", 0, 0, 6, "", 5, "Potion_Done"
ElseIf HealthDif > 40 Then
World.Send "drink pale"
World.AddTimer "PotionTimer", 0, 0, 4, "", 5, "Potion_Done"
ElseIf HealthDif > 20 Then
World.Send "drink clear"
World.AddTimer "PotionTimer", 0, 0, 2, "", 5, "Potion_Done"
End If
End If
End Sub
Sub Potion_Done (TimerName)
World.Send "What's my health?" ' *See note below
End Sub
Ideally, you would send the mud a request to show you what your current health is after you have drank a potion. You would then trigger on that new output, calling "Health_Monitor" again... looping until you are healthy enough that you do not need to drink any more potions. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | 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.
16,777 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top