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

[转载发布] [Event making] Script box functions [V 0.7, 09/07/2016]

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

    连续签到: 2 天

    [LV.7]常住居民III

    5778

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 15:57 | 显示全部楼层 |阅读模式

    Script box functions v0.7



    by Astfgl66





    Everyone does event making. While most needs are met by the basic functions provided in editor, some are not. Have you ever tried giving an item to the party by id instead of the drop down menu? That's right you can't. You have to use the script command. After some searching you will find a list of script calls....


            Let's continue my example and say you want to give the party  [n] amount of weapon [id] stored in variable [1], you'd have to type that:


    $gameParty.gainItem($dataWeapons[$gameVariables.value(1)], n, true/false)


            That's ridicoulously long and complicated for what should be a simple thing, don't you think?


    And thats the goal of this plugin:provide a simple syntax to use while eventing your script calls.


            Lets take my example and put it in my new syntax:


    add_weapon(RV(1),n,true/false)


            Isn't it better? It's both easier to remember and easier to write, it guarantees quicker and more efficient eventing via script calls. It saves you time. And time, i think, is pretty much the most precious ressource a game dev can have.


    Features:


       - More than 100 functions to use during your script calls. Almost all functions in the event command menu have had their syntax simplified.


       - Some new functions: Check if event is inside a rectangle, a circle, a polygon, jump to a label contained in a variable,...


       - Window creation and manipulation


    Download:  http://pastebin.com/kSBxY0mg


    Old versions:

    Spoilerhttp://pastebin.com/KKjv0GNh V0.6


                            Because of unintended behaviour the older versions have been discontinued.








    Or find both the plugin and the help file attached to this post.


    How to use:


    Plug and play. There are no params available. Just be sure to name the plugin file "Astfgl", without the quotes.


    How is it done?


    The only thing this plugin modifies in the game is the script box event command. Everything is drawn from the data base using the original functions.


    That means if you input SV(1,6) the game actually interprets it as $gameVariables.setValue(1,6), it doesn't modify the base function, only provides an alternate way of calling them.


    That way, it should be compatible with almost any plugin.


    Futhermore, since it doesn't change or remove the original script calls, all your former eventing works are fully compatible!



    Example of application: making a nice gauge:

    Spoiler




                            SV stands for Set Variable(variableId, value): it sets variable n* [variableId] to [value].


                            RV stands for Read variable(variableId): it returns the value of variable n* [variableId].


                            pic_move and pic_tint are pretty self explanatory nut their argument list is quite long, so see documentation for that  



                            The event at the top is for setting up the gauge, then in order to increase or decrease its value, and at the right you can see how it looks.






    Example n*2: Creating and remembering sets of equipment to use later:

    Spoiler




                            SV stands for Set Variable


                            SVA stands for Set variable array (variableId,index,value) it is used to modify a single index of an array that is stored in a game variable at a time.


                            RVA stands for Read Variable Array (variableId,index), it returns the value stored inside index [index] of a game variable that is an array.


                            equip_id(actorId,slotId), returns the id (as in the database number) of the equipment of actor [actorId] in slot [slotId]


                            actor_equip_w(actorId,slotId,itemId) changes the weapon of actor [actorId] in slot [slotId] to weapon n* [itemId].


                            actor_equip_a does the same but for armor.


                            Okay: here is of it works.


                            First we set variable 3 to an array of 5 numbers. Then we set each position of the array to the corresponding slot equipment id.


                            Ie: Weapons go to slot 0, shield to slot 1, head to slot 2,...


                            Then by calling the second part we take advantage of the ability to equip an item by its id by retreiving what is inside variable 3, and equipping the corresponding item to the corresponding slot. It should be fully compatible with your scripts that add or remove equipment slot, you'll have to remember how many slot the actor has, and what they contain (a weapon or an armor) and change the number of calls accordingly though.


                            If you don't like arrays it can of course be done with multiple variables, you'll just need 1 per slot instead of 1 for the whole slot.






    Example n*3: Drawing on the map and window manipulation

    Spoiler




                            V0.7:











    Why should You care about script commands? Some examples of what script functions can achieve and/or facilitate:


       - Easy variable manipulation: if you wanted to calculate ((V1)+V(2)*V(3))/(V(4) you'd need a lot of lines or a very verbose script call. No more! It's as easy as (RV(1)+RV(2)*RV(3))/RV(4).


               - Modify any self switch! Ex: Set self switch [id] of event [eid] of map [mid] to true: SSelf(mid,eid,"id",true)


               - Give item to the party by id : add_item(id,n)


               - Play an animation by id! show_anim(eid,anim_id)


               - Better picture manipulation: You can easily create gauges, no need for a plugin! You just need two images (the back and the filling) and a bit of eventing magic.


               - Return almost anything you can think of, an actor description, profile, parameter, note (maybe you'd like to retrieve your notetags, you can!), same for skills, monsters, equipments,...


               - Array manipulation functions included.


               - Check if an event is inside a polygon! Who needs a line of sight plugin anyway?


               - Jump to a label which name is contained in a variable. This is both versatile and powerful, allowing you to create the equivalent of functions in your events!


               - Manipulate battler sprites position angle and scale!


               - Simple window creation and manipulation functions, with gauges, text and icons.


    Known bugs:


            I did not find any while testing myself. If you do, be sure to leave a comment or a PM.


    License:


            It's detailed inside the script: but it boils down to this: You can use the plugin for free or commercial use. You are free to edit and redistribute it as long as you don't claim ownership and keep the released product under the same license. You may not repost this plugin on any other forums than this one without my express permission: link them back here. You must give credit.


            The point in polygon formula was taken from the internet and as such requires proper crediting for its use. I have made sure they allowed all uses, and I do not claim ownership of the code. Please see in the credits section for what you should put in your credits.


    How can You help?


            If you've been following you've noticed i said almost all functions have been shortened, the first way you can help is providing me with verbose script calls that i have missed so i can shorten them and add them to my plugin.


            Things i deliberately chose not to do: anything related to messages and sound. It's very complicated, and there is not much to shorten,  anything related to move route, this script call is a nightmare (except easy access to the jump function).


            Thank you for reading.


    Credits:


            I would like to thank:


                 -Plugin template made by Faytless / Thomas Pham. Without that, I  would still be making modification in the core files.
                 -The point in polygon check formula was taken from the internet. Credit in comment near the command along with link to the source.


            It is released under MIT license (both it and the works it is based upon). Which means that you have to credit them and include a copy of their license if you use their work.


            I provide links to the original documents where they are found with a copy of the licenses you have to put in your credits  in spoilers below. I made sure they allowed all uses for their work, such as redistributing and mofiying, sublicensing, selling, etc...


            Links:

    Spoilerhttp://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html


    https://github.com/substack/point-in-polygon


                            Those are released under MIT license: https://opensource.org/licenses/MIT




            Required credits:

    SpoilerRay casting algorythm:


                            Copyright (c) 1970-2003, Wm. Randolph Franklin


                            Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:


    • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
    • Redistributions in binary form must reproduce the above copyright notice in the documentation and/or other materials provided with the distribution.
    • The name of W. Randolph Franklin may not be used to endorse or promote products derived from this Software without specific prior written permission.

                            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


                            Point in polygon javascript formula:


    https://github.com/substack/point-in-polygon


                            Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:


                            The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.


                            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.





                 -RPG Maker extender project for RPGMaker VXACE, for providing me with the idea and need to do this plugin.
                 -Tsukihime for the plugin jump_to_label via script call for Ace, which inspired me to write the function for MV.


    View attachment Astfgl.js


    View attachment AstfglPlugin Commands V0.7.xlsx


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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-26 03:49 , Processed in 0.124332 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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