Recent changes in web client

General discussion about the Genesis Web Client located at https://www.genesismud.org/play/

Moderator: Eowul

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.
mallor
Rising Hero
Posts: 371
Joined: 27 Jun 2011 13:20

Recent changes in web client

Post by mallor » 01 Oct 2017 01:05

Not sure what you guys did, but all my JS aliases and triggers won't work now, because "args" is no longer passed. How do I check the args passed to my alias now?

Sibbedidenn
Adept
Posts: 145
Joined: 18 May 2017 16:22
Location: Sipping on some joe in the necro lounge

Re: Recent changes in web client

Post by Sibbedidenn » 01 Oct 2017 08:10

I do not know if this was a fix or something, but now some triggs I had don't work either.

mallor
Rising Hero
Posts: 371
Joined: 27 Jun 2011 13:20

Re: Recent changes in web client

Post by mallor » 01 Oct 2017 08:15

By the looks of what I see in web client code right now it was just encapsulation of some functionality we were not "supposed" to use.
If you have use of "script_api", "mud", "gmcp_data" etc objects, you need to replace them with corresponding "gwc" functions.
Lack of args in aliases looks like a bug, which needs to be fixed.

User avatar
cotillion
Site Admin
Posts: 350
Joined: 04 Mar 2010 01:14

Re: Recent changes in web client

Post by cotillion » 01 Oct 2017 10:37

What has happened is that the way the web client is assembled has changed.
It was all previously connected using global variables which were also visible in scripts.

Now webpack handles all the connection of modules. This means that scripts which relied on accessing
global variables might no longer work.

The script api is still available as 'gwc' in scripts. The old 'mud' object should also still be available, but that might stop working in the future.
Other globals are not available.

If there is some specific functionality you need added to the 'gwc' object let me know.

mallor
Rising Hero
Posts: 371
Joined: 27 Jun 2011 13:20

Re: Recent changes in web client

Post by mallor » 01 Oct 2017 13:36

cotillion wrote:What has happened is that the way the web client is assembled has changed.
It was all previously connected using global variables which were also visible in scripts.

Now webpack handles all the connection of modules. This means that scripts which relied on accessing
global variables might no longer work.

The script api is still available as 'gwc' in scripts. The old 'mud' object should also still be available, but that might stop working in the future.
Other globals are not available.

If there is some specific functionality you need added to the 'gwc' object let me know.
Thanks for replying.

Personally I could live with script_api and mud being hidden, even though it limits me in regard to things I can hook to.
One thing that lots of people rely on was "args" object, which we could access from aliases.
This is how it used to work: https://www.genesismud.org/forums/viewt ... =37&t=3186
Basically it used to pass arguments of my alias to JS code, i.e if I type "myalias test 123" I would receive an array (more or less, simplifying here) consisting of 3 elements ["myalias", "test", "123"].

Now presuming all global variables were removed and "args" was one of them, I didn't find anything that is passed to alsies now that resembles what "args" used to do.
This is what I see right now in "arguments" when my alises/triggers run, and I don't see args there:

Image

Now I've implemented a workaround I'm not really proud of, but I'd like to know if this functionality will be preserved, since it's very fundamental for writing JS based alises.

Thanks,
Mallor's player.

Sibbedidenn
Adept
Posts: 145
Joined: 18 May 2017 16:22
Location: Sipping on some joe in the necro lounge

Re: Recent changes in web client

Post by Sibbedidenn » 01 Oct 2017 13:44

I do have a question.

gwc.output.replace(args[0], '<span style="color: rgb(255,255,0)">' + args[0] + '</span>', true);

I used to use this script, which uses args, to highlight single words within phrases. It was great because the basic coloring scheme shown in genesismud.org will only highlight entire lines of text. I could highlight player names that belong to my friends or single words that were just pertinent to a task I was doing. So my question is, is there any way I could still do this without args on the client?

mallor
Rising Hero
Posts: 371
Joined: 27 Jun 2011 13:20

Re: Recent changes in web client

Post by mallor » 01 Oct 2017 14:27

Sibbedidenn wrote:I do have a question.

gwc.output.replace(args[0], '<span style="color: rgb(255,255,0)">' + args[0] + '</span>', true);

I used to use this script, which uses args, to highlight single words within phrases. It was great because the basic coloring scheme shown in genesismud.org will only highlight entire lines of text. I could highlight player names that belong to my friends or single words that were just pertinent to a task I was doing. So my question is, is there any way I could still do this without args on the client?
That's my beef with current implementation exactly, "args" :)

User avatar
cotillion
Site Admin
Posts: 350
Joined: 04 Mar 2010 01:14

Re: Recent changes in web client

Post by cotillion » 01 Oct 2017 16:04

Is this args think still not working? Should have been fixed earlier today.
Might need double reload of the app.

mallor
Rising Hero
Posts: 371
Joined: 27 Jun 2011 13:20

Re: Recent changes in web client

Post by mallor » 01 Oct 2017 18:50

cotillion wrote:Is this args think still not working? Should have been fixed earlier today.
Might need double reload of the app.
Confirmed, CTRL+F5 fixes the problem.

Thanks, my scripts are back to order :)

mallor
Rising Hero
Posts: 371
Joined: 27 Jun 2011 13:20

Re: Recent changes in web client

Post by mallor » 01 Oct 2017 19:16

On a side note... is there any reason behind the change in web client? I can't hook up to functions I used to able to hook up to before.
For instance, I want to log all my commands. What I did before was:

Code: Select all

hooked_function = mud.connection.send;

function hook_send(command)
{
    // Do my stuff here;
    // Call hooked function
    hooked_function(command);
}

mud.connection.send = hook_send;
This way I could also develop my script as one big chunk of code, which I've ran with some kind of init alias, instead of having to maintain tens of aliases/triggers, which is kinda unmanageable, since I can't even sort by alphabet, let alone actual alias groups. Going through aliases and enabling/disabling them manually is more pain that you could imagine.

Right now with gwc.connection.send this is not possible, probably do to the fact gwc is constructed on the fly when alias is called.

Now the same way I could, theoretically, hook up to script_api.output to add custom triggers.

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