My big question is why is BOWS empty.
So basically ive tried writing a few skils, but ever since I wrote potions append doesnt work. When I try to read from it, it reads Nothing, and if I send_message the variable it puts out blank space. My question is am I doing soemthing wrong?
Ignore the code it is hardly finished, and appending was in a different class just I tried putting it in the same class to see if it would work. I need bow to read the unstrung variable, but it reads nothing.
When I send_message the variable BOWS[primary]
Code:
require 'java'
java_import 'org.apollo.game.action.Action'
java_import 'org.apollo.game.model.Animation'
java_import 'org.apollo.game.event.impl.ItemActionEvent'
java_import 'org.apollo.game.model.Skill'
BOW_STRING = 1777
BOWS = {}
class Bows
attr_reader :unstrung, :strung
def initialize(unstrung, strung)
@unstrung = unstrung
@strung = strung
end
end
class Fletchingaction < Action
attr_reader :started
def initialize(character, slot, bow)
super(0, true, character)
@character = character
@slot = slot
@bow = bow
@started = false
end
def execute
@started = true
character.inventory.add @bow.strung, 1
stop
end
end
on :event, :item_on_item do |ctx, player, event|
primary = event.id
secondary = event.target_id
player.send_message "#{BOWS[primary]}"
unless BOWS[primary].nil?
player.send_message "omg does it work?"
player.startAction Fletchingaction.new(player, event.slot, BOWS[primary])
end
end
def append_bows(bow)
BOWS[bow.id] = bow
end
append_bows Bows.new(50, 841) # Normal Shortbow