[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Building System for Midkemia Online
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Building System for Midkemia Online

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


Posted by Ameroth   (4 posts)  [Biography] bio
Date Sat 09 Jun 2012 01:19 AM (UTC)
Message
Hi, I am Ameroth from Midkemia and I have just embarked on building a complete fighting system using lua for Midkemia an Iron Realms MUD that features a fairly unique combat system. As it stands the game community currently provides a good complete combat system for the client Mudlet that about 90% of the playerbase use. I would like to build a system that can be competitive with this free system that will hopefully diversify the pvp landscape slightly rather than having everyone on the exact same client and system. I believe MUSHclient is an excellent client that will enable me to create something competitive with the free system. Having used Mudlet since I started playing, I am not that familiar with MUSHclient and am running into many syntax errors and other simple mistakes. I have a rough idea of how I would like my system to function but I believe I will require assistance in order to complete it within a reasonable timeframe. I am hopeful that the MUSHclient community will be able to help.

As MKO is a game that supports GMCP, I have installed the plugin and will be using GMCP to track things like health and endurance. Midkemia essentially uses a system of four balances, which are Balance, Equilibrium, Inner Focus, and Overdrive. Balance is used for attacks and certain actions, while equilibrium is used for defences and certain other actions, inner focus removes an affliction from the player and depending on the type of affliction you either focus body, mind or spirit and it cures a random affliction of that type and then has a delay before it can be used again. Overdrive converts adrenaline generated during fighting into extra health, and is for healing purposes.

I have a number of things I would like pointers on and advice with:

1. I essentially want to update a variable from my prompt that will say whether I have balance or not. (This cannot be found in GMCP)

My prompt is as shown below

<PROMPT>840h, 120e, 0g xb A:50% -</PROMPT>

If x is present equilibrium should be true and if b is present balance should be true, if they are not present the variables should be set to false. I have looked at some examples of code on this, but I can't seem to get mine to work.

2.My second question concerns how I wish to go about defending in Midkemia.

I would like to make a trigger for defences that works in the following way:

If my equilibrium is true, I would like to make a value in the following way
Variable= = ("Base [the time for the slowest version of the attack possible]" x "Speed [a variable that will be set to match the current target's value which will be the factor to multiply the base value to reduce the time of the defence i.e. it will be a fraction" x "Anach, which will be a value on certain attacks that have been sped up using an ability it will also be a fraction" - Timewarp/Censure [if there is no timewarp or censure this value will be zero if not it will be 1 which is the retardation speed])
Once I have this variable captured and it is not a negative (which it could be if timewarped) I would like to use it with a timer that will send("defence e.g. jump") after that time. If it is negative I would like it to do nothing.

If my equilibrium is not true at the time the trigger fires which is quite likely I would like it to start a timer that captures the time from that point up until equilbrium is regained, the value from this timer would then be subtracted from the same value calculated above and that then used to send("defence"). Thus ensuring defending times are accurate. Again if the value comes out negative I would like it to do nothing.

Would anyone know the tidiest way of doing this, equilibrium can be detected from the prompt and there is also a line sent by the server when it is regained.

3. As there is stupidity in MKO, that can cause commands to fail without loss of balance, I would like to know what is the easiest way to resend the last line (or possible two lines) of text sent as output.

[Go to top] top

Posted by Ameroth   (4 posts)  [Biography] bio
Date Reply #1 on Sat 09 Jun 2012 01:19 AM (UTC)
Message
4. The fighting in Midkemia is based on afflictions which are on of three mental, physical or spiritual. Each affliction is cured using Focus Body or Focus Mind or Focus spirit which relies on a single Focus Balance, and will cure one random afflicition of that type from the user. Afflictions all have trigger lines for the time of affliction and the time of curing and there is also a diagnosis function which allows you to check what afflictions you currently have in case of blackout (which blocks all server information except GMCP for a limited time).

How I would like to go about curing is to have a variable for each affliction that is set to true or false. Based on aff cure and diagnosis lines. I would also like to store information on each affliction in terms of what is needed to heal it and also a number for the priority of healing with the lowest number being healed first. If I have any afflictions I would like it to cure according to this information. Eg if blindness was a physical affliction with priority two, and ill_omen was a spiritual affliction with priority five and I had both it would send focus body rather than focus spirit. I am not sure what the cleanest way to go about this is. Also hopefully there would be an easy way to set all afflictions to false and vice-versa.

This is how I would like all normal afflictions to be treated, however it becomes slightly more complicated due to three afflictions that prevent focusing of a particular type. Impatience (itself a spirit affliction) prevents focus body, epilepsy (itself a mental affliction) prevents focus spirit, and concussion (itself a physical affliction) prevents focus mind. If you get all three afflictions you are unable to heal and you generally speaking die. Affliction locking is a popular method of killing someone in MKO. These would complicate my healing script slightly and I was wondering if people would have any suggestions on how to treat them.

If I can get these things to work I am well on my way. Any help would be greatly appreciated and if possible please go into as much detail as possible in terms of code as I am relatively new to this client and a somewhat inexperianced coder.
[Go to top] top

Posted by Ircria   (24 posts)  [Biography] bio
Date Reply #2 on Sat 09 Jun 2012 02:47 PM (UTC)
Message
Ameroth said:

1. I essentially want to update a variable from my prompt that will say whether I have balance or not. (This cannot be found in GMCP)


You will want to make a regex to match your prompt and wrap what you want to capture in ( and ) to have it show as a backreference, which you can access in your trigger from %<br number>. There are several tutorials on PCRE on the internet, but from the prompt you offered below, ^\d+h, \d+e, \d+g (\w+) A\:50\% \-$ should work for you. I know there are several topics about regular expressions for prompt regexes on the Midkemia forums as well. Just make sure you have Regular Expression checked in the trigger. Also, as it is an IRE game, you might find "Convert IAC EOR/GA to Newline" under the output (Alt+5) menu useful, as your prompt will likely not match until the line after otherwise.

Ameroth said:

2.My second question concerns how I wish to go about defending in Midkemia.
3. As there is stupidity in MKO, that can cause commands to fail without loss of balance, I would like to know what is the easiest way to resend the last line (or possible two lines) of text sent as output.


Question two, I'm having a bit of issue reading your specifications, so I'll answer that later if I can manage it.

Question three, I have the same issue in Lusternia as well. The way I overcame it is marking that I tried a balance without losing it that prevents that balance from being used, and having a timer reset that tried-state after 1-1.5 seconds if it fails so the action can be retried. There are many ways of doing this other than a tried-state, but you will find that that is one of the more common ways of overcoming that issue.

Ameroth said:

4

This is a common issue for most Iron Realms games, including Midkemia. Assuming you're using Lua (though this can easily be changed to fit other languages), have a table of afflictions set to (true/false, 1/0, et cetera). On prompt, you can run a function that checks if you have certain afflictions, and if you don't, cycles through the table of afflictions and cures them in a certain order if you have them.

for example (in Lua. I do not recommend using this code in your system, but the concept may help you):
affTable = {stupidity = false, concussion = false}

function cureFocus()
  if affTable["concussion"] and balTable["focus"] == 1 then
    return
  end
  if affTable["stupidity"] == true then
    Send("focus mind")
  end
end


If I may make a recommendation: These questions have been asked dozens of times before, both on this forum and on the forums of games made by the company who makes Midkemia (and including the forums of Midkemia). The search function on all of these will likely lead you to threads that ask and have answered the same questions, and likely to code of other people's systems and scripts that you can go through and study to understand the basic methods many, if not all, of these systems and scripts use to solve these problems.
[Go to top] top

Posted by Ameroth   (4 posts)  [Biography] bio
Date Reply #3 on Sat 09 Jun 2012 09:42 PM (UTC)
Message
Thanks for the help Ircria,

I have managed to resolve all of my issues by looking through the forums as you recommended except one, which I can't seem to find.

What I am looking for is essentially the equivalent of Stopwatches in Mudlet.

I would like to do the following

Trigger Line: ^Raelyr start slash you.$

If "equilibrium" = false then
It starts a timer (as accurate a timer as possible)

Then another trigger line comes in:
^You regain defensive equilibrium.$
At this point I would like it to stop the timer and save the value that the timer had in a new variable that can then be used in a script or trigger.

Would anyone know how to do this?
[Go to top] top

Posted by Ameroth   (4 posts)  [Biography] bio
Date Reply #4 on Sat 09 Jun 2012 10:57 PM (UTC)
Message
So I checked the forums and can't seem to find a way of easily triggering my system to send the last line that I input.

Say I did, the following command:

Slash Tora,

Then due to the affects of an affliction I got sent
"You babble like an idiot",

I need to resend the command, depending on the affliction possibly with a slight delay as well for which I could use DoAfter.

What is the quickest and cleanest way of resending the last command output?

[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #5 on Sun 10 Jun 2012 (UTC)
Message
The system I used to use for Aetolia (which I haven't played for 5+ years) had a generic system to deal with repeating commands. An OnPluginSent handler added the stuff into a list, and if I saw something happen that was in that list I acted on missed commands and/or removed everything upto it, depending on the exact situation. Other parts of my system would simply register themselves with 'reset' routines in case a command was missed.

It also allowed me to deal with a 'stupidity' affliction, which changed the first word of your command. For example, 'kick kelly' might become 'love kelly'. Or 'afflict kelly with idiocy' might come out as 'say kelly with idiocy'. In the end, I was capable of extracting in quite a bit of detail which commands were missed, substituted or otherwise prevented from working.
[Go to top] top

Posted by Ircria   (24 posts)  [Biography] bio
Date Reply #6 on Sun 10 Jun 2012 04:16 AM (UTC)
Message
Ameroth said:

I would like to do the following

Trigger Line: ^Raelyr start slash you.$

If "equilibrium" = false then
It starts a timer (as accurate a timer as possible)

Then another trigger line comes in:
^You regain defensive equilibrium.$
At this point I would like it to stop the timer and save the value that the timer had in a new variable that can then be used in a script or trigger.

Would anyone know how to do this?


Not sure I'm understanding this correctly. You want a timer that counts forward instead of backward? MUSHclient can't do that, but if you just need the time between them, you don't need one.

On the first trigger, set a variable with the value of os.clock()


slashTime = os.clock()


On the second trigger, you can do this:

if slashTime then
  diffTime = os.clock() - slashTime
  slashTime = nil
end

(This assuming you use Lua, of course).

As for the last command stuff, I recommend just saving the last command you sent in a variable (Worstje covers a method for that well enough with his OnPluginSent handler. There are other ways, but that is probably the simplest).
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #7 on Sun 10 Jun 2012 07:19 AM (UTC)

Amended on Sun 10 Jun 2012 07:20 AM (UTC) by Worstje

Message
I wouldn't say it is the simplest, but it is definitely the most efficient and desireable. Aliases might not be called for a multitude of reasons (world.Send() is one of them, other triggers without Keep Evaluating being evaluaed before yours is another.. and I'm pretty sure there's other situations still too) and as such you cannot depend on them. The OnPluginSent method works no matter what other plugins you have installed, which fits the task at hand of 'knowing what I have tried to do' exactly.

Sure, you can do it in different ways, but you'll end up re-inventing the wheel each time you need to figure out how to deal with your input not happening. :)

Besides that, aye: Ircria's code is pretty common in these sorts of situations, although most people abstract it a bit. For example, I'd go for something like this (implementation I leave to your imagination):

-- Global variable my_timer

my_timer = Timer(2.5)

-- In your prompt trigger ...
if Elapsed(my_timer) then
  -- Act on your timer.
  -- Then nil it so you don't check it again.
  my_timer = nil
end


In this case I pre-determine to check only every 2.5 seconds. Depending on your needs and tastes, you might prefer to instead pass the interval to the Elapsed() function.
[Go to top] 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.


5,125 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]