• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Script thing has me stumped - SOLVED

Heathenlamb

Member
So I have a GM project I use for a bunch of commercial clients. I have avoided updating the runtime etc. for as long as I could. So I have updated it and now all the script functions are stuffed. I am completely aware the script handling has changed and there is a detailed explanation, which doesn't seem to really explain the basic premise of how to get the calls to just work as before. I am not an amazing programmer so I cobble together things that work.

I need all my previous scripts to work as they are because there is a crap load of code that calls them. Is there no simple way to just call the scripts the way the previous version did ? I am clearly not understanding something basic here. The scripts are not ones I have written as I don't know enough to do that. I do however understand enough to call them the old way. So how do I just get the scripts to be called in code without rewriting a whole bunch of stuff ?

I am not asking for my code to be fixed, I guess I just need a simpler breakdown of how the script is now called into the game.

Any help would be appreciated as I have to get this sorted ASAP.
 

samspade

Member
I'd recommend writing it personally. Having done so for a number of projects it doesn't take that long and it is very worth it from the project management standpoint. That said, the 2.3 conversion should do it for you automatically, no work required. Are you getting specific error messages?

Otherwise these articles do a good job explaining how to rewrite it simply:
Straight forward video:

 

Evanski

Raccoon Lord
Forum Staff
Moderator
So I have a GM project I use for a bunch of commercial clients. I have avoided updating the runtime etc. for as long as I could. So I have updated it and now all the script functions are stuffed. I am completely aware the script handling has changed and there is a detailed explanation, which doesn't seem to really explain the basic premise of how to get the calls to just work as before. I am not an amazing programmer so I cobble together things that work.

I need all my previous scripts to work as they are because there is a crap load of code that calls them. Is there no simple way to just call the scripts the way the previous version did ? I am clearly not understanding something basic here. The scripts are not ones I have written as I don't know enough to do that. I do however understand enough to call them the old way. So how do I just get the scripts to be called in code without rewriting a whole bunch of stuff ?

I am not asking for my code to be fixed, I guess I just need a simpler breakdown of how the script is now called into the game.

Any help would be appreciated as I have to get this sorted ASAP. ---------------------------------------- SORRY, I have posted this as a thread in the main channel.
Take your scripts and place them inside a function like so
GML:
function script_name_here(any arguments you want here) {

PUT YOUR SCRIPTS CODE HERE
}
then call the script in one of two ways
Code:
script_execute(script_name_here(1,2));

script_name_here(1,2);
Edit: forgot function keyword
 
Last edited:

Heathenlamb

Member
Take your scripts and place them inside a function like so
GML:
script_name_here(any arguments you want here) {

PUT YOUR SCRIPTS CODE HERE
}
then call the script in one of two ways
Code:
script_execute(script_name_here(1,2));

script_name_here(1,2);
So I am embedding the script in GML in the game as opposed to have a script as a separate library object ?
 

Heathenlamb

Member
Make scripts like you did before but you are wrapping them in a function instead.
Sorry ... as per my original post I didn't write the script. I bought them. I don't really understand the nature of writing them, just how to call them and use them. I am just not getting the new mechanism for how to reference the scripts now in the new version. I understand I sound stupid, but how does "wrapping them in a function" relate to how it is referenced ? Are the old scripts useless ? Is that what I am not getting ?
 

samspade

Member
"Are the old scripts useless?" No, so long as they're updated. And GM updates them for you automatically so you don't even need to touch them if you don't want to. Are you getting error messages?
 

Heathenlamb

Member
"Are the old scripts useless?" No, so long as they're updated. And GM updates them for you automatically so you don't even need to touch them if you don't want to. Are you getting error messages?
Yes I am. They have just disappeared out of the library after conversion. But I now I can't load the old version to check what was there haha.
 

samspade

Member
GameMaker doesn't have anything called a library. What are you referencing there? An external asset, an extension, the marketplace, your scripts folder, something else?
 

Heathenlamb

Member
GameMaker doesn't have anything called a library. What are you referencing there? An external asset, an extension, the marketplace, your scripts folder, something else?
The long column of assets, objects, sprites, sounds, fonts, scripts ... Alot of people refer to it as the library. Sorry it may not be a technical term.
 

samspade

Member
Updating a project to 2.3 shouldn't make anything disappear from that. So if something did, that would be a different issue.
 

Heathenlamb

Member
ALL GOOD ! ... I worked it out ... GMS was changing the name of the script after import from the previous script reference name. For some reason it is abbreviating the script name when it converted to a function. So I changed the name to the abbreviated version and it all started working. I appreciate you guys taking the time to help me out. GMS forum, fantastic as usual.
 
Top