How to get plugin parameters without knowing your filename

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,811
Reaction score
882
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,811
Reaction score
14,977
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,287
Reaction score
8,363
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

E7DsT3VXsAInVpu

working on my avatar, because i couldn't stand looking at it anymore :D
still not finished though...
alpacaraptors = love!
''Finds icons that fits the game you're making'' Only covers 20% of what you need :p
I'm very manic-y right now. I didn't sleep and I wanted to get a bunch of stuff done, but didn't get anything done except the bare bones concept for a POSSIBLE game.
And I can't sleep now because I'm probably gonna be hanging out with my brother and I gotta discuss a bunch of BroCoG (our game group) junk with him plus it's far to late to sleep NOW.
poppetQuestBarryApproaches.jpg
While I wait for judging, I decided to start adding more "friends" to my attic. :LZSgrin:

I swear I need a whole sound pack of menacing squeaky toy noises. :kaoswt:
I can't believe I actually managed to stay motivated for the whole Game Jam duration (1 month!), definitely will be taking a break after this :0

Forum statistics

Threads
113,582
Messages
1,075,991
Members
147,567
Latest member
jjchua
Top