SOLVED? Actor Behavior doesn't work in PC build but works fine in Flash

SpookyBurger

  • *
  • Posts: 79
Stencyl Build:  9857
Windows 7

Issue:  A behavior I use in my game doesn't work on my PC build but it works fine in flash.  What happens in the flash build is the player walks up to a item, presses J button, dialogue is displayed, a item is added to the players inventory,  a story switch is added to story switches (public list), then actor kills self when it checks if that item is in the story switch.  The problem in the PC is that the item is not added to the players inventory, the story switch is not added to the public list, and then the item does not kill itself.

This is very strange to me since this works just fine in my flash build of the game.  Any help would be appreciated.

« Last Edit: August 12, 2018, 04:53:19 pm by SpookyBurger »
Please try out my latest build of Patient 9 here.   http://www.stencyl.com/game/play/23179

merrak

  • *
  • Posts: 2081
When something works in one platform and not another, there are a few usual culprits:

* Some platforms handle uninitialized attributes differently
* Some platforms handle untyped variables differently
* Some platforms handle null values differently

Unfortunately, you have a lot of code to sort through. I took a quick look and noticed a few minor things, but nothing stands out to me immediately as the problem.

I noticed your print statements, which are a good idea--ensure all the events and conditions are triggering. The other thing to check would be the values of attributes. Print the values of attributes before an 'if' statement that checks their values, and see if you get any unusual results.

One thing I would strongly encourage you to not do is use "NULL" as a string. For example, you have the block: set Floating Text to NULL. This doesn't set that attribute to a null value. It sets it to the literal string "NULL". Not only is it confusing to read, it's also going to hinder your efforts to figure out what's going on if you start printing values of attributes. If it prints "NULL", does that mean the string has no value--or it is set to literally "NULL".

Check and make sure all your game attributes have initial values and their types are defined. See another recent thread about that issue.

SpookyBurger

  • *
  • Posts: 79
Hey merrak thanks a lot for your reply :)

So I took your advice and set up prints for each part.  Before (on PC) it would fail on 'step 2' which is where the behavior doesn't properly do the IF statement.  See pics fail 1 and fail 2. 

I made a copy of that condition and had it just check for the relevant item (ItemTut) and if it was there add it.  The test passed (Pass 1 & Pass 2) because it was in the right spot on the list (see info 1).

The way I things currently set up (as you can see in Info 1 pic) is that I use the number (not text) 0 to indicate nothing relevant is happening.   Currently I'm using the Flow -> Comparisons "anything not = anything" block's to do this. 

THE FIX seems to be if I check "as number" against 0.  See Fix 1 pic.  Do you think there's any other way to pull this off?  It seems so weird that the anything = anything block doesn't check between text and numbers on PC.

Thanks for the tips on when to use NULL, I wasn't intending it to set values to 'null' I just decided to use it as a easy way to note something not happening.  Unfortunately it makes the behavior hard to share and read :(

« Last Edit: August 12, 2018, 04:53:07 pm by SpookyBurger »
Please try out my latest build of Patient 9 here.   http://www.stencyl.com/game/play/23179