nickgammon / plugins

MUSHclient plugins
http://www.gammon.com.au/forum/?bbtopic_id=108
23 stars 15 forks source link

Learning_mapper throws an error #2

Open IgorIvancic opened 1 year ago

IgorIvancic commented 1 year ago

Hi,

clicking on the * in the bottom left corner of the map crash happens which requires reinstalling of the whole plugin to make things go back to normal again.

While on this topic, would it be possible to have the window resizable and to have it the highest Z index?

I started playing a new mud and I'm using their official plugin. One way I guess would be to make adjustments to it.. This is what happens:

https://pasteboard.co/hNnJqGZc6K3l.png

https://pasteboard.co/lckmGqDl5LH8.png

Error:

https://pasteboard.co/IJcPdhlWezWv.png

nickgammon commented 1 year ago

What version of the mapper do you have? The line shown in the error message should not fail:

https://github.com/nickgammon/mushclient/blob/master/lua/mapper.lua#L303

    if type (v) == 'table' and v.colour then

Also, please report which version of MUSHclient you have (see Help menu).

While on this topic, would it be possible to have the window resizable and to have it the highest Z index?

You can change the mapper size in the configuration menu (the one that is currently causing a crash).

As for the Z order, try changing this line in Learning_Mapper.lua:

https://github.com/nickgammon/plugins/blob/master/Learning_Mapper.lua#L771

  WindowSetZOrder(win, -5)

Change -5 to some positive number, make it larger until the map window appears above the other miniwindows.

nickgammon commented 1 year ago

Also, for the learning window, after these lines:

 WindowCreate (learn_window,
                 windowinfo.window_left,
                 windowinfo.window_top,
                 LEARN_WINDOW_WIDTH,
                 LEARN_WINDOW_HEIGHT,
                 windowinfo.window_mode,   -- top right
                 windowinfo.window_flags,
                 ColourNameToRGB "lightcyan")

Add:

  WindowSetZOrder(learn_window, 1000)

That should move the learning window up the Z-order.

IgorIvancic commented 1 year ago

I did a completely fresh version.

Just now I downloaded MUSH Client from your website using downloader. That installed version 5.06 After that I downloaded plugins from github and I placed Leanring_Mapper.xml and .lua in my plugins folder. I created a new world(realmsofdespair.com 4000), added the plugin, entered the mud and again crash happens after I click on the * in the bottom left corner: https://pasteboard.co/ea5PXg4HK8xV.png

There's also an issue with the client trying to open help that starts my Edge(even though my default browser is Chrome) and displays this: https://pasteboard.co/TkfKC1o4fOjJ.png

I have the same issue when I want to open help on the function(I saw your video where you explain Immediate window and how to go to the online and see the documentation). So Help -> Function list... and then double click on a certain function results in the same MS Support Error opening Help...

One more thing - are Mapper Learner and Mapper the same thing? Meaning, once I've used Learner for a while and I see it's working correctly do I then turn it off and display "normal" mapper?

Thank you!

nickgammon commented 1 year ago

Please type mapper version and report what you see. You should see:

[MUSHclient mapper, version 2.7]
[Learning_Mapper version 2.1]

Your error message seems to have moved to line 302 in mapper.lua:

https://github.com/nickgammon/mushclient/blob/master/lua/mapper.lua#L302

That is:

  for k, v in pairs (config) do

That should not throw the error you pasted, which makes me think something odd is going on.

Can you open your copy of mapper.lua (in the "lua" folder of your MUSHclient installation) and confirm that line 302 is as shown above? (Use any text editor which can show line numbers to do that). I use Geany.


Tips for posting error reports

  1. If you tick the box "Show errors in output window next time" the errors show up in the output window and you can then copy and paste them rather than having to take a screenshot.
  2. You can directly upload screenshots to GitHub, you don't need to upload them to a 3rd party site and then put a link to them.

There's also an issue with the client trying to open help ...

Windows no longer supports the help file format used by MUSHclient, and it is a heap of work to change it. The help can also be accessed from http://www.gammon.com.au/docs or you can install the supplied plugin MUSHclient_Help.xml which lets you look at the help entries inside the client (type mchelp <topic> and the help information will be shown in the output window).

Both techniques use the same help database as the supplied help file.


One more thing - are Mapper Learner and Mapper the same thing?

No. The Mapper is in the file mapper.lua and is the "engine" of the mapper. It needs a plugin to call it. the Learning_Mapper.lua and Learning_Mapper.xml files implement the interface with the mapper which learns stuff as you walk around. Some MUDs implement their own mapper plugins (Aardwolf is an example) which are tailored to exactly that MUD's output. The learning mapper was intended to be a generic interface to the mapper.

Meaning, once I've used Learner for a while and I see it's working correctly do I then turn it off and display "normal" mapper?

Not exactly. Type mapper learn to toggle showing the learning window, which leaves you with the mapper itself being displayed.

nickgammon commented 1 year ago

You might want to change line 94 of Learning_Mapper.lua to be:

DEBUGGING = false

That gets rid of a lot of debugging messages.

When you click on the asterisk in the bottom left corner you should see this:

Screenshot from 2023-03-09 08-32-23

I just tested with my own copy of Smaug and the latest mapper, and as you can see it worked with no issues.

IgorIvancic commented 1 year ago

This is the actual error: " Run-time error Plugin: Learning_Mapper (called from world: RoD) Function/Sub: line_received called by trigger Reason: processing trigger "" when matching line: "Exits: north east south west up northeast northwest " C:\Games\MUSHclient\lua\mapper.lua:302: attempt to index local 'v' (a boolean value) stack traceback: C:\Games\MUSHclient\lua\mapper.lua:302: in function 'draw_configuration' C:\Games\MUSHclient\lua\mapper.lua:1043: in function 'draw' ...\Games\MUSHclient\worlds\plugins\Learning_Mapper.lua:1694: in function 'process_new_room' ...\Games\MUSHclient\worlds\plugins\Learning_Mapper.lua:178: in function 'handler' ...\Games\MUSHclient\worlds\plugins\Learning_Mapper.lua:2160: in function <...\Games\MUSHclient\worlds\plugins\Learning_Mapper.lua:2102> "

The mapper.lua and the mentioned line: Screenshot 2023-03-09 101032 The object "config" is apparently nil, though I do see it declared at line 91.

Command(alias) mapper version doesn't exist. But I do see the version at the top once I do mapper help: [MUSHclient mapper, version 2.6] [Learning_Mapper version 2.1]

nickgammon commented 1 year ago

But I do see the version at the top once I do mapper help: [MUSHclient mapper, version 2.6] [Learning_Mapper version 2.1]

You don't have the latest version of mapper.lua. See the latest commit: https://github.com/nickgammon/mushclient/commit/9ee632a36ececc122f1ab1a203d58b74e1811b0b - you have 2.6, the latest is 2.7 as I said above.

The comment at the start says:

Amended: 1st February 2020 to fix bug in drawing configuration sub-window

That's the exact problem you are having. Replace your copy of the mapper.lua file with the latest one:

https://raw.githubusercontent.com/nickgammon/mushclient/master/lua/mapper.lua

(That is a link to the actual file - RH click that link and "save as" to save to your disk - it needs to go in the lua sub-folder of your MUSHclient installation).

Confirm once you have done that, and restarted the client, that it shows 2.7 as the version and not 2.6.

nickgammon commented 1 year ago

Command(alias) mapper version doesn't exist.

Sorry, I meant:

mapper help
IgorIvancic commented 1 year ago

Yep, that did it!

You should probably create a new stable version as your Downloader and include this file in it.

Let me ask you about another thing...

I've played a couple of muds where they mention they use MSDP(mud server data protocol). I've looked into how it's implemented in Realms of Despair(RoD) plugin and what basically happens is you have a certain function defined and that function gets executed each time mud sends you some info. In RoD example, they have duration of spells in rounds. So if you have some spells on you you'd have that function go off each round(3-4 seconds). But the mud sends only the info that has changed for your character. Meaning in case you don't have buffs on you and you're standing still in a room you won't get any data. The reason why I'm mentioning all this is because amongst many data they also supply room name and area name. You probably know how and if this piece of info could be utilized in mapper.lua? I'm thinking how you could parse the text received, as you currently do while figuring out what's the room name desc and exits, but instead of guessing the room name you could 100% know it if it's supplied. I also assume you could then 100% know what description is since it can only be in between room name and exit. So mapper.lua would probably need to have the option to receive that info and then players playing a mud that has MSDP would be able to use it? And I do see mapper having a place holder for area name so that could be populated by MSDP as well. I know additional scripting would need to be done to take advantage of that(to pass those values to mapper.lua) but once the mapper.lua(the engine) is adjusted to receive them I think this additional plugin would be a piece of cake... Probably create some config values for mapper.lua that would let us define "yes, we will supply the room name, etc..."?

You touched on Aardwolf and I have been playing it for quite a while and I've talked to Fiendish several times on how to adjust certain plugins. I also know quite well how to use their mapper. The reason why I'm mentioning this is to ask you how complicated would it be to have your mapper have to functionality of custom exists that Aardwolf implements? In case you don't know what I'm talking about let me explain: Image you have room A and B. And to get from A to B you need to perform some specific commands, not just a typical move like north, south, etc.. So what they did is they exposed a certain function that takes in parameters that they utilize in the background to define that to get from A to B you need to perform certain commands. It goes into great complexity where you can add wait to the command(in case you're waiting on mud to react to your command), you can move, buy keys, wear clothes....whatever command(s) you provide as parameter(s).

I think with those 2 additional functionalities your mapper could be considered as complete and fully usable for any mud. It wouldn't be just a generic mapper that doesn't work in certain cases.

I know it's a lot of work but I believe that you being the writer of mapper.lua know exactly what needs to be done and where. In case you decide to invest time for additional development of mapper please have this in consideration :-) I find maps to be the greatest value in any mud.

Thank you!

nickgammon commented 1 year ago

MSDP and GMCP (used by Aardwolf) are useful because you can get the exact room IDs for each room which makes the mapper more reliable. Aardwolf uses my mapper with some enhancements for the engine, and their custom front-end to process the incoming GMCP messages.

You can always look at how the Aardwolf plugin works for ideas.

I don't really want to modify the mapper myself for individual MUDs, I made the learning mapper so there would be a generic mapper available for most players.

If you are talking about enhancing the core mapper module (mapper.lua) then taking Aardwolf's code and implementing it yourself should be fairly easy. Fiendish's code is released under the GPL so there should be no issues with using it.

More generic discussions about the mapper should be directed to my forum.