PDA

View Full Version : sea-charts: A narost derivative for OSA



Jymamon
11-27-2022, 06:09 PM
2022-11-30: Should now work with Lich5/GTK3 as well as Lich4/GTK2

Actually, two scripts....

osa-map-plugin - a map data provider for OSA rooms.

If running Lich 4.x: This needs ;trust or the classes won't be available to other scripts, such as sea-charts.
Map data currently inline. At some point, I should move it to an external data file.
Exposes OsaMap (equivalent of lich's Map) and Ocean (equivalent of lich's Room)
"equivalent", not identical, classes. More notes at the end for the scripters who are interested. Most users won't need to read that
On exit, stores the last known room for next startup.


sea-charts - the actual narost clone

If running Lich 4.x: This needs ;trust because it will download and display the map
Doesn't support displaying tags (there's very few in the data, anyhow)
Doesn't support click-room to sail there
Currently uses a basic map with room numbers.
Want the fancy map?

Download Arianiss's pretty map (https://gswiki.play.net/File:Open_Sea_Adventures.jpg) from the wiki.
Save it to your maps directory

Don't know where that is? Run ";eq echo MAP_DIR" to find out.

start sea-charts with the --fancy flag - ";sea-charts --fancy"

If your current room is known, you get a little ship icon.
If your current room is unknown, but you've been in a known room, marks the last known room with question mark icon.


Use:


;repos download osa-map-plugin
;repos download sea-charts
;osa-map-plugin


Then, when you're sailing


;sea-charts
You'll need to look at the map in the captain's quarters at least once after you've launched.

I keep trying to cram in one-more-thing. If you hit any issues, post here and I'll address them.


Scripty stuff for those who care below here - most folks don't need this

Ocean is just a sub-class of OsaMap - these notes apply to both.

OsaMap class level members -it is kinda like Map, but not an exact clone

current -> returns the current map room

So long as osa-map-plugin is running, it will do its best to keep all of those up-to-data.
See set_current() if you'd rather manage it.

lastknown -> returns the last map room that was actually mapped

So long as osa-map-plugin is running, it will do its best to keep all of those up-to-data.
See set_lastknown() if you'd rather manage it.

list -> returns a list of all rooms
OsaMap[n] -> gets room with id n
set_current() -> sets a given room (by id) as current
set_lastknown() -> sets a given room (by id) as lastknown


OsaMap instance members

column -> returns the map column for the room
dijkstra() - dijkstra pathing algoritm for reaching one or more rooms

path_to() is a thin wrapper and generally more friendly

inspect -> dumps the instance data
is_mapped? -> true if the room has map coordinates
location - which ocean the room is in
make_current() -> sets the instance as `current` for OsaMap

osa-map-plugin should manage this, but here if you want to use it

make_lastknown() -> sets the instance as `lastknown` for OsaMap

osa-map-plugin should manage this, but here if you want to use it

map_coords -> a hash that gets to column and row
maphash -> MD5 of the in-game map used to kinda uniquely identify the room

These aren't entirely unique. There's ~10 pairs of rooms that hash identical even also matching on location

path_to(int or int[]) ->

if given an int, returns the shorest path to the room with that id
if given an array, returns the shortest path to the nearest room in the list.

no guarantees on which room if multiple are equidistant

because of the grid like map, multiple routes can have the same cost, no guarantees on which is used
returns nil if there is no path available

row-> returns the map row for the room
to_i -> alias to get the room id
to_s -> gets a short string for identifying the room
tags -> a list of string tags. Mostly unused, but bugged rooms are tagged "bugged" and ports are tagged "Port of {Town}"
wayto -> :cardinaldirection to adjacent room map

Tgo01
11-27-2022, 06:14 PM
Well I guess this is replacing ;ocean-go2 :(

Awesome script.

Jymamon
11-27-2022, 06:16 PM
Well I guess this is replacing ;ocean-go2
This doesn't have ;go2 functionality, though the underlying map provider supports everything you need if you want to simplify ;ocean-go2. It'll manage the map and routing, you'll still need to do all the anchor, sail, and wheel management, etc

Jymamon
11-27-2022, 06:34 PM
Added saving/restoring lastknown for next startup.

horibu
11-28-2022, 10:45 AM
Jymamon,
I just thought I'd point out that ;trust isn't needed if running newer versions of Ruby (which most people likely are due to upgrading to Lich5). It's an old system of protection that really didn't do much and was removed in current versions of Ruby. The EO team is actually prepping the next version of Lich to be compatible with Ruby v3 which actually has issues with $SAFE variable which is what ;trust was setting and therefore removing it completely from most all scripts that reference it. Just thought I'd mention it for you.

horibu
11-28-2022, 10:46 AM
Btw, this is really great code. Looking forward to using it myself the next time I take my carrack out on the ocean! Nicely done.

Jymamon
11-28-2022, 02:39 PM
I just thought I'd point out that ;trust isn't needed if running newer versions of Ruby

Good to know. I'm running newer stuff on my work machine, but never upgraded at home. I'll use this as motivation to finally do that and update the instructions. Thanks!


Btw, this is really great code.

Thanks.

Jymamon
11-30-2022, 06:02 AM
Fixed for GTK3 - should now work with both Lich 4 and Lich 5
Updated a few rooms around Ta'vaalor that were wrong and/or have changed.

Silvanostar
12-02-2022, 04:18 PM
not sure whats the issue but every time i open up sea-charts and i try to click a room, my wizard client crashes

horibu
12-02-2022, 04:37 PM
not sure whats the issue but every time i open up sea-charts and i try to click a room, my wizard client crashes


Doesn't support click-room to sail there

It doesn't support click support as per the original announcement. Not yet at least. So for right now it's more just a reference guide to where you are for visual purposes.

Silvanostar
12-02-2022, 06:26 PM
ah whoops. i'll have to be more careful when i move the gui around on my screen.

Jymamon
12-02-2022, 06:29 PM
i try to click a room, my wizard client crashes


That's not expected. I'll look into it and have an update out today or tomorrow.

Jymamon
12-02-2022, 07:11 PM
Uploaded a temporary block for map drag functionality when running the Wizard and Lich 5 (Wrayth and Lich 4 or Lich 5 works fine. Wizard and Lich 4 works fine... it is just that one combination).

This stops it from crashing out the client but loses the ability to just drag around the map. Scroll bars still work.

I'll dig in more and get a proper fix, but crashing the client just isn't acceptable.

If anyone running another front end encounters this, let me know and I'll block the code for that combination as well.

Jymamon
12-02-2022, 08:44 PM
This should now be fixed with version 2022.12.01.2. Let me know if you still see any issues.

Nisugi
06-25-2023, 05:03 PM
They're going to be releasing an installer for Ruby 3.2 and Lich 7 very soon. There are 2 items that were deprecated in Ruby that are in use here.

File.exists? needs to be changed to File.exist? in sea-charts.

Fixnum and Bignum are deprecated into Integer which those are used in the plugin.

Excellent piece of work.

Jymamon
06-25-2023, 09:29 PM
They're going to be releasing an installer for Ruby 3.2 and Lich 7 very soon. There are 2 items that were deprecated in Ruby that are in use here.

Thanks for the head's up.


Excellent piece of work.

Thanks, but the real credit goes back to Tillmen for the original narost and Lost Ranger for the xnarost version I blatantly copied from.

Jymamon
06-30-2023, 10:24 PM
They're going to be releasing an installer for Ruby 3.2 and Lich 7 very soon. There are 2 items that were deprecated in Ruby that are in use here.

Updated.