Loading scripts externally?

Conbeef

Member
Hello all, is it possible to load gml scripts externally? Example: script_execute("script.txt",arg0,arg1);
I know the above code will give an error because I'm passing a string, but you know what I'm saying.

Can someone help?

EDIT: I forgot to tell you why I want this xD. Well, I was thinking of dlcs. If I wanted to add a character and use scripts made for that character.
 
Last edited:

BLang

Member
Nope, that would imply adding code into the game after it's been compiled, which can't be done in GMS. You'd have to add the changes within GMS, recompile and update the .exe on the client side to achieve something like this.

Edit: refer to this topic, it's asking about the same thing.
 

johnwo

Member
You only alternative is to use/create a(n) existing/new script interpreter.
A very minimal interpreter isn't much pain, but if you're aiming for something more than simple conditions, variables, and short statements it could take a while to finish it.
You won't be able to translate it into machine code AFAIK, so I will be pretty slow as well.

If you're thinking of using this for DLC's it better to just include everything in the game, update the game, then unlock the new character(s) only for users that have paid for it.

Cheers!
 
C

Charyb

Guest
You only alternative is to use/create a(n) existing/new script interpreter.
A very minimal interpreter isn't much pain, but if you're aiming for something more than simple conditions, variables, and short statements it could take a while to finish it.
You won't be able to translate it into machine code AFAIK, so I will be pretty slow as well.

If you're thinking of using this for DLC's it better to just include everything in the game, update the game, then unlock the new character(s) only for users that have paid for it.

Cheers!
I still don't like that people call this DLC even if you're technically not downloading anything :p The world is strange.
 

Surgeon_

Symbian Curator
Forget about code interpreters. I've been there; they're clunky and, more importantly, terribly slow.

-Surgeon_
 

zbox

Member
GMC Elder
Oops replied to the other topic instead of this accidentally; will leave here
For what it's worth, all my menus, level generation data etc in game are totally controlled and updateable through json files, and the graphic assets are loaded externally. I can retheme the whole game or change the entire structure of it through my webserver and it will auto-update to the client so true "DLC" (the pre-included DLC stuff is a farce as far as I am concerned) is definitely possible. All you need to do is keep in mind that you should be writing good quality highly modular code.
 
R

Robert

Guest
I really wish this were possible as I would love to give modders the ability to add their own custom GML scripts. However, it's not, and there are no good alternatives that I can find so if you do come across something please share. My solution was to use something called NSP 2, which pretty much does what I want but not really. Check it out:

http://gmc.yoyogames.com/index.php?showtopic=681539&hl=

The problem though is that it's extremely limited, only a few functions/variables are supported out the box and its slow. You have to manually add access to any custom variable you want to allow a NSP executed string to have access to, same with native functions and variables. Also, I couldn't find a way to allow the modder to create their own variables, functions, etc with it so its really limited in what it can do... But hey, it works, kinda.

I think the way you have to look at this is not finding a way to let the modder write code with GML, but instead with your own custom subset of functions that are unique to your game. So you have a couple dozen custom functions that do things in your game and then make those accessible to the modder and they can do unique things by combining these functions in unique ways.
 

Conbeef

Member
Thank you all for your replies. I'm not going to use code interpreters because I know it will be slow xD. The best thing to do is what @BLang said.
 
Top