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,903
Reaction score
14,996
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,372
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

how does everybody even finish anything

i have like 5 projects in the backburner and it's just so sad that i probably won't get to finish all or maybe even any of them
Did you know that 90% of people in the world use the number in their sentence as they see fit?
It's been a long time since I was here but I have a lot of updates... btw I am teaching again about game programming and game design in some schools here in Brazil hahahaha It's good to see kids and teens learning this kind of thing!
welp, I literally can't continue working on ALEX now that my MZ trial is up (unless I somehow place in the jam which I don't remotely deserve to for my unfinished crap) so I am back on my bullshit

Forum statistics

Threads
113,892
Messages
1,078,246
Members
147,985
Latest member
H3ctorGH
Top