You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm working on a project that will allow the definitions of Events (in RPG Maker a Game) using Ruby Script. The problem is that those events are loaded in runtime (when needed) and I'd like to be able to tel SolarGraph that the ruby file (that will not contain class or def) is executed in a specific context : like if it was a "method" of the Interpreter class.
Basically, I'll have this kind of file :
# @context Interpreter.instancechoice=message("Hello there.",1,"General Kenoby?","Hello")casechoicewhen0# Choice was General Kenoby?start_battle("battles/Grievous")when1# Hello# ...end
I want to be able to have the hints when I write the various event commands.
If you wonder this event will be loaded this way (not the actual way but that's the command that will be used) :
When the interpreter updates it'll call @fiber.resume if fiber is not nil.
If you think that's useless you can directly close the issue ^^' I just want to make it easier for the one who will use the Ruby Events.
Note 1 : The game will use the eval stuff only in debug. When the game will be compiled, all the events will also be compiled to RubyVM::InstructionSequence with the right decoration (proc & cache management).
Note 2 : I use a Fiber because the message method will give the control back to the interpreter before returning the value. It'll be the same for the start_battle function.
Note 3 : The @context tag is subject to discussion, I think it as an helper for solargraph to give the right hints ^^
The text was updated successfully, but these errors were encountered:
There's a @!domain directive that works something like what you're describing, although it's experimental and might change. You can use it to tell Solargraph to add a class or module's public methods to the global namespace. Example:
Hi, I'm working on a project that will allow the definitions of Events (in RPG Maker a Game) using Ruby Script. The problem is that those events are loaded in runtime (when needed) and I'd like to be able to tel SolarGraph that the ruby file (that will not contain class or def) is executed in a specific context : like if it was a "method" of the Interpreter class.
Basically, I'll have this kind of file :
I want to be able to have the hints when I write the various event commands.
If you wonder this event will be loaded this way (not the actual way but that's the command that will be used) :
When the interpreter updates it'll call
@fiber.resume
if fiber is not nil.If you think that's useless you can directly close the issue ^^' I just want to make it easier for the one who will use the Ruby Events.
Note 1 : The game will use the eval stuff only in debug. When the game will be compiled, all the events will also be compiled to RubyVM::InstructionSequence with the right decoration (proc & cache management).
Note 2 : I use a Fiber because the
message
method will give the control back to the interpreter before returning the value. It'll be the same for thestart_battle
function.Note 3 : The @context tag is subject to discussion, I think it as an helper for solargraph to give the right hints ^^
The text was updated successfully, but these errors were encountered: