Yet another package for mudlet users (alpha)

Need some help with your MUD client? Forgot your password? Get help here.
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Toferth
Wanderer
Posts: 58
Joined: 30 Jun 2017 11:27

Yet another package for mudlet users (alpha)

Post by Toferth » 12 Feb 2018 10:22

It seems these days everyone and his mother writes mudlet scripts for genesis.
I've decided to start cleaning up my stuff. Some big things are still not ported/disarmed yet (mapper for example).
Consider that "alpha preview" - you may test it on alt on separate genesis profile but do *not* try to load it on your main "script" profile.
Thanks for Syrk for his package that I used as reference and inspiration, and ZZ for convincing me to do it ;)

Warnings:
- I have not tested it on Windows (yet)
- No colors except for ovbserver (but they are so I see whether triggers match properly)
- Not very usable for now
- Do not give me your updates / bug reports yet - other comments are welcome though
- Obviously a lot of ingame information will have to be added by user (so, you will be responsible for mapping realms, adding herbs etc.) - I like my current guild ;)

For now it's preconfigured for 3 mudlet window sizes, it detects them and reorders only on mudlet startup:
<=1366x768
<=1920x1080
> (I play on 1440p)

For me it looks like that:
genesis-scripts-2018-02-11.jpg
screenshot. jpeg because png is 10kb too big. lol.
genesis-scripts-2018-02-11.jpg (229.63 KiB) Viewed 2272 times
but depending on resolution it reorganizes windows (some tabs are merged etc).

Installation:
If you're brave (or stupid) enough to install it - you may want to consult readme to learn what new aliases are there etc. For impatient:
- Unpack everything to some sane directory
- Add "genesis-bootstraper" to mudlet with priority -1
- Run genesis-bootstrap alias
- Restart mudlet

Features/Modules available now:
- Genesis - core module with various utilities
- Ui - core ui module
- Observer - module that will contain 99% of triggers. Observes mud state and generates events (say player_attacked(enemy))
- Typist - input module (for now just remaps numpad keys)
- Chat - newb chat and generic chat management
- Doctor - gauges (health etc)
- magic-map - obvious
- Warehouseman - inventory management

Pros:
- Most of "hard" code will be in .lua files, easy to inspect
Cons:
- Code is rather bulky
- There will be lots of updates and code will be even bigger ;)
Attachments
genesis-scripts-2018-02-11_2d7775d.zip
script package
(25.63 KiB) Downloaded 127 times

Zugzug
Veteran
Posts: 233
Joined: 20 May 2017 15:25

Re: Yet another package for mudlet users (alpha)

Post by Zugzug » 12 Feb 2018 16:25

Looking good! Will take this for a spin and hopefully will learn a thing or two from this!

Cheers mate :)

User avatar
morgzaash
Adventurer
Posts: 98
Joined: 13 Jul 2015 10:25
Location: Sopot, PL
Contact:

Re: Yet another package for mudlet users (alpha)

Post by morgzaash » 14 Feb 2018 21:21

Looks you're good with mudlet so got a question :
i use zmud and command i use there and the one i could not find in mudlet is : #WAIT (not #alarm).
Is there in mudet something like #wait that not just delay commands after but stops everything after it ?

User avatar
Shanoga
Wizard
Posts: 168
Joined: 03 Mar 2014 13:03
Location: US West

Re: Yet another package for mudlet users (alpha)

Post by Shanoga » 14 Feb 2018 21:37

morgzaash wrote:Looks you're good with mudlet so got a question :
i use zmud and command i use there and the one i could not find in mudlet is : #WAIT (not #alarm).
Is there in mudet something like #wait that not just delay commands after but stops everything after it ?
Hmm. I haven't seen anything in Mudlet that works quite like #WAIT (which I used in zmud years and years ago). However, I have found that I generally don't need it. I use tempTimer a lot. Something like this....

Code: Select all

sendAll("open pack","fill pack",false)
tempTimer(1, function() send("close all",false) end)
If I want run more commands afterward, I either put them inside the tempTimer or I have them trigger off of whatever the tempTimer is going to produce. I'll even use aliases to enableTrigger and disableTrigger on different things. There are ALL sorts of options.

Additionally, the post below is by Vadi, the lead Mudlet developer, on the Mudlet forums.
Vadi wrote:Some clients offer a #wait function, which will "pause" the script for a certain amount of time before allowing it to continue.

Mudlet doesn't provide that; it uses timers instead. Timers are better because they are easier to work with (they can be named/enabled/disabled), are less prone to buggy implementations (zmuds, for example, isn't great) and are more flexible.

Timers work a bit differently - instead of freezing the script for a certain amount of time, they don't freeze anything, but run a command in a certain time in the future.

So for example, a pseudocode #wait script:

Code: Select all

do something
#wait 1000
do something2
with a timer, becomes

Code: Select all

do something
set a timer for 1 second to "do something2"
Would be the basic one-to-one translation. But since timers don't freeze the script, you can create several different ones, you can disable and enable them back - which will be a very helpful thing in the future and less code for you to write.

The syntax for using a timer is like this:
tempTimer (time to wait in seconds, INSERT CODE HERE, and optionally a name)
So a nexus code of:

Code: Select all

#send jerk fish
#wait 1500
#send pull line
Would be the following in Mudlet:

Code: Select all

send ("jerk fish")
tempTimer (1.5, [[send ("pull line")]])
Since timers are created instantly, if you want two or more, or means the times for consecutive timers should be to the starting point, unlike relatives times you do with waits:

Code: Select all

#send jerk fish
#wait 1500
#send pull line
#wait 500
send jump

Code: Select all

send ("jerk fish")
tempTimer (1.5, [[send ("pull line")]])
tempTimer (2, [[send ("jump")]])
Hope that helped! Post comments/questions below.

Toferth
Wanderer
Posts: 58
Joined: 30 Jun 2017 11:27

Re: Yet another package for mudlet users (alpha)

Post by Toferth » 14 Feb 2018 22:01

They did timers because (probably) otherwise they would need to do multithreaded lua which would be PIA.
As annoying as they are, timers are rarely used. They are for weak and lazy ;)

You are expected to use event-based system (I do it that way) - so set your triggers properly.
You may want to look at my observer module (it's stub, but you'll get the idea).

Spoiler alert: mapper is coming - expect next update somewhere this week (I'm cleaning/simplyfing my mapper, also have to make demo map) ;)

Zugzug
Veteran
Posts: 233
Joined: 20 May 2017 15:25

Re: Yet another package for mudlet users (alpha)

Post by Zugzug » 15 Feb 2018 11:37

morgzaash wrote:Looks you're good with mudlet so got a question :
i use zmud and command i use there and the one i could not find in mudlet is : #WAIT (not #alarm).
Is there in mudet something like #wait that not just delay commands after but stops everything after it ?
There is a command-queue script that I've found, creases a "queue" alias.
so you can do

Code: Select all

q 1, say one, 1, say two, 2, say four
and this will delay first say by 1 second, put in 1 second interval between one and two and put in 2 second interval between two and four.

User avatar
morgzaash
Adventurer
Posts: 98
Joined: 13 Jul 2015 10:25
Location: Sopot, PL
Contact:

Re: Yet another package for mudlet users (alpha)

Post by morgzaash » 15 Feb 2018 16:45

Thanks but i don't see possibility to tempTimer after unknow time.
I want to do something like :

Code: Select all

WaitForShip  /unknow time, i just wait until it comes, set in, and then run rest after i disembark
go_path        /simple path
do_something 
#wait 2000 /my do_something starts a command that allow me to move on after 1-2 seconds without visible info thats it's ready
do_more /like kill - unknown time
path_back
#wait 2000 /need to wait - without it item of mine will be destroyed
WaitForShip
As you see there's few point where i cannot set time and looks like mudlet needs all times from the moment of script start.
So, thanks for your help but I'll stay with zmud i guess :)

Toferth
Wanderer
Posts: 58
Joined: 30 Jun 2017 11:27

Re: Yet another package for mudlet users (alpha)

Post by Toferth » 15 Feb 2018 18:13

You can chain them.
Also for ships you *don't* need timer ;)

User avatar
Shanoga
Wizard
Posts: 168
Joined: 03 Mar 2014 13:03
Location: US West

Re: Yet another package for mudlet users (alpha)

Post by Shanoga » 15 Feb 2018 18:17

morgzaash wrote:Thanks but i don't see possibility to tempTimer after unknow time.
I want to do something like :

Code: Select all

WaitForShip  /unknow time, i just wait until it comes, set in, and then run rest after i disembark
go_path        /simple path
do_something 
#wait 2000 /my do_something starts a command that allow me to move on after 1-2 seconds without visible info thats it's ready
do_more /like kill - unknown time
path_back
#wait 2000 /need to wait - without it item of mine will be destroyed
WaitForShip
As you see there's few point where i cannot set time and looks like mudlet needs all times from the moment of script start.
So, thanks for your help but I'll stay with zmud i guess :)
Okay, so I have an alias to wait for a ship. When I type my alias, the code actually does

Code: Select all

enableTrigger("Auto-Board")
Then I separately have a trigger named Auto-Board Ship that looks for this perl regex pattern:

Code: Select all

^(?:> )?(Ferundi|Hull|Sutec|Cetus|The (.*)) (say|says|mumbles|rumbles|roars|squeaks|whispers|bellows|yells|chirps|chatters|thunders|shout|shouts|ask|asks|
sings|incants|murmurs|ponders|hints|tells|replied|booms|blurts|shrieks|hisses|squeals|howls|snarls|coos|announces): Buy your tickets (now )?or stay ashore\!$
On a match it executes the following:

Code: Select all

if gmcp.room.info.id == "qmYuP1" then
	sendAll("buy ticket","buy ticket","board ship",false)
else
	sendAll("open money-sack","get coins from money-sack",false)
	expandAlias("bt",false)
	tempTimer(.25,function() send("board ship",false) expandAlias("pcp",false) enableTrigger("Auto-Disembark") end)
	closeAll()
end
disableTrigger("Auto-Board")
In the middle there you can see that I

Code: Select all

enableTrigger("Auto-Disembark")
which sets up the following:

Code: Select all

send("leave ship",false)
disableTrigger("Auto-Disembark")
This gives you the exact same funtionality of the WaitForShip idea that you mentioned and doesn't really use timers or waiting.


If you are wanting to execute that entire block of code at once I am sure it could be done. Paths are easy. Repeated actions every 1-2 seconds are easy with tempTimers. Enabling the auto-board stuff can be done at the end of your path back. Mudlet can definitely do all of it. :)

Toferth
Wanderer
Posts: 58
Joined: 30 Jun 2017 11:27

Re: Yet another package for mudlet users (alpha)

Post by Toferth » 15 Feb 2018 19:52

You setup ship triggers on ship arriving, not npc talking otherwise someone can foul you.
Same for arrival.

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/