[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Hyperlink in OnPluginPacketReceived

Hyperlink in OnPluginPacketReceived

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1 2  

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Tue 14 Apr 2020 10:10 PM (UTC)
Message
Hello.

I play Materia Magica, and I have a plugin that I wrote that shows me room (number and coordinates) information in the compass area. I would like to be able to walk back to a particular room with just the click of the room number, but I don't know how I would do that. I was thinking of using an anchor, but I don't know how that could send information to the client and not the browser. Any thoughts? Is this even possible?

--Avery--
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Wed 15 Apr 2020 05:31 AM (UTC)
Message
Why are you doing this in OnPluginPacketReceived?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 15 Apr 2020 07:13 AM (UTC)
Message
I did a mapper for Materia Magica here:

https://www.gammon.com.au/forum/?id=10667

In the mapper, you just click on a room and it walks you there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Reply #3 on Thu 16 Apr 2020 12:59 AM (UTC)

Amended on Thu 16 Apr 2020 01:00 AM (UTC) by Areadien

Message
Fiendish said:

Why are you doing this in OnPluginPacketReceived?


Because that's how I'm getting the room information. I made enough room for room names to not be truncated, so that's why I didn't just use triggers and a GMCP call.

Nick Gammon said:

I did a mapper for Materia Magica here:

https://www.gammon.com.au/forum/?id=10667

In the mapper, you just click on a room and it walks you there.


Yeah, I know I can do that, but if the room is not on my mapper because I'm too far away from it or it's in a different area, or if I don't know exactly where that particular room is on my map, then clicking it inline with a hyperlink would be more convenient.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Thu 16 Apr 2020 03:07 AM (UTC)
Message
Quote:
I made enough room for room names to not be truncated

I don't understand what you're trying to say here.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Reply #5 on Thu 16 Apr 2020 03:39 AM (UTC)
Message
Basically if the room name is a certain length, the game doesn't display it all. I do.

Also, I'm displaying the room information in the first line of 3 in my compass, so that's also why I need to use the callback and not a trigger, because the GMCP doesn't register until the second line.
[Go to top] top

Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Thu 16 Apr 2020 03:46 AM (UTC)
Message
Areadien said:

Yeah, I know I can do that, but if the room is not on my mapper because I'm too far away from it or it's in a different area, or if I don't know exactly where that particular room is on my map, then clicking it inline with a hyperlink would be more convenient.



Quote:

I would like to be able to walk back to a particular room with just the click of the room number, but I don't know how I would do that.


Yes, but ... how are you going to get to that room if it's in a different area? A fundamental thing to know is the route to the room.

Quote:

I don't know exactly where that particular room is on my map ...


Who would know, then?




Making hyperlinks in OnPluginPacketReceived is not at all supported. You are supposed to use that to detect GMCP stuff, and record it, or maybe to fiddle with packets slightly. Not to inject hyperlinks.

You could conceivably remember the room you are in (presumably that is what you are doing) and use that to calculate a route to the room you want to go to. But not in OnPluginPacketReceived itself.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 16 Apr 2020 03:52 AM (UTC)
Message
Quote:

I need to use the callback and not a trigger, because the GMCP doesn't register until the second line.


I don't understand that part.

Quote:

I would like to be able to walk back to a particular room with just the click of the room number


I don't understand what you are saying. On your compass you have a room (like, adjacent?) and you want to walk to it by a click, is that it?

You'll get better advice if you give a lot more detail about what you want to do. Like, an example. Right now it is coming over as an X-Y Problem.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Reply #8 on Thu 16 Apr 2020 04:03 AM (UTC)

Amended on Thu 16 Apr 2020 04:04 AM (UTC) by Areadien

Message
OK, let me give an illustration then.

Let's say I have a room that looks like this inside an area called Rune Forest:

 A Cliff Edge                                                   12084 [ 700, 680] -      N      -
(-------------------------------------------------------------------------------) - <---(M)---> E
                                                                                  -      -      -


I want to be able to click on the 12084 when I'm in another room and send a speedwalk to room 12084. If I'm in a different area, or if the room is off my mapper when I'm in Rune Forest, then I won't be able to click it inside the mapper.

Does this make sense now?

I'd do this with a trigger, but I wouldn't be able to get the room number until the second line of the compass. That's why I'm using the OnPluginPacketReceived callback to display this information.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #9 on Thu 16 Apr 2020 04:59 AM (UTC)

Amended on Thu 16 Apr 2020 05:03 AM (UTC) by Fiendish

Message
Quote:
I'd do this with a trigger, but I wouldn't be able to get the room number until the second line of the compass.

What makes you unable to trigger on the first line? I agree with Nick. Something isn't coming through in your explanation. If you can lay out an ordered sequence of discrete message and action events like "The server sends me A, then the server sends me B, then I do C, and the result is that D is displayed at E like this...." it will help.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Reply #10 on Thu 16 Apr 2020 05:41 AM (UTC)
Message
So it works like this.

The server sends the packet, but I can't read room information with the GMCP plugin until the second line of the compass. I want to put the information on the first line, which is why I'm using the callback.
[Go to top] top

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Reply #11 on Thu 16 Apr 2020 05:46 AM (UTC)

Amended on Thu 16 Apr 2020 05:50 AM (UTC) by Areadien

Message
Hmm, let me think on this because I'm not sure how to explain it better. I think I'll have to look at my code tomorrow to get a better idea.

But basically the plugin I'd have to call doesn't get the information I need until after I want to use it.

Edit: I did not mean to post twice. I thought I had deleted the other comment because it basically just said the same confusing thing I had already said. But trying to delete it doesn't work because I get an error saying I didn't write the post, which I did.
[Go to top] top

Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Thu 16 Apr 2020 10:46 AM (UTC)
Message
The way you have explained it, the very first line you showed above has the room number on it. So why can't that be a hyperlink that you click on if you want to go to room 12084?

I don't see what GMCP has to do with it. If you need GMCP to arrive on the second line to know what room it is, how come you can show it on the first line?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #13 on Thu 16 Apr 2020 01:20 PM (UTC)
Message
Quote:
The server sends the packet

You have to give us more than that. What does the packet look like?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Areadien   USA  (47 posts)  [Biography] bio
Date Reply #14 on Thu 16 Apr 2020 04:39 PM (UTC)

Amended on Thu 16 Apr 2020 04:40 PM (UTC) by Areadien

Message
OK, so this is what the room packet normally looks like:

���room.info {"num": "41703", "name": "Tellerium Parcel Service", "zone": "Tellerium", "wilds": "false", "terrain": "indoors", "terraininfo": "sheltered", "size": "normal", "shape": "square", "plane": "physical", "flags": "indoors, no-npcs, anti-magic", "coord": {"id": 1, "name": "Alyria", "x": 1724, "y": 685}, "exits": {"n": "41011", "door": {}}}��
[38;5;11m Tellerium Parcel Service                               [38;5;12m-      [38;5;12m[38;5;11mN     [38;5;12m -[0m
[38;5;12m(-------------------------------------------------)     [38;5;12m- [38;5;12m&lt;-[38;5;12m-[38;5;12m-([38;5;13mM[38;5;12m)-[38;5;12m-[38;5;12m-&gt; [38;5;11m[38;5;12m-[0m
                                                        [38;5;12m-      [38;5;12m-     [38;5;12m -[0m

  [0mCooperating with the international network of delivery services, one may
have nearly anything imaginable shipped to this spot for pickup.  Ignoring
an old lady trying to box a bulky package for delivery to her nephew in
Sigil, the clerk offers you his assistance.  
[0m     <get name="a burnished silver collar" desc="a burnished silver collar">A sparkling burnished silver collar lies here reflecting light.</get>
     <get name="a page of parchment" desc="a page of parchment">A faded yellow page of parchment has been dropped here.</get>
[38;5;13m(  2)[0m <get name="a large silver key" desc="(Invisible) a large silver key">[38;5;12m(Invisible) [0mA large silver key lies here.</get>
     <get name="a Remorhaz scale" desc="a Remorhaz scale">An iridescent scale lies here.</get>
     <get name="a stamp collector's book" desc="a stamp collector's book (new)">A book in which to put collected stamps is here.</get>
[0m[38;5;11m[Shop][0m[0m <pers name="a postal clerk" desc="a postal clerk">[0m[38;5;10mThe postal clerk is checking the log for what parcels have arrived today.[0m</pers>
[38;5;12m&lt;<V Hp>[0m1476</V>[38;5;12mhp <V Sp>[0m493</V>[38;5;12msp <V St>[0m822</V>[38;5;12mst&gt;[0m ���char.vitals {"hp": 1476, "sp": 493, "st": 822}����


And this is what the room usually looks like:

 Tellerium Parcel Service                               -      N      -
(-------------------------------------------------)     - <---(M)---> -
                                                        -      -      -

  Cooperating with the international network of delivery services, one may
have nearly anything imaginable shipped to this spot for pickup.  Ignoring
an old lady trying to box a bulky package for delivery to her nephew in
Sigil, the clerk offers you his assistance.  
     A sparkling burnished silver collar lies here reflecting light.
     A faded yellow page of parchment has been dropped here.
(  2) (Invisible) A large silver key lies here.
     An iridescent scale lies here.
     A book in which to put collected stamps is here.
[Shop] The postal clerk is checking the log for what parcels have arrived today.


I have edited the room packet directly through OnPluginPacketReceived to be able to show the room info since, like I said,

	res, val = CallPlugin("f67c4339ed0591a5b010d05b", "gmcpval", "room.num") -- calls the MM_GMCP_handler plugin


won't work until the second line of the compass. In fact, I did a trigger to show why, and here's what I got:

 Tellerium Parcel Service                               -      N      -
val = 
(-------------------------------------------------)     - <---(M)---> -
                                                        -      -      -


The trigger was

<triggers>
	<trigger enabled="y" keep_evaluating="y" match="^ Tellerium Parcel Service                               -      N      -$" omit_from_output="n" regexp="y" send_to="12" sequence="100">
		<send>res, val = CallPlugin("f67c4339ed0591a5b010d05b", "gmcpval", "room.num") -- calls the MM_GMCP_handler plugin
ColourNote("red", "black", "val = " .. val)</send>
	</trigger>
</triggers>


So the GMCP value is empty on the first line.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


40,534 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]