• 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!

Need help converting a few GM5 functions to GMS 1.4

M

moeburn

Guest
EDIT: I've figured almost everything out... except the new GM is insisting all my variables are defined before I use them. I didn't code that way, I took advantage of GM5 just assuming any unassigned variable was "0", now I'm having to compile, read the error, go into the create event of each object, add (variable159 = 0), over and over and over again... is there a way to tell the compiler to work like it did in GM5?
 
Last edited by a moderator:

FrostyCat

Redemption Seeker
No, there isn't. You will have to recode everything with that assumption out the window. It had been a bad rookie habit even while it lasted.
 
M

moeburn

Guest
Well that's a shame, without knowing how many times I'd have to do it, it could take me 5 more minutes or 5 more days. Was just hoping to replay this old game I made when I was a kid, but I guess that's not feasible, at least not with this version.

Is there any way to download the old Game Maker versions then?
 

FrostyCat

Redemption Seeker
Get GM5 from web.archive.org (search for gamemaker.nl circa 2006).

Don't attempt to port that project unless you are prepared for a complete rewrite.
 
M

moeburn

Guest
I already managed to convert the few missing functions that were giving me build errors, moved onto the compile error step and now it's just the variable thing that's left. Unless something else is going to surprise me around the corner, I think that might be all that's left.

I actually managed to find the GM6 download with your idea - thank you so much for that! - but it looks like it's not going to run in Windows 10. Maybe I'll set up an XP virtual machine or something, but I think I can take it from here. Thanks again for your help! :)
 

FrostyCat

Redemption Seeker
GM6 won't run on Vista or higher, but you should be able to find GM5 under Old Versions on that site. If that doesn't work, go back to to around 2004 or so and that should definitely have it.
 
L

Lel

Guest
Can use variable_instance_set(obj_name,"name for variable",value). Or use variable_global_set("name for variable", value).

In your code need add, where need, variable_instance_set(obj_my,"varTest",0);
In your code need add, where need, variable_global_set("varTest",0);

This is make you variables whit name what you need.
 
M

moeburn

Guest
Well I had to write "variablex = 0" a few hundred times, but I got most of it to work, and on the new Game Maker Studio, too!


I mean this thing was written in GM6, it's a damn miracle anything works at all. I made this game so many years ago, it had line of sight, fog of war, random AI personalities from defend to chase to flee, recoil and weapon sway, AI hearing sounds, AI chasing player when visible, 5 guns, grenades that could go over walls, really stretched GM6 to its limits, I even had a DLL in there doing something.
 

jo-thijs

Member
Well that's a shame, without knowing how many times I'd have to do it, it could take me 5 more minutes or 5 more days.
I believe that when you set the target on windows YYC, that the compiler immediately complains about every usage of a variable that is not declared locally or in the create event.
 
L

Lel

Guest
Man. Where variable not initialed use code:
Code:
if !variable_global_exists("myVar")
then
       {variable_global_set("myVar",0);}
else
      {variable_global_set("myVar",1000);}
For use in arrays this is method, read last post in https://forum.yoyogames.com/index.php?threads/array-get-value-no-function.52772/
This is help you with error "can not reed..."
Mb have a tool for replace this automaticly in your code, i dont no. Use you hands 8)
This is not work with arrays...
Mb any help you more. Good luck
 
Last edited by a moderator:

jo-thijs

Member
Man. Where variable not initialed use code:
Code:
if !variable_global_exists("myVar")
then
       {variable_global_set("myVar",0);}
else
      {variable_global_set("myVar",1000);}
For use in arrays this is method, read last post in https://forum.yoyogames.com/index.php?threads/array-get-value-no-function.52772/
This is help you with error "can not reed..."
Mb have a tool for replace this automaticly in your code, i dont no. Use you hands 8)
This is not work with arrays...
Mb any help you more. Good luck
Those functions don't exist in GameMaker:Studio 1.
The issue isn't in fixing using a variable that hasn't been declared before,
but in finding the occurrences of variables that haven't been declared before.
Writing a tool for this is not a trivial task.
 
L

Lel

Guest
The issue isn't in fixing using a variable that hasn't been declared before,
but in finding the occurrences of variables that haven't been declared before.
Man you can buy GMS2 and use everything code variable_global_axists or variable_instance_set and next use any code with this functions. Mb no function in GMS1 i dont know. But in GMS 2 your can do this.
If you hot have variable any time and not diclared you can use variable_global_set("nameVar",value), if value not diclared this is function make global variable with name nameVar. And next time you can use variable_global_get or use full name Var global.nameVar=35. Then, for diclare any var can use this function anywhere and no problem. In Steam you can buy GMS2 cheaper.
And any GMS not support: set for none diclared variable value how 0. This is only GML 8.1 and befor.
And what the GMS1? GMS 1.4 mb, then 1.4 have this is function (i cheked manual for 1.4, all have, use Search in manual - set text search "variable" and see all what you need). I dont see any time GMS 1 8)
 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I believe that when you set the target on windows YYC, that the compiler immediately complains about every usage of a variable that is not declared locally or in the create event.
Compiler will complain about use of any variable that is not assigned ever.
Static analysis on a dynamic language is a whole different can of beans.

Man. Where variable not initialed use code:
That is of no help unless the author is willing to replace every variable read with that kind of block, which is even less practical to do by hand.
 
Top