All of mudlet

... A place to ask for help on any topic whether it be starting out to player killing to IT issues.
jasmin
Posts: 242
Joined: Sun Dec 27, 2015 3:53 am

Re: All of mudlet

Post by jasmin » Mon Jul 25, 2016 10:49 am

Jomin/Slyven

Could really use some help if you can mudmail me :)

I'm working on a set of aliases/triggers as a timer that acts as a tick timer each tick

Various words will trigger this (i.e. Your heartbeat calms down as you..)

However not every tick has one of these except in certain zones,

So I tried to get around it by creating a tick timer, that gets started by the same command I have starting my triggers. 62 seconds later its to start the whole thing again.

Great. Works a treat.. Except I can't figure out how to get the new timer to cancel itself (or how to cancel a timer from within triggers or aliases) and then recall itself.

i.e. any time I don't have a command go off that resets the timer to the correct mud time, I would like it to reset after 62 seconds, but if a command triggers it, then the reset should be cancelled and set back to 62 seconds from that time.

What I'm finding is the trigger doesn't update or cancel, and even if its only out by half a second,.. within 4-5 tics this becomes significant.

Happy to send screenshots etc. on skype or by email if you PM me, otherwise let me know what else you need to know?

Any information would be highly appreciated.

GroderickMashin
Posts: 33
Joined: Mon Mar 23, 2015 3:52 pm

Re: All of mudlet

Post by GroderickMashin » Mon Jul 25, 2016 1:05 pm


jasmin
Posts: 242
Joined: Sun Dec 27, 2015 3:53 am

Re: All of mudlet

Post by jasmin » Tue Jul 26, 2016 12:39 am

Yep, I've been reading that, and pulling things out and trying them - but what it boils down to is I don't understand any of what I'm doing and totally don't get any of the examples on that guide.
Thanks for the link but I can't seem to build up my understanding (banging my head against the wall).

Joolis
Posts: 312
Joined: Thu Feb 19, 2015 10:26 am

Re: All of mudlet

Post by Joolis » Tue Jul 26, 2016 10:27 am

You could try just setting a "flag" variable (i.e. true/false). Call it something like should_timer_reset (you can name it w/e you like)

Set it to true initially. If text in the game triggers a tick reset, set should_timer_reset to false.

In your timer function, check the value of should_timer_reset and only reset the timer if it is true.

At the end of your timer function, you should set should_timer_reset back to true regardless of previous actions. This will bring it back to initial conditions.

Joolis
Posts: 312
Joined: Thu Feb 19, 2015 10:26 am

Re: All of mudlet

Post by Joolis » Tue Jul 26, 2016 10:36 am

I realized my solution will not fix the problem because the timer will continue to run on a 62 second loop instead of being stopped/restarted. Poop!

jasmin
Posts: 242
Joined: Sun Dec 27, 2015 3:53 am

Re: All of mudlet

Post by jasmin » Tue Jul 26, 2016 10:54 am

Ahahahah yes exactly I had the same issue.
I thought I'd fixed it with a Kill function but it just didn't do anything
I gather there is a way to set up the timer with a TempTimer function so that THAT kills itself every time (or rather gets killed every time the tick timer resets to a game input) but.. I spent about 3 hours trying to do it last night and failed.

Scizzor
Posts: 68
Joined: Mon May 04, 2015 2:20 am

Re: All of mudlet

Post by Scizzor » Wed Jul 27, 2016 4:30 pm

So not a plug for zmud or cmud or anything.

BUT in those programs, you can actually name the trigger. So, if the 62 seconds run down, it can reset itself. But, if something triggers before the 62 seconds are done, it will reset the trigger with the specific name. So, you can make sure that there's always only 1 there.

This is how you solve a lot of issues of things triggering prematurely, or several times.. It just resets the same trigger over and over because it calls it by name.

Maybe i'm misunderstanding what you guys want, but maybe there is a way to do that. In zmud, it's:

#Alias {howdy} {#ALARM "testingthis" +5 {say hi}}

Testing this you'd just type "howdy". If you didn't wait for the 5 seconds to be up, you could type howdy again, it wouldn't make 2 alarms, it'd just reset the "testingthsi" back to 5 second countdown again.

I know that doesn't help you in mudlet, but maybe there's something like that.

Anyways.

Jomin
Posts: 160
Joined: Thu Feb 19, 2015 3:54 pm
Location: White Tower Libraries or Deepest Wiltshire, UK

Re: All of mudlet

Post by Jomin » Sun Jul 31, 2016 7:07 pm

*Jomin wipes the muck off of her arms as she takes a short break from the delicate work that she is performing deep in the bowels of the Mudlet codebase to rebuild it better, stronger, simpler... you get the gist! *

Humm, let me see, ah, good you are not trying to use the stopwatches - there is something decidedly unsatisfactory with those things that may need a large hammer to fix! :roll:

Right using permTimer( "name", "parent", timeout {in milli-seconds}, "function" ) will set up a Permanent (appears in the editor) with the given "name" inside the "parent" folder if one is set - seems to allocate one called "a" if an empty string is given, which will call the Lua "function" every time out interval once it is enabled - it is NOT enabled at this point.

The "permTimer" Lua function will return a single (positive) Id number that identifies the timer although I am not sure that is of much use except when looking at the Mudlet central error console or the error screen in the Editor for the profile. Having got a positive number (a -1 indicates an error) that name can then be used with: enableTimer( "name" ) and disableTimer( "name" ) to start and stop it, respectively, from calling the "function" every elapsed "timeout" - the Wiki pages seem to suggest that the Id numbers can be used to specify a timer for these functions but the C++ code I am currently gazing at does not seem to be set up to accept Id numbers, only names.

For the record there is also the tempTimer( timeout, function ) which creates a one-shot (fires and then deletes itself) timer in the same manner. Importantly it IS automatically started when it is created - which is just as well given that I'm not convinced that the enable/disable commands will work on temporary ones...

Furthermore I can see that there does not appear to be a way to adjust the time-out on an existing timer - which seems a bit of an oversight if one wants to have a permanent tick timer that can be "trimmed" to make it act as a Phase-Locked-Loop that uses "on-tick" messages to bring it into sync with the Server. {I am an Electrical and Electronics Engineer in Real-Life™} - so you will have to delete the timer {with killTimer( something ) - but that says it only takes an Id of a tempTimer as a string argument but Ids are numbers - so that doesn't sound right either :? }.

Okay - that is something else to go onto the towering pile that is my to-do list...

Accepted Jomin
{a.k.a. SlySven - one of the small band of Mudlet-makers(coders)}
Last edited by Jomin on Sun Jul 31, 2016 7:27 pm, edited 1 time in total.

Jomin
Posts: 160
Joined: Thu Feb 19, 2015 3:54 pm
Location: White Tower Libraries or Deepest Wiltshire, UK

Re: All of mudlet

Post by Jomin » Sun Jul 31, 2016 7:23 pm

Rocke wrote:Sorry to start up an older thread, I took quite a break and am now back, I was curious if there is a way to assign an alias from my command bar?
Perhaps you want the permAlias(name, parent, regex, function) command - these are all string arguments and function can be an existing function OR some lua code...

To enter this in the "command bar" you will want to use the "lua" alias that is already included to use for direct entry, i.e. after ensuring you have a "myAliasesFolder" "group" in the "Aliases" editor window, you can put into the "command bar" something like:

Code: Select all

lua permAlias( "myTestAlias", "myAliasesFolder", "^test$", [[cecho("<green:white>It Works!<reset>")]] )
then, when you enter

Code: Select all

test
it will hopefully produce:

It Works!

in the main console for the profile and leave the newly defined alias "myTestAlias" in the editor window... :ugeek:

Accepted Jomin

drock
Posts: 3
Joined: Thu Jul 07, 2016 7:50 pm

Re: All of mudlet

Post by drock » Wed Aug 17, 2016 8:12 am

newb here never used scripts before but i think its about time. how do install em?

Post Reply