イベント自体に変数を設定することができます – RS_SelfVariables.js

タイトル
This plugin allows you to set up the variable on event itself.
作者名
ヘルプ
Self Variables are containers that store values. Such a value can either be
a number or a string. A self variable is given a key that you can refer to,
and you can use the key to inspect the value and to change it.
============================================================================
Scripts & Built-in Variables
============================================================================
Changing a variable in a script command is very simple, you can use this method
to assign a new value.

Method :
RS.SelfVariables.setValue(key, value);

For example, to set a new value, you could use the following piece of code.
The 'x' is built-in variable, if this sets to certain value, so it will really
be changed an event position :

RS.SelfVariables.setValue('x', 20);

Even getting stored variable in a script command is very simple, you can use
this method to get it.

Method :
RS.SelfVariables.value(key);

It is vitally important to realize that variable keys are case-sensitive,
that is, 'Key' is not the same as 'key'.This plugin is also there are a number
of built-in variables, like x and y, which indicate the position of this event.
For example, to get it, you could use the following piece of code :

These give a result in a integer value :
var x = RS.SelfVariables.value('x');
var y = RS.SelfVariables.value('y');
var dir = RS.SelfVariables.value('direction');
var screenX = RS.SelfVariables.value('screenX');
var screenY = RS.SelfVariables.value('screenY');
var screenZ = RS.SelfVariables.value('screenZ');
var characterIndex = RS.SelfVariables.value('characterIndex');
var moveSpeed = RS.SelfVariables.value('moveSpeed');
var moveFrequency = RS.SelfVariables.value('moveFrequency');
var opacity = RS.SelfVariables.value('opacity');

These give a result in a string value :
var name = RS.SelfVariables.value('name');
var characterName = RS.SelfVariables.value('characterName');

The Built-in variables are :
'x', 'y', 'direction', 'moveSpeed', 'moveFrequency', 'opacity'

It is also vitally important to realize that 'screenX', 'screenY', 'screenZ',
'id', 'name', 'characterName', 'characterIndex' variables are read-only,
So these variables are not change as you expect.

============================================================================
How to use Scripts
============================================================================

RS.SelfVariables.setValue(1, 'Hi, guys');
=> This code stores a value called 'Hi, guys'.

RS.SelfVariables.value(1);
=> This code returns the value called 'Hi, guys'.

-----------------------------------------------------------------------------
In case of Common Events
-----------------------------------------------------------------------------
It's the same as above if you need to save the value.
var key = RS.SelfVariables.setValue(1, 'Hi, guys');
var s = RS.SelfVariables.value(key);
$gameMessage.add(s);

-----------------------------------------------------------------------------
In case Of Battle Events
-----------------------------------------------------------------------------
var key = RS.SelfVariables.setValue(1, 'Hi, there!');
var s = RS.SelfVariables.value(key);
$gameMessage.add(s);

============================================================================
Plugin Command
============================================================================
GSV set key value
GSV get key

============================================================================
Version Log
============================================================================
2016.07.25 (v1.0.0) - First Release.
2017.04.29 (v1.0.1) - Added built-in variables like x, y, direction.
2022.01.12 (v1.0.2) :
- Removed the variable named 'Imported' from the global scope.
- Fixed the plugin structure by adding a new pattern such as '.mixin' or '.extend'.
- Removed reserved word named 'var' in this plugin, However some of code block are still used a reserved word named 'var' instead of 'let' or 'const'.
パラメータ
target MV
param Save notifying variable
type boolean
desc
default false

param notifying variable number
type variable
desc
default 1

ライセンス表記
  • MIT License
The MIT License
Copyright (c) 2016 biud436
Free for commercial and non commercial use.

紹介ページ https://github.com/biud436/MV/blob/master/RS_SelfVariables.js