Register forum user name Search FAQ

Gammon Forum

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 ➜ 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   (8 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,534 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.


10,364 views.

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

Go to topic:           Search the forum


[Go to top] top

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