You can use the Large Script Call script which combines multiple script calls together into one script call.
Script Call Equivalent of Events
RPG Maker VXAce SupportHi, as a newbie I have the following question.
I want to check if a certain variable is true:
$game_variables[12] = ($game_variables[6] == $game_variables[10]) && ($game_variables[7] == $game_variables[11]) && ($game_variables[8] == $game_variables[10]) && ($game_variables[9] == $game_variables[11])
This produces a script error in my event. How would be the correct syntax, please?
I want to check if a certain variable is true:
$game_variables[12] = ($game_variables[6] == $game_variables[10]) && ($game_variables[7] == $game_variables[11]) && ($game_variables[8] == $game_variables[10]) && ($game_variables[9] == $game_variables[11])
This produces a script error in my event. How would be the correct syntax, please?
It's probably caused by where your line breaks are. Can you take a screenprint of the event itself, showing the script command? It will be pretty easy to pinpoint.
Something like this would cause an error (the first three lines do not indicate that there's more to come on the next line):
but something like this would be okay (the first three lines all indicate that there's more to come on the next line):
Although - where are you putting this? In a Script Call, or as the script part of a Conditional Branch? The above is for a script call, but a conditional branch would not require the $game_variables[12] = at the start.
Also note, variables are usually numbers (in reality, you can put anything in there). But your condition there is going to return true or false, which would be better suited for putting into a switch rather than a variable.
Something like this would cause an error (the first three lines do not indicate that there's more to come on the next line):
Code:
$game_variables[12] = ($game_variables[6]
== $game_variables[10]) && ($game_variables[7] == $game_variables
[11]) && ($game_variables[8] == $game_variables[10])
&& ($game_variables[9] == $game_variables[11])
Code:
$game_variables[12] = ($game_variables[6] ==
$game_variables[10]) && ($game_variables[7] == $game_variables[11]) &&
($game_variables[8] == $game_variables[10]) &&
($game_variables[9] == $game_variables[11])
Also note, variables are usually numbers (in reality, you can put anything in there). But your condition there is going to return true or false, which would be better suited for putting into a switch rather than a variable.
Thank you very much!
It was unusual to me that the line break has such a relevance in a script language...
I solved it with a script and a switch(!) within an event.
Though I found now way to display a switch, I first copied the switch to a variable via set/script.
It was unusual to me that the line break has such a relevance in a script language...
I solved it with a script and a switch(!) within an event.
Though I found now way to display a switch, I first copied the switch to a variable via set/script.
Code:
$game_temp.reserve_common_event(id)
I noticed that the code wont wait for a common event to finish before moving on to the next line of code. Is there a way to force it so the common event completely finishes before executing
any of the code afterwords?
load scene call
how to remove picture on script call? Also,
show picture using: screen.pictures[1].show("pet1", 1, 320, 220, 100, 255,0) doesn't seems to work.
show picture using: screen.pictures[1].show("pet1", 1, 320, 220, 100, 255,0) doesn't seems to work.
change the text dialog background:
$game_message.background = 1 #0 = default blue, 1 = dim, 2 = transparent
Equip weapon
$game_actors[1].change_equip(0,$data_weapons[1])the 0 value in the above code snippet can have the following values:
0 = weapon
1 = shield
2 = headgear
3 = body-gear (armor)
4 = accessory
Transfer player
$game_message.background = 1 #0 = default blue, 1 = dim, 2 = transparent
Equip weapon
$game_actors[1].change_equip(0,$data_weapons[1])the 0 value in the above code snippet can have the following values:
0 = weapon
1 = shield
2 = headgear
3 = body-gear (armor)
4 = accessory
Transfer player
Code:
$game_player.reserve_transfer(map_id, x, y, $game_player.direction)
Okay, help a noob out, I cant quite figure out how to connect this code.
params = [$game_variables[99]]
choices = [$game_variables[100]]
choices.push("Yes")
choices.push("No")
params.push(choices)
params.push(0/1)
setup_choices(params)
if @branch[@indent] == 0
Event Yes
elsif @branch[@indent] == 1
Event No
Also how would somone do this script?
$game_party.gain_item($data_items[$game_variables[31]], $game_variables[23])
$game_party.gain_item($data_items[17], 1)
When represented as just numbers it fits on a single line and work perfect. I cant seem to figure out how to break it up so it will run with the variables.
Hey so this might sound like a strange request, but I'm wondering if there is a script call that can be used to edit the weapon tag of an item that Actor 1 for example is using... Its working as my enchanting system and I was hoping for common events to be my solution
Try this:
Code:
a = $game_variables[31]b = $game_variables[23]$game_party.gain_item($data_items[a],
You can do it in a single command - you've just got to make sure that where the line splits, the interpreter can see that there's more to come (usually an operator, a comma, or an opening bracket at the end of the line)
Like this:
$game_party.gain_item($data_items[$game_variables[31]], $game_variables[23])You could probably have the first two on the same line, or the last two on the same line, if they will fit. There are other ways to break it up, but doing it like this leaves it more readable still.
Like this:
$game_party.gain_item($data_items[$game_variables[31]], $game_variables[23])You could probably have the first two on the same line, or the last two on the same line, if they will fit. There are other ways to break it up, but doing it like this leaves it more readable still.
I think the show pictures in the original post is a little off.
When I tried it this worked for me:
screen.pictures[index]show(file_name, upperleft/center, x, y, x zoom, y zoom, opacity, blend type)
command_231 in Game_Interpreter
@param[1] - file name
@param[2] - upper left / center (0 or 1)
@param[3] - use variables (0 or 1) Only used by command_231; 1 means param[5] and param[6] is a variable #
@param[4] - x
@param[5] - y
@param[6] - x zoom (in percents)
@param[7] - y zoom (in percents)
@param[8] - opacity (0 to 255)
@param[9] - blend (0,1,2)
@param[0] - index
When I tried it this worked for me:
screen.pictures[index]show(file_name, upperleft/center, x, y, x zoom, y zoom, opacity, blend type)
command_231 in Game_Interpreter
@param[1] - file name
@param[2] - upper left / center (0 or 1)
@param[3] - use variables (0 or 1) Only used by command_231; 1 means param[5] and param[6] is a variable #
@param[4] - x
@param[5] - y
@param[6] - x zoom (in percents)
@param[7] - y zoom (in percents)
@param[8] - opacity (0 to 255)
@param[9] - blend (0,1,2)
@param[0] - index
I wrote up something regarding reproducing Show Choice using script calls
http://forums.rpgmakerweb.com/index.php?/topic/8379-show-choice-via-script-call/#entry88447
If anyone has managed to successfully do it, maybe they can clarify anything I might be missing out on (like any tricks that I have missed. I only look at the code I didn't think of ways to solve the problem cleverly)
For now, I think it is unfeasible to do anything with Choices using script calls.
I guess the only case that needs to be reproduced is having more than 4 choices at a time since that's pretty much what you would use it for.
http://forums.rpgmakerweb.com/index.php?/topic/8379-show-choice-via-script-call/#entry88447
If anyone has managed to successfully do it, maybe they can clarify anything I might be missing out on (like any tricks that I have missed. I only look at the code I didn't think of ways to solve the problem cleverly)
For now, I think it is unfeasible to do anything with Choices using script calls.
I guess the only case that needs to be reproduced is having more than 4 choices at a time since that's pretty much what you would use it for.
Change Player Followers:
$game_player.followers = true or false
This does not seem to work. Anyone know why? I know there is a simple event for it. Looking for the script counterpart.
$game_player.followers = true or false
This does not seem to work. Anyone know why? I know there is a simple event for it. Looking for the script counterpart.
$game_player.followers.visible = true or false
Thank you Shaz, couldn't figure out why it was not working till I looked and realized you needed to call a refresh if you wanted it to take effect right away.
Next question. I am working on a game that has well over 300 actors. Obviously the player will only have access to a small group of them at a time. However I want to player to have the option to name them. The standard event to change player name does not allow for variables. I already have the actor ID stored in a variable I am looking for a way to use the variable in a change name event allowing the player to name any of the actors.
Next question. I am working on a game that has well over 300 actors. Obviously the player will only have access to a small group of them at a time. However I want to player to have the option to name them. The standard event to change player name does not allow for variables. I already have the actor ID stored in a variable I am looking for a way to use the variable in a change name event allowing the player to name any of the actors.
So you would probably have a "dummy" actor whose name they can change, and use that for Name Input Processing. Let's say it's actor id 301. And let's say your variable that contains the actor id whose name you want to change is variable 1.
You'd do something like this:
$game_actors[$game_variables[1]].name = $data_actors[301].name
I'm not sure of timing though - whether you'd have to do this AFTER adding them to the party, or if you could do it before.
You'd do something like this:
$game_actors[$game_variables[1]].name = $data_actors[301].name
I'm not sure of timing though - whether you'd have to do this AFTER adding them to the party, or if you could do it before.
You know as I was stubbling down the stairs this morning I had this same thought. Got home from work and thought this should be easy enough. Well here is what I found out. I added Actor 500 to my group ran the name procceser on it and then sets another persons actors name to his just like your script here.
$game_actors[$game_variables[1]].name = $data_actors[500].name
To my dismay the actor in the variable always got the default name of the actor not the new name of the actor. When I ran some echo prints I leaned that any time I referenced actor 500 name I would come up the default name and not the renamed version even if he was sitting in my party with his new name.
print $data_actors[500].name
So in my party screen actor 500 was Fred but resulted in the default name of "name" when printed like above, as a result anyone I was trying to pass that name to would end up with the name of "name".
All however is not lost, I discovered that name proccessing is haddled in the script scene_name.
def on_input_ok @actor.name = edit_window.name $game_variables[500]= @edit_window.name return_scene end
By placing an extra line of code setting variable 500 to the name it was using in the script I am able to capture the name while still in name proccessing. I can then then set the name of the character in question using the simple script
$game_actors[$game_variables[222]].name = $game_variables[500]This works every time and you dont even have to add actor 500 to the party first.
Now on to my next question as I am getting particulary fond of scripting and I dont want to violate the double post rule. Does anyone know how to push a text box while still in a script?
Code:
If a > bpush text box <--not real code else $game_variables[2]=50end
I wonder if I should have said to use $game_actors rather than $data_actors?
Check the Interpreter and see what it does to cause a message box to come up. Again, this might be a bit detailed, as it's not just a simple command - if you look at Show Message in the Interpreter, it does quite a bit of setting things up, then sets a flag so Game_Message takes over.
Check the Interpreter and see what it does to cause a message box to come up. Again, this might be a bit detailed, as it's not just a simple command - if you look at Show Message in the Interpreter, it does quite a bit of setting things up, then sets a flag so Game_Message takes over.
Original thread: https://forums.rpgmakerweb.com/threads/script-call-equivalent-of-events.6248/