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

Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Modular, sane programming - how?

Modular, sane programming - how?

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

Posted by Fearless   (8 posts)  [Biography] bio
Date Sun 28 May 2017 09:23 PM (UTC)
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")

My script section for my testmodular alias is this:
Note("running alias w/ wait...")
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?
[Go to top] top

Posted by Fiendish   USA  (2,520 posts)  [Biography] 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

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.

modular, sane programming

I think you might benefit from looking up techniques for implementing state machines.

[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.


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.


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 HostDash]