How to get plugin parameters without knowing your filename

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
868
First Language
German
Primarily Uses
I updated the OP with a shorter version of your solution, as already posted in your thread. it might be risky, since as a plugin writer, you can't always know where your plugin will be used and cross-browser compatibility can be an issue. Adding the polyfill seems too much work, just to get parameters, but it's good to have options to choose from.


If you are making plugins for yourself or are working in a team, you can use the "currentScript" solution, since it's easier to implement and doesn't need an identifier in your plugin's description. For full compatibility, i would stick to the other solution, as it's guarenteed to work independently from the browser in use.


/edit: Shortened the new solution and modified it to not use lookahead, but a normal match.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,877
First Language
English
I updated the OP with a shorter version of your solution, as already posted in your thread. it might be risky, since as a plugin writer, you can't always know where your plugin will be used and cross-browser compatibility can be an issue. Adding the polyfill seems too much work, just to get parameters, but it's good to have options to choose from.


If you are making plugins for yourself or are working in a team, you can use the "currentScript" solution, since it's easier to implement and doesn't need an identifier in your plugin's description. For full compatibility, i would stick to the other solution, as it's guarenteed to work independently from the browser in use.


/edit: Shortened the new solution and modified it to not use lookahead, but a normal match.
By cross-browser, are there any in particular that you're thinking about?


Like, even with IE, how old are you talking?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,544
Reaction score
14,854
First Language
English
Primarily Uses
RMMV
So what is the best option available so far, if I want something that only requires a couple of lines, works on ALL platforms/browsers, and doesn't require additional plugins to work? I'm thinking it's still probably the first or second option you came up with.
 

sblackburn

Warper
Member
Joined
Dec 6, 2015
Messages
1
Reaction score
0
First Language
English
Can someone make a video if someone can do it?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,947
Reaction score
8,260
First Language
German
Primarily Uses
RMMV
@sblackburn I don't think that that would be a good idea - this is about coding, which means reading and writing code - there have been dozens of failed tries to show that by videos, and the problems range from the watchers misreading the code due to bad video quality over the video not explaining some parts due to length limitations to people simply not getting the point because the videos going too fast (reading is better for complex material as it allows you to set your own speed.


That said, this idea has basically been outdated by the community - instead of every plugin writer trying to get his brain around this coding, they simply say "don't rename the plugin file". Because if you know the name of the plugin file (which you are writing yourself after all), none of this is neccessary.
 

Latest Threads

Latest Profile Posts

Theydies and gentlethems, presenting Touch the Stars character #1: Anna Smith and her transformed form, Sagittaria!1624568259771.png
Anyone seen Dsiver around?
I wish character bust packs had options for both side-facing and front-facing for the same characters.
Looks like I'm going to have to cancel another game.
For now it is in testing phase: Changing the game icon from Rm2k/2k3 without needing to edit the executable.
Rm2k-DinChangeIcon.png

Forum statistics

Threads
112,530
Messages
1,068,988
Members
146,216
Latest member
WTCraft2003
Top