Page 1 of 2

Performing actions on character connection/game init

Posted: 07 Sep 2017 22:36
by mallor
Hi, all.

I need to perform JS code when game is loaded or character is connected.
I've tried to create GMCP triggers on both core.hello and char.login, but they were never triggered.
What am I missing?

Re: Performing actions on character connection/game init

Posted: 08 Sep 2017 16:46
by Zugzug
for example, if you want to sendGMCP([[Core.Options { "npc_comms" : "off" }]]) on gmcp.char.login you have to put it on some delay, as it doesn't work otherwise. Not sure why, but a few seconds is enough.

Re: Performing actions on character connection/game init

Posted: 08 Sep 2017 19:07
by Alisa
the webclient js triggers and such are loaded with your characters login, as i understand it, so it would be hard to trigger on that part.

Re: Performing actions on character connection/game init

Posted: 08 Sep 2017 20:00
by mallor
Alisa wrote:the webclient js triggers and such are loaded with your characters login, as i understand it, so it would be hard to trigger on that part.
So it seems, the triggers are simply loaded too late.
Any chance we can get a fix? Just trigger the char.login once triggers are loaded, in any case triggers are loaded only after the login?

Re: Performing actions on character connection/game init

Posted: 08 Sep 2017 23:43
by Alisa
fix?

Trigger on a line done after login.. like the "last login was from" or something like that.

Re: Performing actions on character connection/game init

Posted: 09 Sep 2017 13:10
by mallor

Code: Select all

Welcome to Genesis 3.1, maintenance release.
Last login at  : Sat Sep  9 11:57:34 2017
Last login from: ::1
This is a big dark hall with rows of beds in it. Every warrior from Angmar's
army has his own bed here and whenever he wishes to, he can sleep here.
There is one obvious exit: east.
> 
Loaded 36 triggers (14 enabled)
Loaded 37 aliases (31 enabled)
As you can see triggers REALLY load last.

Re: Performing actions on character connection/game init

Posted: 09 Sep 2017 16:12
by Alisa
You recover? Should be after that, yeah?

Re: Performing actions on character connection/game init

Posted: 10 Sep 2017 18:50
by mallor
Alisa wrote:You recover? Should be after that, yeah?
You don't always recover.

I wonder how hard would it be to trigger char.login event right after loading triggers? Additional line of code, I can do it and send it to whoever needed, if they're THAT busy.

Re: Performing actions on character connection/game init

Posted: 10 Sep 2017 23:37
by Drazson
The order in which those messages appear (You recover *items*, Welcome Gardener, triggers enabled etc) change oftentimes. I decided to just make an "armself" alias to do stuff when im back in the realms manually. :?

Re: Performing actions on character connection/game init

Posted: 11 Sep 2017 00:21
by mallor
I initialize mine with alias manually right now as well, but I'm looking for a more consistent way, than relying on messages that might or might not show up during logging on.