{"id":56,"date":"2012-11-03T16:04:26","date_gmt":"2012-11-03T23:04:26","guid":{"rendered":"http:\/\/www.mcgeeplace.com\/WordPress\/?p=56"},"modified":"2012-11-03T16:05:30","modified_gmt":"2012-11-03T23:05:30","slug":"pcfy-progress-update-1","status":"publish","type":"post","link":"http:\/\/www.mcgeeplace.com\/WordPress\/2012\/11\/pcfy-progress-update-1\/","title":{"rendered":"PCFY Progress Update 1"},"content":{"rendered":"<p>Yah, a post so soon after the pitch\u00e2\u20ac\u00a6brilliance.<\/p>\n<p>&nbsp;<\/p>\n<p>Well, I decided to start working on the game right after I posted the last post, and I already have a major problem.<\/p>\n<p>&nbsp;<\/p>\n<p>I can&#8217;t check to see if a variable exists.<\/p>\n<p><!--more--><\/p>\n<p>See, Game Maker 8 had this condition where it could check for a local variable:<\/p>\n<p>if variable_local_exists(var)<\/p>\n<p>&nbsp;<\/p>\n<p>This function is very important when dealing with the text box:<\/p>\n<p><em>[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.}<br \/>\n<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text1&#8243;)) {text1=&#8221;*Beep*&#8221;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">text2=&#8221;((Message string cannot be found.#Sorry.))&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text2&#8243;)) {text2=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text3&#8243;)) {text3=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text4&#8243;)) {text4=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text5&#8243;)) {text5=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text6&#8243;)) {text6=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text7&#8243;)) {text7=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text8&#8243;)) {text8=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text9&#8243;)) {text9=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text10&#8243;)) {text10=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text11&#8243;)) {text11=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text12&#8243;)) {text12=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text13&#8243;)) {text13=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if (!variable_local_exists(&#8220;text14&#8243;)) {text14=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>The function was completely removed from GM:S. The issue here is, if you don&#8217;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&#8217;t exist.<\/p>\n<p>&nbsp;<\/p>\n<p>As if it couldn&#8217;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:<\/p>\n<p>&nbsp;<\/p>\n<p>&#8220;These functions cannot be used any more due to changes in the underlying runner that <em>GameMaker:Studio<\/em> uses to generate the device specific packages making it impossible to generate objects and code &#8220;on the fly&#8221;.&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>This basically means that they think this function generates a sub-script that checks for a variable inside an object.<\/p>\n<p>&nbsp;<\/p>\n<p>Simple solution: Check for the variable name as a string. If the string dosen&#8217;t exist\u00e2\u20ac\u00a6then there&#8217;s your function.<\/p>\n<p>&nbsp;<\/p>\n<p>I&#8217;ve tried to work around this via room creation code, but that dosen&#8217;t work either because the room creation code seems to only execute AFTER all the objects spawn and run their creation code!<\/p>\n<p>&nbsp;<\/p>\n<p>Even the most obvious way dosen&#8217;t work:<\/p>\n<p><em>[This code should do the same thing as above: &#8220;if not text2, then set text2 to (blank)&#8221;, but the compiler reads it as &#8220;if text2 is false, set text2 to (blank)&#8221;]<br \/>\n<\/em><\/p>\n<p><span style=\"font-family: Courier New;\">if text1 = &#8220;&#8221; {text1=&#8221;*Beep*&#8221;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">text2=&#8221;((Message string cannot be found.#Sorry.))&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text2{text2=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text3{text3=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text4{text4=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text5{text5=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text6{text6=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text7{text7=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text8{text8=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text9{text9=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text10{text10=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text11{text11=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text12{text12=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text13{text13=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New;\">if !text14{text14=&#8221;&#8221;}<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>So I really have no clue.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.mcgeeplace.com\/WordPress\/wp-content\/uploads\/2012\/11\/110312_2304_PCFYProgres1.jpg\" alt=\"\" \/><\/p>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=http%3A%2F%2Fwww.mcgeeplace.com%2FWordPress%2F2012%2F11%2Fpcfy-progress-update-1%2F&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=lucida grande&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px;margin-top:5px;  height:20px;  width:150px;  @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {font-size: 2em;} background:rgba(0,0,255,0.1); border-width: 2px; border-radius:6px; border-color:rgba(300,0,51,1);\"><\/iframe>","protected":false},"excerpt":{"rendered":"<p>Yah, a post so soon after the pitch\u00e2\u20ac\u00a6brilliance. &nbsp; Well, I decided to start working on the game right after I posted the last post, and I already have a major problem. &nbsp; I can&#8217;t check to see if a variable exists.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false},"categories":[9],"tags":[],"wbAuthor":{"name":"Pat","link":"http:\/\/www.mcgeeplace.com\/WordPress\/author\/pat\/"},"wbDate":"Nov 3, 2012","wbCategories":{"space":"<a href=\"http:\/\/www.mcgeeplace.com\/WordPress\/category\/gmstudio\/\" rel=\"category tag\">GMStudio<\/a>","coma":"<a href=\"http:\/\/www.mcgeeplace.com\/WordPress\/category\/gmstudio\/\" rel=\"category tag\">GMStudio<\/a>"},"wbComment":0,"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3CcMS-U","_links":{"self":[{"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/posts\/56"}],"collection":[{"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":2,"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":58,"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/posts\/56\/revisions\/58"}],"wp:attachment":[{"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.mcgeeplace.com\/WordPress\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}