- Joined
- Jan 5, 2016
- Messages
- 722
- Reaction score
- 578
- First Language
- French
- Primarily Uses
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:
http://pastebin.com/KKjv0GNh V0.6
Because of unintended behaviour the older versions have been discontinued.
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:
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:
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
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:
http://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
https://github.com/substack/point-in-polygon
Those are released under MIT license: https://opensource.org/licenses/MIT
Required credits:
Ray 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:
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.
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
Last edited by a moderator:

