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
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