Triggering on Output of Trigger Action

Post Reply
Brutus
Posts: 4
Joined: Wed Oct 02, 2013 12:23 pm
Location: Italy

Triggering on Output of Trigger Action

Post by Brutus »

Hi all !

I've a simple question about triggering ...

I've a trigger they store in a 2 position array myStopWatch the values got by getStopWatchTime() the trigger responds to different output of the mud like:

"The sun starts to rise", "The sun is over your head", "The moon is rising" etc.

This events are not really fixed in specific times of the mud since the gods idea is to avoid player to have a really synchronized time ticket for their actions but still those outputs are at the end of a tick ...

At the end of trigger operation I need to issue:

send ( "TIME\n" )

and trigger the mud output in response of that command so i can get the mud time and store those in another 2 position array of time myTime so i can make some calculation like:

TicketLen = ( myStopWatch[2] - myStopWatch[1] ) / ( myTime[ 2 ] - myTime [ 1 ] )

This obviously adjusting the data in case of midnight is passed between the 2 series of data.

The trouble is that while both the triggers works fine each for each self (if I issue the TIME command manually) when the second should get the result of the send of the first the second doesn't fire.

Are there any way to trigger the output issued on the basis of another trigger ? Any suggestion ?

Thanks in advance !

Brutus

User avatar
Vadi
Posts: 5050
Joined: Sat Mar 14, 2009 3:13 pm

Re: Triggering on Output of Trigger Action

Post by Vadi »

The trouble is that while both the triggers works fine each for each self (if I issue the TIME command manually) when the second should get the result of the send of the first the second doesn't fire.
I read it several times but don't quite understand which way do you mean this (there are several).

You shouldn't make triggers fire based on what other triggers fire - it's best to call functions or raise events.

Tagon
Posts: 24
Joined: Thu Sep 19, 2013 8:38 pm

Re: Triggering on Output of Trigger Action

Post by Tagon »

As I understand it you have a mutiline OR trigger for:

"The sun starts to rise", "The sun is over your head", "The moon is rising" etc

This trigger stores the result of getStopWatchTime() into an array and sends "TIME" to as a command to the mud.

The second trigger responds to the output from the mud of the TIME command.

Unless you have the triggers nested or some other non-standard arrangement setup I can't see why this wouldn't work. Are you able to show screenshots of how the triggers are setup in your client? If I don't (I'm new) then Vadi might spot something like a checkbox ticked that shouldn't be, or nested triggered etc?

Brutus
Posts: 4
Joined: Wed Oct 02, 2013 12:23 pm
Location: Italy

Re: Triggering on Output of Trigger Action

Post by Brutus »

Well I resolved ... and the trouble was only about the "timing" :-)

I mean since the last operation of the first trigger was to write the command TIME to the mud I was thinking that the other trigger was able to fire as soon as the output of the command was send back from the MUD, but I was wrong.

It seems that while a trigger is working, on my Mac OSX 10.8, other triggers can't fire ..

I solved using at the end of the first trigger:

tempTimer ( 3, [[send ("TIME\n")]]) instead of merely send ( "TIME\n" )

And now I've a really bullet ( and Gods ) proof way to adjust the length of time tick whatever the Gods change the hours times at which the sunrises or the moon sets (They say that this changes are due to he seasons, but for me it's only to avoid good triggering :-))

If anyone is interested I could post both the triggers, the strings about the times of the day must be changed because of the language I'm on an italian language MUD :-)

Brutus
Posts: 4
Joined: Wed Oct 02, 2013 12:23 pm
Location: Italy

Re: Triggering on Output of Trigger Action

Post by Brutus »

B.T.W.

During the development of the triggers I discovered another little trouble in the way lua works on OSX ..

The lua operator "-=" doesn't work well if I use it to test that an array in not "nil" it doesn't mater since I have changed the logic of the tests using the operator "==" but anyway this is a strange beaviour.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Triggering on Output of Trigger Action

Post by phasma »

To test for not nil, you can just do:
Code: [show] | [select all] lua
if foo then ... end
As for the operator you posted, I suspect you mean ~= rather than -=

Brutus
Posts: 4
Joined: Wed Oct 02, 2013 12:23 pm
Location: Italy

Re: Triggering on Output of Trigger Action

Post by Brutus »

Yes I should have mean ~= rather than -= ... but reading lua language manuals with a very little font I didn't have read well and I tried to use -= instead of ~= ... May be it's time to change my eyeglasses :-)

Btw for people that knows lua i've a little question: It seems to me (completely new to lua) that's a lot of the language is quite near to the 'C' language is that a good point to start to understand it or am I mislead from my experience on 'C' ?

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Triggering on Output of Trigger Action

Post by phasma »

It's very C like in some regards, yes. That said, it's fundamentally different as it's an 'interpreted' language rather than a 'compiled' one.

It's also much, much easier to learn, heh.

User avatar
Vadi
Posts: 5050
Joined: Sat Mar 14, 2009 3:13 pm

Re: Triggering on Output of Trigger Action

Post by Vadi »

The ~= operator on OSX does work correctly - I think you were misusing it. Could you show an example you were trying?

Post Reply