How to get plugin parameters without knowing your filename

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,812
Reaction score
884
First Language
German
Primarily Uses
RMMZ
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,878
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,894
Reaction score
14,994
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
33,371
Reaction score
8,395
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 Posts

Latest Profile Posts

I work late on the game so I sleep in then I wake up late so I have to work hard to make up for sleeping in meaning I work late again and sleep in again... what a nasty cycle.
I just had my first real fire. Dad made burgers for lunch and the grill caught fire. He tried to get water but I told him you should never put water on a grease fire. So I got him the fire extinguisher under the sink and we managed to put it out. I can still smell a little of the smoke coming from the patio, but at least it's clearing. It sure was scary though.
was rendering a video and window decided to bsod on me :D fun
Could not for the life of me figure out how to implement the dual/triple techs in Touch the Stars in a player-friendly way. Was describing all the problems to my wife and just rubber-ducked a solution that should work brilliantly.
I think I'm going to make each equippable item in my fantasy RPG grant a skill while its worn (in addition to the character's learned skills). Equipped gear that might be weaker in stats can still be useful in certain situations if the skill they grant exploits a weakness or resists a strength in the monsters being fought. This could potentially open up lots of build strategies to play with for fun.

Forum statistics

Threads
113,838
Messages
1,077,854
Members
147,904
Latest member
Urektra
Top