Gammon Forum
Entire forum
MUSHclient
General
Modular, sane programming - how?
Modular, sane programming - how?
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Fearless
(4 posts) bio
|
Date
| Sun 28 May 2017 09:23 PM (UTC) |
Message
| I need advice. I can't figure out the strategy to get modular, sane programming into MUSHclient. Much of what I want to do involves waiting for text or time to pass before continuing the logic. Chasing triggers around in circles is a logical nightmare.
I've seen the 'require "wait"' thing. Using it in an alias works as described but then calling that alias while inside some other script makes it lose the "waiting" feature.
My script section for my testwait alias is this, and it works:
require "wait"
wait.make (function ()
Send ("test1")
wait.time (4)
Send ("test2")
end)
My script section for my testmodular alias is this:
Note("running alias w/ wait...")
Execute("testwait")
Note("alias w/ wait done...")
The testmodular alias displays both notes before testwait sends anything. Clearly, I can't use something like testwait as a modular procedure to help me build a complex program until I fix something, but what? | top |
|
Posted by
| Fiendish
USA (2,514 posts) bio
Global Moderator |
Date
| Reply #1 on Sun 28 May 2017 09:32 PM (UTC) Amended on Sun 28 May 2017 09:41 PM (UTC) by Fiendish
|
Message
| Your "wait.make (function ()...end)" needs to encompass everything that you want to have happen in order with delays in between, including those two outer notes.
Think of it sort of like creating a second lane in the instruction processing highway instead of having only one. Everything on the outside is in one lane, everything on the inside is in the other lane. The inner lane gets to stop moving and relax as much as it wants. The outer lane has to go go go and doesn't get to stop moving.
Quote: modular, sane programming
I think you might benefit from looking up techniques for implementing state machines. |
https://github.com/fiendish/aardwolfclientpackage | 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.
9,386 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.