• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
Sign in to follow this  
Followers 0
Tsukihime

Common Event Arguments

2 posts in this topic

Common Event Arguments

-Tsukihime

 

This script allows you to reserve common event arguments using script calls and then retrieve them in the common event.

 

Naturally, common events would be more flexible if you could pass in arguments, like functions in programs.

 

Download

 

Script: http://db.tt/R846qNLZ

 

Usage

 

You should set the arguments before making a common event call using a script call

 

add_cevent_args(1, 2, 3, ...)

 

Then, in the common event, you can retrieve them using script calls as well

 

args = $game_temp.common_event_args

 

You would use script calls to assign them to variables or switches or anything else you might want to do.

 

As an example, here is a "show picture" common event that takes the name of a picture to show as an argument, and then I use methods in Picture Wrapper to display the image

 

common_event_args.jpg

Share this post


Link to post
Share on other sites

I have added a convenience function that allows you to set the common event arguments directly.

 

1. In the configuration, you reserve a range of variables.

For example, if you write 1..10, that means $game_variables[1] through $game_variables[10] will be used for common event arguments.

 

2. Use the script call inside an event

 

set_cevent_args(arg1, arg2, ... )

 

The first reserved variable will store arg1.

The second reserved variable will store arg2.

And so on.

 

The variables will be re-used constantly, and cleared out after the common event finishes executing, so they will only be available during the life-time of the common event call.

 

3. Use "Conditional Branch" command as usual, checking the appropriate variables.

 

This is purely for convenience and saves you from having to retrieve the variables later yourself.

 

Note that if you are using non-numeric arguments, you will still have to use scripted conditional statements since RM's variables only support numbers (and integers at that...)

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.