Interpreter Script Call Fix
Authors: Juan, Blizzard
Version: 1.0
Type: Bug Fix
Key Term: Misc Add-on
IntroductionThis script fixes the interpreter script call when you use $game_system.anything = false it would normal frezze this script fixes that.
Features
- Fixes the call script
- Plug in and play
ScreenshotsN/A for this type of script.
DemoN/A
Script
class Interpreter
SCRIPT_WAIT_RESULTS = [:wait, FalseClass]
#-------------------------------------------------------------------
# * Script
#-------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Store index in case we need to wait.
current_index = @index
# Loop
loop do
# If next event command is second line of script or after
if @list[@index+1].code == 655
# Add second line or after to script
script += @list[@index+1].parameters[0] + "\n"
# If event command is not second line or after
else
# Abort loop
break
end
# Advance index
@index += 1
end
# Evaluation
result = eval(script)
# If return value is false
if SCRIPT_WAIT_RESULTS.include?(result)
# Set index back (If multi-line script call)
@index = current_index
# End and wait
return false
end
# Continue
return true
end
end
InstructionsJust make a new script and post it above main
CompatibilityCompatable with sdk.
Credits and Thanks
- Juan
- Boris "Blizzard" Mikić
- Zeriab
Author's NotesIf there are any bugs please post it or email me at juanpena1111@yahoo.com
and credit me.
I love you. <3 *powers up*
i... dont get it....?
@Blizzard thanks for the power up.
@Susys If you tried using
game_system.save_disabled = false
or something similar to that the game would frezze.
I get en error everytime I run my game with it I've put it below all the scripts and above main. I've tried above blizz's scripts and below mine. I've tried above mine as well but here are the errors I am getting please help!
(http://gameguy27.l4rge.com/error.png)
(http://gameguy27.l4rge.com/lineerror.png)
The things in the red square are the scripts The only ones I didnt make are the ABS 1-3 the Hud and the Script call fix.
(http://gameguy27.l4rge.com/scripts.png)
Just take away the parentheses (accept for the ones around "script") and the "= true" part; it's unneeded.
ie
I still got a syntax error
class Interpreter
#--------------------------------------------------------------------------
# * Script
#--------------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Loop
loop {
# If next event command is not second line of script or after
if @list[@index+1].code != 655
# Abort loop
break
end
# Add second line or after to script
script += @list[@index+1].parameters[0] + "\n"
# Advance index
@index += 1
}
# Evaluation and return resulting value
return eval(script) = true
end
end
GG... you didn't even change what WcW told you to change...
I did too didnt I?
You didn't take off the "= true" part.
Oh lol I couldn't remember what part I forgot to change. I'll update my post.
Is there any way to make the game not crash on syntax error? I want to make a "command prompt" thing, for beta testing, that doesn't crash if you type something that would cause an error.
Great script though!
I'll have to look into that.
I've seen one of those on another forum. All you'd do is get a keyboard input script, make an input box, have it eval on enter, and output to another window. To keep it from crashing, you'd just use rescue.
can you find me a link, WcW?
Just search for console on RMXP.org. I'll see if I can find it myself, though :P
I found it, thanks for the tip, WcW!
Reviving this topic because I don't feel this 'fix' properly fixes the problem.
If the result of evaluating the script is false then it will wait just like normally.
It doesn't wait on multi-line script calls. Two lines of
false will for example cause the event to wait one frame before continuing.
That said the waiting feature is nice and should be kept. Having false as what's triggering the wait is perhaps not the best idea since accidental waiting is likely to happen.
Of course you can just put
$game_switches[42] in a call script to wait until that switch is turned on. (No wait if it already is on)
My own fix is this:
class Interpreter
SCRIPT_WAIT_RESULTS = [:wait, FalseClass]
#-------------------------------------------------------------------
# * Script
#-------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Store index in case we need to wait.
current_index = @index
# Loop
loop do
# If next event command is second line of script or after
if @list[@index+1].code == 655
# Add second line or after to script
script += @list[@index+1].parameters[0] + "\n"
# If event command is not second line or after
else
# Abort loop
break
end
# Advance index
@index += 1
end
# Evaluation
result = eval(script)
# If return value is false
if SCRIPT_WAIT_RESULTS.include?(result)
# Set index back (If multi-line script call)
@index = current_index
# End and wait
return false
end
# Continue
return true
end
end
It fixes the multi-line issue and I use
:wait to when it should wait. The
FalseClass check is for providing compatibility with and older version of mine.
To wait for switch 42 to be on you now have to use something like
:wait unless $game_switches[42].
Considering how it can ease certain integration issue it's stupid not to keep that feature :3
*hugs*
I'll update the main post with yours.