How to get around the script call line break problem

Alrighty~


So I'm using Tsukihime's fantastic Choice Options script, right? Problem is, my conditions are stupid long and keep breaking the script call because of unfortunate line breaks.


For example,

Spoiler
disable_choice(1, $game_actors[1].skills.include?($data_skills[55]))
It's correct according to her script, but I keep getting an unexpected bracket error.


How do I get around this? If I need to make a new method (because I'm going to be doing a lot of checking to see if actor X has learned skill Y), how do I call it and where do I put it?


I know how to define the method, I think.

Spoiler
def skill_check(actor, skillID)


if


$game_actors[actor].skills.include?($data_skills[skillID])


return true


else


return false


end
If that's correct, then where would I stash it and how would I call it from a script call? I mean, I'm assuming that I could use my method within Tsukihime's method, right?


Urgh, why is the script box so small????
the script box was meant to simply call methods I think, but not sport what were meant to be in their own methods...

you need to define which class or module holds that method... so something like

module Gamma def self.skill_check(actor, skillID) return $game_actors[actor].skills.include?($data_skills[skillID]) endendto use it:Gamma.skill_check

or if you want, I think this will fit into the script box

Code:
x=$game_actors[id]y=x.skillsz=$data_skills[id]y.include?(z)
Alright, this is what I tried first:

x=$game_actors[1]y=x.skillsfire=$data_skills[52]stone=$data_skills[55]freeze=$data_skills[53]disable_choice(1, "y.include?(fire)")disable_choice(2, "y.include?(stone)")disable_choice(3, "y.include?(freeze)")And it gave me an undefined local variable or method for y. It think this is just a compatibility issue because Hime's script expects the argument to be in a string, and the script call box isn't liking my string.(Hime's script, for reference: http://www.himeworks.com/2013/03/06/choice-options/)

So I used the make-a-module option and SUCCESS IS MIIIIIIIIIIINE!!!!

Thank you so much for your help!
Probably because the parsing happens outside, so the variable is not there already

I bet this one would work:

Code:
x=$game_actors[1]$y=x.skills$fire=$data_skills[52]$stone=$data_skills[55]$freeze=$data_skills[53]disable_choice(1, "$y.include?($fire)")disable_choice(2, "$y.include?($stone)")disable_choice(3, "$y.include?($freeze)")
PS: you could also opt to put them inside class Game_Interpreter instead, so that you can use them by just skill_check
It was all in one script box. I don't know why it didn't like it.


(Oh, cool. I didn't know you could add on to Game_Interpreter. In any case, I'm a little afraid to do that, so I'm just leaving it in my own module. There are several other methods I want to write along a similar vein, so it's useful to me.)
I edited the post... you can take a look
Why don't you just use this?

disable_choice(1, "$game_actors[1].skills.include?($data_skills[52])")disable_choice(2, "$game_actors[1].skills.include?($data_skills[55])")disable_choice(3, "$game_actors[1].skills.include?($data_skills[53])")If it breaks incorrectly on long lines, YOU can force it to break correctly by putting a line break after a , or a ( or a [ - when it KNOWS something else is coming (and when a space would be valid between the lines).Saves using a lot of global variables that aren't needed.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-get-around-the-script-call-line-break-problem.24228/