Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Room.Info appears to be manipulated by GMCP generic mapper before being put into a table #6019

Closed
gesslar opened this issue Mar 22, 2022 · 6 comments

Comments

@gesslar
Copy link

gesslar commented Mar 22, 2022

Brief summary of issue / Description of requested feature:

  1. When I send a GMCP message to Mudlet for Room.Info, I am sending the exits mapping as string : string, however, it appears in the Mudlet table as string : number
  2. When I sent anything that doesn't equate to a number, it doesn't appear at all.

In the first case, I would expect it to be a string, since that is what is being sent.

The second case prohibits using alternative means of identifying rooms. In muds that don't have a vnum system, it would be helpful for other ways to identify rooms, such as perhaps a base64-encoded string that represents the file name of the room one is in.

Steps to reproduce the issue / Reasons for adding feature:

  1. Send Room.Info { "name" : "Some Room", "exits" : { "east" : "100" } }
  2. Send Room.Info { "name" : "Some Room", "exits" : { "east" : "L2QvdGhyYWNlL3RocmFjZS9ub3J0aDI=" } }

Error output / Expected result of feature

  1. Transforms to a number
Room = {
    Info = {
        name = "Some Room",
        exits = {
            "east" : 100
        }
    }
}
  1. Omits the exits
Room = {
    Info = {
        name = "Some Room",
        exits = {}
    }
}

Extra information, such as Mudlet version, operating system and ideas for how to solve / implement:

Mudlet 4.15.1, Windows 11

@SlySven
Copy link
Member

SlySven commented Mar 22, 2022

Does that second example exactly reproduce what you are testing with - because "L2QvdGhyYWNlL3RocmFjZS9ub3J0aDI= does not end with a " so won't be a valid string value!

@gesslar
Copy link
Author

gesslar commented Mar 22, 2022

Does that second example exactly reproduce what you are testing with - because "L2QvdGhyYWNlL3RocmFjZS9ub3J0aDI= does not end with a " so won't be a valid string value!

Corrected the typo, sorry about that!

@atari2600tim
Copy link
Contributor

I opened up 2 tabs. 1 is fresh profile. 2 is remove generic mapper package, create script and paste in the code from the forum at https://forums.mudlet.org/viewtopic.php?p=46638#p46638 Then in each tab I sent myself that message and then that same message substituting an X in Info. They both show Infx good, but the one with the forum script shows the Info wrong. Without looking at the script too closely just yet, I'd say either the script chokes on it and interrupts Mudlet in setting it, or trashes it after Mudlet has set it.
Screenshot 2022-03-22 12 10 36 AM
Then I adjusted the code of that script to make it print the variable, added this display function...

function map.eventHandler(event,...)
    if event == "gmcp.Room.Info" then
        display(gmcp.Room.Info)

Now after doing that, it shows that it was valid at that point and then messed up after that specific spot but before I typed the lua command.
image

I'm not familiar enough with it to know if maybe there's a pass by reference issue or something like that.

@atari2600tim
Copy link
Contributor

I guess it's this for loop.

        echo("DEBUG-b about to do loop\n") display(gmcp.Room.Info)
        for k,v in pairs(map.room_info.exits) do
            map.room_info.exits[k] = tonumber(v)
        end
        echo("DEBUG-c about to do handle_move\n") display(gmcp.Room.Info)

image

Earlier in the code, I expect this part is making a pointer instead of copying data...

        map.room_info = {
          vnum = tonumber(gmcp.Room.Info.num),
          area = gmcp.Room.Info.area,
          name = gmcp.Room.Info.name,
          terrain = gmcp.Room.Info.environment,
          exits = gmcp.Room.Info.exits
        }

@vadi2
Copy link
Member

vadi2 commented Mar 22, 2022

Ahh yep. Add a table.deepcopy() in there, does that fix it?

@vadi2 vadi2 changed the title Room.Info appears to be manipulated by Mudlet before being put into a table Room.Info appears to be manipulated by generic mapper before being put into a table Jun 27, 2022
@vadi2 vadi2 changed the title Room.Info appears to be manipulated by generic mapper before being put into a table Room.Info appears to be manipulated by GMCP generic mapper before being put into a table Jul 5, 2022
@vadi2
Copy link
Member

vadi2 commented Jul 5, 2022

Issue is with a 3rd party script, posted the solution to https://forums.mudlet.org/viewtopic.php?f=13&t=23065&p=46822#p46822

@vadi2 vadi2 closed this as completed Jul 5, 2022
iLPdev added a commit to iLPdev/prs that referenced this issue Feb 17, 2023
* Made modifications adapting to new PR functionality.
* Fixing speedwalking.
* Making the change called for in https://forums.mudlet.org/viewtopic.php?p=46822#p46822 and Mudlet/Mudlet#6019.
* Adding processing of gmcp messages and events for the updated values. Adapting mapper to use the new events. Updating stats to use the updated gmcp data and also to make the xp bar reflect score.
* fix to typos in stamina bar variables Changings players to player

---------

Co-authored-by: Dalem <edward.terchunian@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants