-
Notifications
You must be signed in to change notification settings - Fork 53
FEAT(efamgo2.lic): v1.0.0 - Fork and update of famgo2.lic #1943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
AndreasWelch
wants to merge
2
commits into
elanthia-online:master
from
AndreasWelch:Feat(efamgo2.lic)-fork-script
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| =begin | ||
|
|
||
| Ever had your familiar/eye stranded somewhere? | ||
|
|
||
| This script tells your familiar to walk to a room#. | ||
| It's not fool-proof since they sometimes cannot enter certain areas. | ||
|
|
||
| Note: | ||
| The script will pause if there's a special procedure for the area. | ||
| It's up to you to figure out what to tell you pet from then on. | ||
| Unpause the script when you resolve the special procedures. | ||
|
|
||
| --Drafix | ||
|
|
||
| Fork of famgo2.lic by Drafix. | ||
|
|
||
| author: elanthia-online | ||
| contributors: Drafix, Dissonance | ||
| game: any | ||
| tags: movement, step2, go2, move2, familiar, eye | ||
| version: 1.0.0 | ||
|
|
||
| Change Log: | ||
| v1.0.0 (2025-05-01) | ||
| - initial release and fork from famgo2.lic | ||
| - add support for u##### (real ID#s) | ||
| =end | ||
|
|
||
| module EFAMGO2 | ||
| # make sure we have proper input | ||
| unless Script.current.vars[1] =~ /^u?[0-9]+$/ | ||
| Lich::Messaging.mono("usage: #{$lich_char}#{script.name} <room number>") | ||
| exit | ||
| end | ||
|
Comment on lines
+31
to
+34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be included inside of a method that is called outside of the of module module Name
# module contents
def self.do_something
# method contents
end
end
if Script.current.vars[1] =~ /^u?[0-9]+$/
Name.do_something
else
Lich::Messaging.mono("usage: #{$lich_char}#{Script.current.name} <room number>")
exit
end |
||
|
|
||
| Map.load if Map.list.empty? | ||
| seeking = $go2_use_seeking | ||
| $go2_use_seeking = false | ||
| before_dying { $go2_use_seeking = seeking } | ||
| $step2_path = [] | ||
AndreasWelch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fam = 'familiar' if Lich::Gemstone::Stats.prof == 'Wizard' | ||
| fam = 'eye' if Lich::Gemstone::Stats.prof == 'Sorcerer' | ||
AndreasWelch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # determine if the user provided a real room number (u#) or a lich room number, and if it exists | ||
| if Script.current.vars[1] =~ /^[0-9]+$/ | ||
| unless (destination_room = Room[script.vars[1]]) | ||
AndreasWelch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Lich::Messaging.msg("error", "destination room was not found in the map database") | ||
| exit | ||
| end | ||
| elsif Script.current.vars[1] =~ /^u[0-9]+$/ | ||
| unless (destination_room = Room[Map.ids_from_uid((Script.current.vars[1])[1..-1].to_i).first]) | ||
| Lich::Messaging.msg("error", "destination room was not found in the map database") | ||
| exit | ||
| end | ||
| end | ||
|
|
||
| # force the familiar to look, so that we can get the current location | ||
| fput("tell #{fam} to look") | ||
| fput("look #{Char.name}") | ||
| line = get until line == 'At yourself?' | ||
|
|
||
| # strip the real room number from the room name, turn it into an integer, find the lich room # from the real room number, and then get the room | ||
| # unless start_room = Room[Map.ids_from_uid(/(\d+)/.match(XMLData.familiar_room_title.strip)[1].to_i).first] | ||
| unless (start_room = Room[modify_room_display(XMLData.familiar_room_title.strip)]) | ||
| Lich::Messaging.msg("error", "familiar's room is unknown") | ||
| exit | ||
| end | ||
|
|
||
| # if you want to go where your are, then we're done here | ||
| if start_room == destination_room | ||
| Lich::Messaging.msg("warn", "start room and destination room are the same") | ||
| exit | ||
| end | ||
|
|
||
| # start moving to the destination | ||
| unless $step2_path and (s = $step2_path.index(start_room.id)) and (d = $step2_path.index(destination_room.id)) and (s < d) | ||
| previous, _ = Map.dijkstra(start_room.id, destination_room.id) | ||
| unless previous[destination_room.id] | ||
| Lich::Messaging.msg("error", "error: failed to find a path between your current room (#{start_room.id}) and destination room (#{destination_room.id})") | ||
| exit | ||
| end | ||
| $step2_path = [destination_room.id] | ||
| $step2_path.push(previous[$step2_path[-1]]) until previous[$step2_path[-1]].nil? | ||
| $step2_path.reverse! | ||
| nil | ||
| end | ||
|
|
||
| while (room = Room[$step2_path[$step2_path.index(start_room.id) + 1].to_s]) | ||
| way = start_room.wayto[$step2_path[$step2_path.index(start_room.id) + 1].to_s] | ||
|
|
||
| if start_room == destination_room | ||
| Lich::Messaging.msg("info", 'Your familiar has arrived.') | ||
| exit | ||
| elsif way.class == String | ||
| if way =~ /([a-z]+) (.*)/ | ||
| if $1 == 'go' | ||
| fput("tell #{fam} to go #{$2}") | ||
| elsif $1 == 'climb' | ||
| fput("tell #{fam} to go #{$2}") | ||
| end | ||
| else | ||
| fput("tell #{fam} to go #{way}") | ||
| end | ||
|
|
||
| sleep 0.01 | ||
| start_room = room | ||
| elsif way.class == Proc | ||
| if way.inspect =~ /(?:go|climb) (.+?)'/ | ||
| fput("tell #{fam} to go #{$1}") | ||
| elsif way.inspect =~ /(northeast|northwest|southeast|southwest|north|east|south|west|up|down|out)/ | ||
| fput("tell #{fam} to go #{$1}") | ||
| end | ||
|
|
||
| start_room = room | ||
| else | ||
| Lich::Messaging.msg("error", "error in the map database") | ||
| exit | ||
| end | ||
| end | ||
|
|
||
| # we're done, take a look to show where we finished | ||
| fput("tell #{fam} to look") | ||
| end | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.