class Olib::Go2
@brief ;go2 wrapper class
Public Class Methods
cost(to)
click to toggle source
Thanks Tillmen
# File lib/Olib/go2.rb, line 94 def Go2.cost(to) cost = 0 Map.findpath(Room.current.id, to).each { |id| Room[id].tags.each { |tag| if tag =~ /^silver-cost:#{id-1}:(.*)$/ cost_string = $1 if cost_string =~ /^[0-9]+$/ cost += cost_string.to_i else cost = StringProc.new(cost_string).call.to_i end end } } cost end
fwi()
click to toggle source
# File lib/Olib/go2.rb, line 56 def Go2.fwi unless Char.fwi_teleporter echo "Error: No teleport defined ;var set teleporter=<teleporter>" exit end unless Inventory.fwi_teleporter echo "Error: Your teleporter could not be found #{Go2.teleporter}" exit end last = Room.current.id teleporter = Inventory.fwi_teleporter if teleporter.worn? teleporter.turn else teleporter.take.turn.stash end if Room.current.id == last echo "Error: You tried to teleport to FWI in a room that does not allow that" end Go2 end
fwi_teleport()
click to toggle source
use the teleporter variable to locate your teleporter and teleport naive of where you are
# File lib/Olib/go2.rb, line 113 def Go2.fwi_teleport Go2.fwi end
locker()
click to toggle source
TODO create a dictionary of house lockers and the logic to enter a locker insure locker is closed before scripting away from it
# File lib/Olib/go2.rb, line 120 def Go2.locker echo "the go2_locker method currently does not function properly..." self end
origin()
click to toggle source
# File lib/Olib/go2.rb, line 50 def Go2.origin Go2.room @@origin[:roomid] Char.hide if @@origin[:hidden] Go2 end
rebase()
click to toggle source
# File lib/Olib/go2.rb, line 82 def Go2.rebase @@origin = {} @@origin[:roomid] = Room.current.id @@origin[:hidden] = hiding? @@origin[:location] = Room.current.location Olib.debug "rebasing to #{@@origin}" Go2 end
room(roomid)
click to toggle source
# File lib/Olib/go2.rb, line 41 def Go2.room(roomid) unless Room.current.id == roomid || Room.current.tags.include?(roomid) Char.unhide if hidden start_script "go2", [roomid, "_disable_confirm_"] wait_while { running? "go2" }; end Go2 end