Script Call Equivalent of Events

Status
Not open for further replies.

neoscully

Villager
Member
Joined
Dec 13, 2012
Messages
10
Reaction score
6
First Language
german
Primarily Uses
Hi, 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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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):



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])
but something like this would be okay (the first three lines all 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])
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.
 
Last edited by a moderator:

neoscully

Villager
Member
Joined
Dec 13, 2012
Messages
10
Reaction score
6
First Language
german
Primarily Uses
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.
 

TheCastle

Veteran
Veteran
Joined
Apr 2, 2012
Messages
150
Reaction score
2
First Language
English
Primarily Uses
Code:
$game_temp.reserve_common_event(id)
Galv mentioned this. It seems to work really well but I have question with this. Sorry i realize this is a pretty old thread.

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?
 

harvard1932

Veteran
Veteran
Joined
Nov 29, 2012
Messages
40
Reaction score
10
Primarily Uses
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.
 
Last edited by a moderator:

Napoleon

Veteran
Veteran
Joined
Dec 29, 2012
Messages
869
Reaction score
97
First Language
Dutch
Primarily Uses
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

Code:
$game_player.reserve_transfer(map_id, x, y, $game_player.direction)
 
Last edited by a moderator:

Tahlan

Veteran
Veteran
Joined
Jan 3, 2013
Messages
53
Reaction score
1
First Language
English
Primarily Uses
Thank you. I thought it would be something like that, but the params/indent was messing me up.
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.
 
Last edited by a moderator:

Gameshark1713

Warper
Member
Joined
Jan 16, 2013
Messages
1
Reaction score
0
First Language
English
Primarily Uses
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
 

Galv

Veteran
Veteran
Joined
Oct 1, 2012
Messages
1,306
Reaction score
1,575
First Language
English
Primarily Uses
RMMZ
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.
Try this:

Code:
a = $game_variables[31]b = $game_variables[23]$game_party.gain_item($data_items[a],
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

DeleteMe

Veteran
Veteran
Joined
Dec 30, 2012
Messages
55
Reaction score
0
First Language
English
Primarily Uses
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
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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.
 
Last edited by a moderator:

Tahlan

Veteran
Veteran
Joined
Jan 3, 2013
Messages
53
Reaction score
1
First Language
English
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
$game_player.followers.visible = true or false
 

Tahlan

Veteran
Veteran
Joined
Jan 3, 2013
Messages
53
Reaction score
1
First Language
English
Primarily Uses
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.  
 

Tahlan

Veteran
Veteran
Joined
Jan 3, 2013
Messages
53
Reaction score
1
First Language
English
Primarily Uses
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 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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top