module Gamefic::Scriptable
A class module that enables scripting.
Narratives extend Scriptable
to enable definition of scripts and seeds. Modules can also be extended with Scriptable
to make them includable to other Scriptables.
@example Include a scriptable module in a plot
module MyScript extend Gamefic::Scriptable respond :myscript do |actor| actor.tell "This command was added by MyScript" end end class MyPlot < Gamefic::Plot include MyScript end
Public Instance Methods
Source
# File lib/gamefic/scriptable.rb, line 40 def included_scripts ancestors.that_are(Scriptable).uniq end
Source
# File lib/gamefic/scriptable/seeds.rb, line 66 def pick *args Proxy::Pick.new(*args) end
Lazy pick an entity.
@example
pick('the red box')
@param args [Array] @return [Proxy::Pick]
Also aliased as: lazy_pick
Source
# File lib/gamefic/scriptable/seeds.rb, line 76 def pick! *args Proxy::PickEx.new(*args) end
Lazy pick an entity or raise an error.
@note The class method version of ‘pick!` returns a proxy, so the error
won't get raised until it gets unproxied in an instance.
Also aliased as: lazy_pick!