View unanswered posts | View active topics It is currently 23 Jun 2018 06:39

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.



Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Yet another package for mudlet users (alpha) 
Author Message
Apprentice

Joined: 30 Jun 2017 11:27
Posts: 47
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:
Attachment:
File comment: screenshot. jpeg because png is 10kb too big. lol.
genesis-scripts-2018-02-11.jpg
genesis-scripts-2018-02-11.jpg [ 229.63 KiB | Viewed 459 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:
File comment: script package
genesis-scripts-2018-02-11_2d7775d.zip [25.63 KiB]
Downloaded 20 times
12 Feb 2018 10:22
Profile
Adept

Joined: 20 May 2017 15:25
Posts: 121
Looking good! Will take this for a spin and hopefully will learn a thing or two from this!

Cheers mate :)


12 Feb 2018 16:25
Profile
Adventurer
User avatar

Joined: 13 Jul 2015 10:25
Posts: 93
Location: Sopot, PL
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 ?


14 Feb 2018 21:21
Profile WWW
Wizard
User avatar

Joined: 03 Mar 2014 13:03
Posts: 129
Location: US West
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:
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:
do something
#wait 1000
do something2

with a timer, becomes
Code:
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:

Quote:
tempTimer (time to wait in seconds, INSERT CODE HERE, and optionally a name)


So a nexus code of:

Code:
#send jerk fish
#wait 1500
#send pull line

Would be the following in Mudlet:
Code:
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:
#send jerk fish
#wait 1500
#send pull line
#wait 500
send jump

Code:
send ("jerk fish")
tempTimer (1.5, [[send ("pull line")]])
tempTimer (2, [[send ("jump")]])

Hope that helped! Post comments/questions below.


14 Feb 2018 21:37
Profile
Apprentice

Joined: 30 Jun 2017 11:27
Posts: 47
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) ;)


14 Feb 2018 22:01
Profile
Adept

Joined: 20 May 2017 15:25
Posts: 121
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:
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.


15 Feb 2018 11:37
Profile
Adventurer
User avatar

Joined: 13 Jul 2015 10:25
Posts: 93
Location: Sopot, PL
Thanks but i don't see possibility to tempTimer after unknow time.
I want to do something like :
Code:
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 :)


15 Feb 2018 16:45
Profile WWW
Apprentice

Joined: 30 Jun 2017 11:27
Posts: 47
You can chain them.
Also for ships you *don't* need timer ;)


15 Feb 2018 18:13
Profile
Wizard
User avatar

Joined: 03 Mar 2014 13:03
Posts: 129
Location: US West
morgzaash wrote:
Thanks but i don't see possibility to tempTimer after unknow time.
I want to do something like :
Code:
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:
enableTrigger("Auto-Board")
Then I separately have a trigger named Auto-Board Ship that looks for this perl regex pattern:
Code:
^(?:> )?(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:
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:
enableTrigger("Auto-Disembark")
which sets up the following:
Code:
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. :)


15 Feb 2018 18:17
Profile
Apprentice

Joined: 30 Jun 2017 11:27
Posts: 47
You setup ship triggers on ship arriving, not npc talking otherwise someone can foul you.
Same for arrival.


15 Feb 2018 19:52
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.