PCFY Progress Update 1

Yah, a post so soon after the pitch…brilliance.

 

Well, I decided to start working on the game right after I posted the last post, and I already have a major problem.

 

I can’t check to see if a variable exists.

See, Game Maker 8 had this condition where it could check for a local variable:

if variable_local_exists(var)

 

This function is very important when dealing with the text box:

[This code checks to see if the variables have already been set via the creation code. If not, it creates the variable and fills it with a blank text.}

 

if (!variable_local_exists(“text1″)) {text1=”*Beep*”

text2=”((Message string cannot be found.#Sorry.))”}

if (!variable_local_exists(“text2″)) {text2=””}

if (!variable_local_exists(“text3″)) {text3=””}

if (!variable_local_exists(“text4″)) {text4=””}

if (!variable_local_exists(“text5″)) {text5=””}

if (!variable_local_exists(“text6″)) {text6=””}

if (!variable_local_exists(“text7″)) {text7=””}

if (!variable_local_exists(“text8″)) {text8=””}

if (!variable_local_exists(“text9″)) {text9=””}

if (!variable_local_exists(“text10″)) {text10=””}

if (!variable_local_exists(“text11″)) {text11=””}

if (!variable_local_exists(“text12″)) {text12=””}

if (!variable_local_exists(“text13″)) {text13=””}

if (!variable_local_exists(“text14″)) {text14=””}

 

The function was completely removed from GM:S. The issue here is, if you don’t check to see if the variable exists and fill it with some kind of value, any compiler would crash and say the variable doesn’t exist.

 

As if it couldn’t get any worse, here is the reason by our dear friend the Help Page on why this function (along with a bunch of others) was removed:

 

“These functions cannot be used any more due to changes in the underlying runner that GameMaker:Studio uses to generate the device specific packages making it impossible to generate objects and code “on the fly”.”

 

This basically means that they think this function generates a sub-script that checks for a variable inside an object.

 

Simple solution: Check for the variable name as a string. If the string dosen’t exist…then there’s your function.

 

I’ve tried to work around this via room creation code, but that dosen’t work either because the room creation code seems to only execute AFTER all the objects spawn and run their creation code!

 

Even the most obvious way dosen’t work:

[This code should do the same thing as above: “if not text2, then set text2 to (blank)”, but the compiler reads it as “if text2 is false, set text2 to (blank)”]

if text1 = “” {text1=”*Beep*”

text2=”((Message string cannot be found.#Sorry.))”}

if !text2{text2=””}

if !text3{text3=””}

if !text4{text4=””}

if !text5{text5=””}

if !text6{text6=””}

if !text7{text7=””}

if !text8{text8=””}

if !text9{text9=””}

if !text10{text10=””}

if !text11{text11=””}

if !text12{text12=””}

if !text13{text13=””}

if !text14{text14=””}

 

So I really have no clue.

Leave a Reply

Your email address will not be published. Required fields are marked *