Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ Hyperlink in OnPluginPacketReceived
Hyperlink in OnPluginPacketReceived
|
Posting of new messages is disabled at present.
Refresh page
Pages: 1 2
Posted by
| Areadien
USA (47 posts) 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-- | Top |
|
Posted by
| Fiendish
USA (2,533 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 15 Apr 2020 07:13 AM (UTC) |
Message
| |
Posted by
| Areadien
USA (47 posts) 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.
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. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) 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 | Top |
|
Posted by
| Areadien
USA (47 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) 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 | Top |
|
Posted by
| Areadien
USA (47 posts) 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. | Top |
|
Posted by
| Fiendish
USA (2,533 posts) 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 | Top |
|
Posted by
| Areadien
USA (47 posts) 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. | Top |
|
Posted by
| Areadien
USA (47 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) 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 | Top |
|
Posted by
| Fiendish
USA (2,533 posts) 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 | Top |
|
Posted by
| Areadien
USA (47 posts) 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<-[38;5;12m-[38;5;12m-([38;5;13mM[38;5;12m)-[38;5;12m-[38;5;12m-> [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<<V Hp>[0m1476</V>[38;5;12mhp <V Sp>[0m493</V>[38;5;12msp <V St>[0m822</V>[38;5;12mst>[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. | 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.
47,387 views.
This is page 1, subject is 2 pages long: 1 2
Posting of new messages is disabled at present.
Refresh page
top