设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 90|回复: 0

[转载发布] Makai Object Variables

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    7959

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    29925
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    38778

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    Latest Version: v1.3

    Hello all, first time posting here i think. Not a native English speaker here! So i'm a newbie in JS but i'm loving it and i created my own plugin for RMMV. It's called "Object Variables".

    • Enables variables to hold infinite values (in the form of properties)
    • Simplified code for "Show Text"
    • Ability to get the values for conditions
    • Ability to use your variables' names instead of IDs
    • Compatibility (doesn't affect any other plugin as far as i've seen)
    • Doesn't do anything unless you want it to
    You can get the plugin here:
    Spoiler: DownloadSo what do I mean by "Object Variables":
    Spoiler: What are Object Variables?
    "Normal" variables hold a single value. "Object" type hold properties and each of those hold specific values. So, for example, If your variable is called "anything", then the object of "anything" could have anything.one=1, anything.two=2, anything.three=3, thus "anything" now has three properties, each holding its own value.

    In essence, this means a single variable can hold many values.
    Why should you get this plugin:
    Spoiler: What it does
    This plugin provides you a simplified control over creating, changing, getting and showing properties of object variables. On its own, the plugin doesn't do anything, so you can have it in your plugins manager even if you're not using it.
    You have control over name storage and case-sensitivity:
    Spoiler: Parameters
    So this version has two parameters:
    1. Case Sensitivity:

    This makes the letters' cases matter or not. If it's ON, "Trigger" and "trigger" are two different names, so you must pay attention to that if you call them. If it's OFF then they are all considered lower-case. For example "Trigger", "trigger", "TrIgGeR" are considered the same name.

    This goes for variable names too, if you have the Name holding variable set to a valid id.

    2. Name holding variable:

    Default is 0, which means it's turned off. You can set it to a variable which you will no longer use, and it will store the names of the variables to which you have added properties. Provided these names are unique, you can then call them by name in text, instead of using their ids.
    You can control the plugin through plugin commands!
    Spoiler: Plugin Commands
    1. NewVarProp: VariableID PropertyName Value

    This will go to variableID and create a property with the name PropertyName and set its value to Value. If the variableID already has a property with that name, it will simply change its value to the new Value.

    Example: NewVarProp: 16 height 4
    Now variable 16 will have a property called "height" with a value of 4.

    2. StoreVarProp: VariableID/Name PropertyName StorageVariableID

    This will go to VariableID, to its property PropertyName, take its value and store it to StorageVariableID.

    Example: StoreVarProp: 16 height 13
    Now variable 13 will hold the value of variable 16, property "height".

    If you did both of these examples, typing \v[13] in the box of "show text" will show you "4" as a result.

    Note that if you have Store Variable Names parameter ON you can also type the variable's name in StoreVarProp. So if in our previous examples variable 16 was named "mark" you could type "StoreVarProp: mark height 13" instead.
    You control the plugin via script calls:
    Spoiler: Script Calls
    To make a script call you have to go into an event, open up the command menu (the one that you open to "control variables") and go to its last page, to "script". There you can make any of the following script calls, by simply typing it in:

    maka.objVar.setProp(x, y, z); // Creates or changes a property's value
    X = Variable ID
    Y = The name of the property that you want to create or change, in quotes
    Z = The value that the property will hold

    Examples: maka.objVar.setProp(141, "power", 10);
    -
    maka.objVar.getProp(x, y); // Gets a property's value
    X = Variable ID (or name, if the Store Variable Names parameter is ON)
    Y = Property name (in quotes)

    Examples: open commands menu->condition->script:
    maka.objVar.getProp(141, "power") == 10
    ->show text->"Wow! So much power!"
    In the example above you can also type (mark, "power") if the name of variable 141 is "mark"(without the quotes), is unique and you have the name holding variable set to a variable id.

    New in v1.2
    Array handling - check the help file, array explanations are towards the bottom of the file.

    New in v1.3

    maka.objVar.changeProp(operation, value, id, name);

    operation = the operation you want performed in quotes
    Operations supported:
    'add' = addition
    'sub' = subtraction
    'mul' = multiplication
    'div' = division (result is rounded)
    'mod' = modulo

    value = the value you want added or subtracted, etc.

    id = the id of the variable whose property you want to change.
    name = the name of the property whose value you want to change.
    You can show the values of the variables properties in "show text" through a simple tag:
    Spoiler: Text Code
    Whenever you want to get the value of a variable property type:
    \VOBJ[x:y]
    X = The variable that holds the property. You can get it by either typing its ID or, if you have the "Store Variable Names" parameter ON, typing its name. Note that in this case, its name must be unique.

    Y = The property's name.

    Examples: \VOBJ[141
    ower] , \VOBJ[mark:height] , \VOBJ[141:5]
    (in the example above, a smiley keeps on being created instead of : P. I don't know how to make it stop showing smileys. Basically what I wrote was \VOBJ[141: Power] but without the space.)
    tl;dr version: Exercise, my own games, gift to the community:
    Spoiler: Why did I make this?
    So basically, while learning JS, i found it supports "object" variables, which are able to hold more than one value as properties. I also have a guide on Steam (MAKAIROSI guides). But since it's a rather simple procedure, i thought of making a plugin to automate it, as exercise.

    I mostly wrote it for my games, since i was often in a situation where i had values, minimums and maximums of those values, for each of 5 attributes, for each of 4 characters, to a total of...60 variables? I think it's 60. Anyway, with this thingie i only need 1 variable, which is the character's name, with 15 attributes, calling them by their names instead of their ids. So i'd just call \VOBJ[Cyril:Joy]/\VOBJ[Cyril:MaxJoy] et voila.

    The third reason I made this was because the community has helped me immensely and I wanted to give something back. More plugins are coming!
    It's really easy to use and i doubt it will be incompatible with anything because of its simplicity.

    The plugin could use some improvement:
    Spoiler: What i'm gonna add
    Please tell me what you would like it to do! I can only come up with so many ideas

    I'm learning all this stuff myself as i go.

    ->ADDED: Operations. It was understandably confusing to use getProp each time you simply wanted to add to a property, so i made a function specifically for that. You can now use add, subtract, divide, multiply and modulo.

    ->ADDED: Array handling! I have included specific functions for array handling now. You can add properties which are arrays!
    It will be cool to see if it helped anyone, or if anyone wants to comment on my code or the plugin's usage, anything really. I'm open to criticism, speak freely. Also, obviously, tell me your own suggestions.

    EDIT: I updated the file, if it's v1.3 it's the new one. This one has some bugfixes, arrays (since v1.2) and removed an unnecessary parameter. It also provides the ability to change a property via a single scriptcall.

    Please inform me about bugs and suggestions! I'm new to JS and it's really hard to catch all those errors on my own! I apologize in advance to anyone who got frustrated by an error i overlooked :s

    License:
    Use freely as commercial, non-commercial, whatever. Edit it as you wish but if you do i'd like to be credited as the original author inside the plugin description. If you want to be extra nice, you can include this page's link as well.


    本贴来自国际rpgmaker官方论坛作者:MiD处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/makai-object-variables.114287/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 07:32 , Processed in 0.067521 second(s), 58 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表