View unanswered posts | View active topics It is currently 12 Dec 2017 08:26

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
Recent changes in web client 
Author Message
Rising Hero

Joined: 27 Jun 2011 13:20
Posts: 310
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?


01 Oct 2017 01:05
Profile
Adventurer
User avatar

Joined: 18 May 2017 16:22
Posts: 97
Location: Sipping on some joe in the necro lounge
I do not know if this was a fix or something, but now some triggs I had don't work either.


01 Oct 2017 08:10
Profile
Rising Hero

Joined: 27 Jun 2011 13:20
Posts: 310
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.


01 Oct 2017 08:15
Profile
Site Admin
User avatar

Joined: 04 Mar 2010 01:14
Posts: 265
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.


01 Oct 2017 10:37
Profile
Rising Hero

Joined: 27 Jun 2011 13:20
Posts: 310
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: viewtopic.php?f=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.


01 Oct 2017 13:36
Profile
Adventurer
User avatar

Joined: 18 May 2017 16:22
Posts: 97
Location: Sipping on some joe in the necro lounge
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?


01 Oct 2017 13:44
Profile
Rising Hero

Joined: 27 Jun 2011 13:20
Posts: 310
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" :)


01 Oct 2017 14:27
Profile
Site Admin
User avatar

Joined: 04 Mar 2010 01:14
Posts: 265
Is this args think still not working? Should have been fixed earlier today.
Might need double reload of the app.


01 Oct 2017 16:04
Profile
Rising Hero

Joined: 27 Jun 2011 13:20
Posts: 310
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 :)


01 Oct 2017 18:50
Profile
Rising Hero

Joined: 27 Jun 2011 13:20
Posts: 310
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:
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.


01 Oct 2017 19:16
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: No registered users 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.