Jump to content


Photo

Common Event Arguments

event

  • Please log in to reply
1 reply to this topic

#1 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 20 October 2012 - 07:10 PM

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

Posted Image

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?


#2 Tsukihime

Tsukihime

    Advanced Member

  • Ace Member
  • 7,120 posts
  • LocationToronto
  • RM Skill - Coder

Awards Bar:

Users Awards

Posted 15 December 2012 - 08:54 PM

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, 15 December 2012 - 09:01 PM.

All of my work can be found on my website:

banner200x40.png

You can follow me on any of these platforms:

logo_facebook40x40.pnglogo_twitter40x40.pnglogo_youtube40x40.pnglogo_patreon40x40.png

Go here for Bugs and Requests.

 

Want to become a beta tester for my plugins before they are released to the public?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users