Jump to content


Photo

Plugin System *encryption Added!*


  • Please log in to reply
21 replies to this topic

#1 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 25 March 2009 - 05:41 AM

Download Here

Plugin System

Updated:
*Optional Password based Encryption for more security - greater protection of your source code.
*Optional Basic Security Feature - optional basic prevention of source code access.
*Added Collision Event - you can now use @collision [object_name or object_index] as an event
*Fixed Bug that Prevented Use of Multiple Plugins - you can now use multiple plugins


Seamlessly add multiple plugins to your GameMaker creations. All you have to do is put one function into your code "Plugin_Load()" and have a folder called "Plugins" in the same directory as the .gmk (this is obviously the folder you will store your plugins in). You may want to change "working_directory" to "program_directory" once you're ready to create the Exe and make sure that the "Plugins" folder is in the same directory as the Exe. All a plugin is, is a text file whose extension is ".plg".

Info on Encryption:

*pluginBPH is the program you use to initially encrypt/decrypt plugins while creating/debugging them this .gmk and/or exe must be in same directory as the game/program .gmk and/or exe along with the Plugins folder.

*Decrypting without Encrypting will cause a loss of all information! Make Backups, accidents happen!

*Set your password within the pluginBPH .gmk, creating an executable is optional, but recommended so the password cannot be found after deleting the source.

*Set your same password within the PluginV2 .gmk

*Change working_directory in all scripts to program_directory before making an executable, for general best results.


Plugin Code Info:

*In the text file the very first line must be a call to an event!

*All text after the event call is considered code for that event, until it reaches another event call.

*Each event call must be on a line of its own.

*Each event call begins with the @ character.

Example:
@collision [object_name or object_index] <--*new*     @step       @begin_step       @end_step       @create       @destroy       @draw       @game_end       @game_start       @animation_end       @path_end       @intersect_boundary       @outside_room       @no_health       @no_lives       @room_end       @room_start       @close_button       @keyboard_left       @keyboard_right       @keyboard_up       @keyboard_down       @keyboard_alt       @keyboard_control       @keyboard_shift       @keyboard_enter       @keyboard_tab       @keyboard_space       @keyboard_anykey       @keyboard_nokey       @keyboard_home       @keyboard_end       @keyboard_backspace       @keyboard_delete       @keyboard_insert       @keyboard_pageup       @keyboard_pagedown       @keyboard_pause       @keyboard_printscreen       @keyboard_escape       @keyboard_f1       @keyboard_f2       @keyboard_f3       @keyboard_f4       @keyboard_f5       @keyboard_f6       @keyboard_f7       @keyboard_f8       @keyboard_f9       @keyboard_f10       @keyboard_f11       @keyboard_f12       @keyboard_multiply       @keyboard_divide       @keyboard_subtract       @keyboard_add       @keyboard_decimal       @keyboard_a    @keyboard_b       @keyboard_c       @keyboard_d       @keyboard_e       @keyboard_f       @keyboard_g       @keyboard_h       @keyboard_i       @keyboard_j       @keyboard_k       @keyboard_l       @keyboard_m       @keyboard_n       @keyboard_o       @keyboard_p       @keyboard_q       @keyboard_r       @keyboard_s       @keyboard_t       @keyboard_u       @keyboard_v       @keyboard_w       @keyboard_x       @keyboard_y       @keyboard_z       @keyboard_0       @keyboard_1       @keyboard_2       @keyboard_3       @keyboard_4       @keyboard_5       @keyboard_6       @keyboard_7       @keyboard_8       @keyboard_9       @keyboard_numpad0       @keyboard_numpad1       @keyboard_numpad2       @keyboard_numpad3       @keyboard_numpad4       @keyboard_numpad5       @keyboard_numpad6       @keyboard_numpad7       @keyboard_numpad8       @keyboard_numpad9       @keyboard_left       @keyboard_right       @keyboard_up       @keyboard_down       @keyboard_alt       @keyboard_control       @keyboard_shift       @keyboard_enter       @keyboard_tab       @keyboard_space       @keyboard_anykey       @keyboard_nokey       @keyboard_home       @keyboard_end       @keyboard_backspace       @keyboard_delete       @keyboard_insert       @keyboard_pageup       @keyboard_pagedown       @keyboard_pause       @keyboard_printscreen       @keyboard_escape       @keyboard_f1       @keyboard_f2       @keyboard_f3       @keyboard_f4       @keyboard_f5       @keyboard_f6       @keyboard_f7       @keyboard_f8       @keyboard_f9       @keyboard_f10       @keyboard_f11       @keyboard_f12       @keyboard_multiply       @keyboard_divide       @keyboard_subtract       @keyboard_add       @keyboard_decimal       @keyboard_a    @keyboard_b       @keyboard_c       @keyboard_d       @keyboard_e       @keyboard_f       @keyboard_g       @keyboard_h       @keyboard_i       @keyboard_j       @keyboard_k       @keyboard_l       @keyboard_m       @keyboard_n       @keyboard_o       @keyboard_p       @keyboard_q       @keyboard_r       @keyboard_s       @keyboard_t       @keyboard_u       @keyboard_v       @keyboard_w       @keyboard_x       @keyboard_y       @keyboard_z       @keyboard_0       @keyboard_1       @keyboard_2       @keyboard_3       @keyboard_4       @keyboard_5       @keyboard_6       @keyboard_7       @keyboard_8       @keyboard_9       @keyboard_numpad0       @keyboard_numpad1       @keyboard_numpad2       @keyboard_numpad3       @keyboard_numpad4       @keyboard_numpad5       @keyboard_numpad6       @keyboard_numpad7       @keyboard_numpad8       @keyboard_numpad9       @keypress_left       @keypress_right       @keypress_up       @keypress_down       @keypress_alt       @keypress_control       @keypress_shift       @keypress_enter       @keypress_tab       @keypress_space       @keypress_anykey       @keypress_nokey       @keypress_home       @keypress_end       @keypress_backspace       @keypress_delete       @keypress_insert       @keypress_pageup       @keypress_pagedown       @keypress_pause       @keypress_printscreen       @keypress_escape       @keypress_f1       @keypress_f2       @keypress_f3       @keypress_f4       @keypress_f5       @keypress_f6       @keypress_f7       @keypress_f8       @keypress_f9       @keypress_f10       @keypress_f11       @keypress_f12       @keypress_multiply       @keypress_divide       @keypress_subtract       @keypress_add       @keypress_decimal       @keypress_a    @keypress_b       @keypress_c       @keypress_d       @keypress_e       @keypress_f       @keypress_g       @keypress_h       @keypress_i       @keypress_j       @keypress_k       @keypress_l       @keypress_m       @keypress_n       @keypress_o       @keypress_p       @keypress_q       @keypress_r       @keypress_s       @keypress_t       @keypress_u       @keypress_v       @keypress_w       @keypress_x       @keypress_y       @keypress_z       @keypress_0       @keypress_1       @keypress_2       @keypress_3       @keypress_4       @keypress_5       @keypress_6       @keypress_7       @keypress_8       @keypress_9       @keypress_numpad0       @keypress_numpad1       @keypress_numpad2       @keypress_numpad3       @keypress_numpad4       @keypress_numpad5       @keypress_numpad6       @keypress_numpad7       @keypress_numpad8       @keypress_numpad9       @keyrelease_left       @keyrelease_right       @keyrelease_up       @keyrelease_down       @keyrelease_alt       @keyrelease_control       @keyrelease_shift       @keyrelease_enter       @keyrelease_tab       @keyrelease_space       @keyrelease_anykey       @keyrelease_nokey       @keyrelease_home       @keyrelease_end       @keyrelease_backspace       @keyrelease_delete       @keyrelease_insert       @keyrelease_pageup       @keyrelease_pagedown       @keyrelease_pause       @keyrelease_printscreen       @keyrelease_escape       @keyrelease_f1       @keyrelease_f2       @keyrelease_f3       @keyrelease_f4       @keyrelease_f5       @keyrelease_f6       @keyrelease_f7       @keyrelease_f8       @keyrelease_f9       @keyrelease_f10       @keyrelease_f11       @keyrelease_f12       @keyrelease_multiply       @keyrelease_divide       @keyrelease_subtract       @keyrelease_add       @keyrelease_decimal       @keyrelease_a    @keyrelease_b       @keyrelease_c       @keyrelease_d       @keyrelease_e       @keyrelease_f       @keyrelease_g       @keyrelease_h       @keyrelease_i       @keyrelease_j       @keyrelease_k       @keyrelease_l       @keyrelease_m       @keyrelease_n       @keyrelease_o       @keyrelease_p       @keyrelease_q       @keyrelease_r       @keyrelease_s       @keyrelease_t       @keyrelease_u       @keyrelease_v       @keyrelease_w       @keyrelease_x       @keyrelease_y       @keyrelease_z       @keyrelease_0       @keyrelease_1       @keyrelease_2       @keyrelease_3       @keyrelease_4       @keyrelease_5       @keyrelease_6       @keyrelease_7       @keyrelease_8       @keyrelease_9       @keyrelease_numpad0       @keyrelease_numpad1       @keyrelease_numpad2       @keyrelease_numpad3       @keyrelease_numpad4       @keyrelease_numpad5       @keyrelease_numpad6       @keyrelease_numpad7       @keyrelease_numpad8       @keyrelease_numpad9       @mouse_enter       @mouse_leave       @mouse_nobutton       @mouse_wheelup       @mouse_wheeldown       @mouse_leftbutton       @mouse_rightbutton       @mouse_middlebutton       @mouse_global_leftbutton       @mouse_global_rightbutton       @mouse_global_middlebutton       @mouse_leftpress       @mouse_rightpress       @mouse_middlepress       @mouse_global_leftpress       @mouse_global_rightpress       @mouse_global_middlepress       @mouse_leftrelease       @mouse_rightrelease       @mouse_middlerelease       @mouse_global_leftrelease       @mouse_global_rightrelease       @mouse_global_middlerelease       @joystick1_up       @joystick1_down       @joystick1_left       @joystick1_right       @joystick1_button1       @joystick1_button2       @joystick1_button3       @joystick1_button4       @joystick1_button5       @joystick1_button6       @joystick1_button7       @joystick1_button8       @joystick2_up       @joystick2_down       @joystick2_left       @joystick2_right       @joystick2_button1       @joystick2_button2       @joystick2_button3       @joystick2_button4       @joystick2_button5       @joystick2_button6       @joystick2_button7       @joystick2_button8       @alarm0       @alarm1       @alarm2       @alarm3       @alarm4       @alarm5       @alarm6       @alarm7       @alarm8       @alarm9       @alarm10       @alarm11       @user0       @user1       @user2       @user3       @user4       @user5       @user6       @user7       @user8       @user9       @user10       @user11       @user12       @user13       @user14       @user15

Also, I recommend you encrypt all of your plugins, and decrypt them within the plugin script, as anyone can view/edit your plugins other-wise, and could possibly create code to steal your source code. An optional password encryption has now been added.

Let me know if there are any bugs etc, and anyone is allowed to alter the code in anyway, just don't forget to give me some credit. :)

Edited by margoose, 28 June 2009 - 11:22 PM.

  • 0
My Creations:


#2 BBGaming

BBGaming

    Programmer

  • GMC Member
  • 2478 posts
  • Version:GM7

Posted 25 March 2009 - 06:31 PM

@keyboard_a, press_a and release_a are all missing their break; statements, so they will also perform the b events if they are used (oops :)).
  • 0

Posted Image
Game Widgets
- Your pure-GML solution to API DLLs. Featured in Markup Magazine!

My Portfolio - All my good games and resources
Moved away from the forum - e-mail me if you need quick contact (hi_146@hotmail.com).


#3 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 25 March 2009 - 07:34 PM

oops lol, thanks I'll update that...thanks :)

edit: updated!

Edited by margoose, 25 March 2009 - 08:50 PM.

  • 0
My Creations:


#4 sanassar

sanassar

    GMC Member

  • GMC Member
  • 125 posts

Posted 29 March 2009 - 09:12 PM

This is pretty sweet. I will probably use it for one of my GM projects.
  • 0
CODE
game_create(platform,online,shooter,like_halo);

We wish for this script everyday.(But if it is made I will use it and credit the people who made it .)
Well, now I'm making it, Just watch for all the new platformers made with GML coding. (EHEM! a script?)

I am a a Mega Geek in the GEEK test!

Moving forward, because we can't stop.

#5 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 30 March 2009 - 03:17 AM

cool, im glad it gets some use other than me :D
  • 0
My Creations:


#6 PickleMan

PickleMan

    Programmer

  • New Member
  • 995 posts
  • Version:Unknown

Posted 30 March 2009 - 04:06 AM

Nice, I think I saw something like this before.
  • 0

#7 databot

databot

    admin of moonlight games

  • New Member
  • 309 posts

Posted 30 March 2009 - 10:17 PM

Very nice system, but using "select case"? Unelss used in GMthreads I could see this being very slow to load multiple plugins. I have been working on my own XML based system which will work with all events (Collision event system can be buggy but I think I have it sorted now).

for your collision system I may have a solution for you.
On gmlscripts.com a script exists (http://www.gmlscript...ipt/map_objects), it maps all objects to a key->pair consisting of object name->objectID. Using this it would be possible to link a name in a collision parameter to a collision event such as below.

Example .plg
@create
foo="bar"
health = 50
@step
health+=0.001
@collide wall
speed = 0

psuedo code to detect collide

GET line
if line begins with "@collide "
remove "@collide "
get objectID from DS_map
collect up code.
add as collision with objectID to current object

Keep up the good work margoose. I may adapt the system to load custom rooms for my system (C.L.O.U.D, see signature)
  • 0
Completed:
Scrip - Command line engine in the palm of your hands Get it Here
XML - XML simplified

#8 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 31 March 2009 - 04:46 AM

Very nice system, but using "select case"?

if you have a faster/better way than select case i'd love to hear it but if our definitions of alot of plugins are different then no it won't be too slow because of this, reading the lines of each file hog much more time than the select case especially if you have several large plugin files.

for your collision system I may have a solution for you

Thanks! I'll look into it. It has been quite a conundrum for me.

Keep up the good work margoose.

Thanks, I have been here since 2003, and I haven't really come out with much and my reputation here has been somewhat negative, so I am trying to redeem myself a bit as I do really love this community.

edit: I updated the plugin system! It now includes optional basic security that prevents obtaining source code. I can't include encryption/decryption because its open source :P

Edited by margoose, 31 March 2009 - 05:38 AM.

  • 0
My Creations:


#9 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 31 March 2009 - 08:14 PM

So... this is basically an import object script? I've seen this before, but the link was dead. Anyway, fantastic job on this.
  • 0

#10 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 31 March 2009 - 08:49 PM

Why do you block execute_shell()? All it does is run a program.

Also, security bypass:
execute_string
("Something");

  • 0

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#11 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 31 March 2009 - 09:11 PM

Why do you block execute_shell()? All it does is run a program.


the same reason its blocked when secure_mode = 1 in GM...if you don't want it blocked A: don't set secure to true or B: delete that part.

Also, security bypass:

execute_string
("Something");


execute_string() is also blocked along with execute_file...and even if it wasn't blocked the program would still see any of the other blocked functions and stop it.

edit: I forgot to block registry functions...I will update this soon.

Edited by margoose, 31 March 2009 - 09:17 PM.

  • 0
My Creations:


#12 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 31 March 2009 - 10:03 PM

Why do you block execute_shell()? All it does is run a program.


the same reason its blocked when secure_mode = 1 in GM...if you don't want it blocked A: don't set secure to true or B: delete that part.

Also, security bypass:

execute_string
("Something");


execute_string() is also blocked along with execute_file...and even if it wasn't blocked the program would still see any of the other blocked functions and stop it.

execute_string() is not blocked when the parentheses are on a different line.

And you forgot execute_program and all DLL functions.
  • 0

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#13 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 31 March 2009 - 10:41 PM

execute_string() is not blocked when the parentheses are on a different line.

And you forgot execute_program and all DLL functions.


thanks, thats an easy fix also.

edit: updated!

Edited by margoose, 01 April 2009 - 01:17 AM.

  • 0
My Creations:


#14 BBGaming

BBGaming

    Programmer

  • GMC Member
  • 2478 posts
  • Version:GM7

Posted 01 April 2009 - 02:52 AM

I recommend including a password-based encryption built in to the system, so this can easily be used by anyone who comes across it, and with a password system everyone's encryption will be unique (to an extent). I have one if you want it (PM me). Otherwise nice system, noticed you fixed the bug I found. :)
  • 0

Posted Image
Game Widgets
- Your pure-GML solution to API DLLs. Featured in Markup Magazine!

My Portfolio - All my good games and resources
Moved away from the forum - e-mail me if you need quick contact (hi_146@hotmail.com).


#15 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 28 June 2009 - 11:20 PM

*UPDATE*

Now has password encryption capability!

Special Thanks to B&B Gaming for the encryption/decryption algorithms. :P
  • 0
My Creations:


#16 michael14721

michael14721

    GMC Member

  • New Member
  • 222 posts

Posted 15 July 2009 - 11:34 AM

I always get an error..


ERROR in
action number 1
of Create Event
for object objPlugin:

In script Plugin_Load:
Error in code at line 72:

pluginStr[i,n]+=line+chr(10);

at position 17: Negative array index
  • 0
Don't worry, the zombies are looking for brains, you're safe..

#17 Tobbe

Tobbe

    GMC Member

  • New Member
  • 13 posts

Posted 10 August 2009 - 10:48 PM

Would it be possible to use a flash plugin to show flash movies in GM? The flash player for browsers is a plugin isn't it?

Edited by Tobbe, 10 August 2009 - 10:48 PM.

  • 0

#18 jsorgeagames

jsorgeagames

    GMC Member

  • GMC Member
  • 710 posts
  • Version:GM:Studio

Posted 12 August 2009 - 12:39 PM

Would it be possible to use a flash plugin to show flash movies in GM? The flash player for browsers is a plugin isn't it?

You misunderstand what this does - it does not add plugins to Game Maker. It is a way to have external GML code separated into events.

Edit: I am pretty sure that if you wanted to play a flash movie you could use an embed DLL.

Edited by jsorgeagames, 12 August 2009 - 12:40 PM.

  • 0

#19 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 13 August 2009 - 03:35 AM

Yes, in case it is not completely clear what this does, I will explain... This will allow you do is basically import objects. Each "plugin" file is simply an object and you use @ symbol to declare event code and all code below the @ line is the code for that event of that object (or "plugin"). Everything is explained very clearly in the first post as to how to use it. If you feel it is not clear enough as to how to use it, simply ask.

and as always, thanks for using my code ^_^
  • 0
My Creations:


#20 Kano yugoro

Kano yugoro

    GMC Member

  • New Member
  • 167 posts

Posted 13 August 2009 - 12:01 PM

ERROR in
action number 1
of Create Event
for object objPlugin:

In script Plugin_Load:
Error in code at line 72:

pluginStr[i,n]+=line+chr(10);

at position 17: Negative array index


I get this same error.
  • 0

#21 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 17 August 2009 - 01:32 AM

The only way I can see that error to come up is if the first line of any plugin does not begin with the @ symbol along with an event (listed in first post). If that is not the case then you are not doing the encryption correctly. Let me make the steps clear how to encrypt:

1. Make the plugin in .txt format (use notepad) but change the extension to .plg when saving.

2. In the game_start event of an object in your game's/program's source code put the code Plugin_Load(true, "Password") //note- change "Password" to your password. Set the second argument to false if you do not want a password and ignore the rest of the steps.

3. Go to the PluginBPH source code and go to the create code for object0. Change the arguments of the scripts to the SAME password as the password in the game's/program's source code.

4. Run the pluginBPH and follow instructions to encrypt the plugin file(s).

5. Run the game/program, plugins should run correctly.

6. To change a plugins code simply use the pluginBPH program to decrypt the plugin(s), alter it, then use pluginBPH to encrypt the file(s) again.

7. To make plugin development faster and easier set the password to false and do not encrypt plugin(s) until you have completely debugged them, then set the passwords as described and encrypt as described.

8. Anytime you create an exe make sure you change "working_directory" to "program_directory" within the source of Plugin_Load and pluginBPH if you decide to make pluginBPH an exe to hide your password (recommended).

Edited by margoose, 17 August 2009 - 01:54 AM.

  • 0
My Creations:


#22 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 14 March 2010 - 06:11 PM

Executing string is far too slow, if you are to be serious about plugins.. GMLua is ideal, rather then this.
  • 0

Posted Image