Jump to content

Incompatibilities between different engines


waterfan5

Recommended Posts

Iphone App crashes hard without any warning if you have zones that have an invalid zone point

See code below for a reproducable example

 

function MoveZones()

MoveZone(zMyZone1)

MoveZone(zMyZone2)

end

 

 

function MoveZone(zone)

local dist = math.random(20,100)

local brg =math.random(0,359)

 

DeactivateZone(zone)

 

 

local point1 = Player.ObjectLocation

 

local point2 = Wherigo.TranslatePoint(ptStartPoint, Wherigo.Distance(dist,'m'), brg-90)

point2 = Wherigo.TranslatePoint(point2, Wherigo.Distance(dist,'m'), brg)

 

local point3 = Wherigo.TranslatePoint(ptStartPoint, Wherigo.Distance(dist ,'m'), brg-90)

local point4 = Wherigo.TranslatePoint(ptStartPoint, Wherigo.Distance(dist,'m'), brg)

 

zone.OriginalPoint = point1

 

zone.Points = {point1, point3, point2, point4, }

 

ActivateZone(zone)

end

 

function ActivateZone(zone)

zone.Active = true

zone.Visible= true

end

 

function DeactivateZone(zone)

zone.Active = false

zone.Visible = false

end

Edited by waterfan5
Link to comment

Iphone app doesn't like PNG or JPEG file extensions.

Yeah, the app should like JPG extensions. (To others, please note the difference in spelling between JPE and JPG.)

Edited by Ranger Fox
I was in an HTML mood and the forum didn't like [strong]; it wanted [b], which is deprecated HTML.
Link to comment

Trying to see what crashes it here, is it the extra comma on the zone.Points (see bolded area)?

 

/// zone.Points = {point1, point3, point2, point4, }

 

Iphone App crashes hard without any warning if you have zones that have an invalid zone point

See code below for a reproducable example

 

function MoveZones()

MoveZone(zMyZone1)

MoveZone(zMyZone2)

end

 

 

function MoveZone(zone)

local dist = math.random(20,100)

local brg =math.random(0,359)

 

DeactivateZone(zone)

 

 

local point1 = Player.ObjectLocation

 

local point2 = Wherigo.TranslatePoint(ptStartPoint, Wherigo.Distance(dist,'m'), brg-90)

point2 = Wherigo.TranslatePoint(point2, Wherigo.Distance(dist,'m'), brg)

 

local point3 = Wherigo.TranslatePoint(ptStartPoint, Wherigo.Distance(dist ,'m'), brg-90)

local point4 = Wherigo.TranslatePoint(ptStartPoint, Wherigo.Distance(dist,'m'), brg)

 

zone.OriginalPoint = point1

 

zone.Points = {point1, point3, point2, point4, }

 

ActivateZone(zone)

end

 

function ActivateZone(zone)

zone.Active = true

zone.Visible= true

end

 

function DeactivateZone(zone)

zone.Active = false

zone.Visible = false

end

Link to comment

Here is one of those incompatibilities that can mess with you for hours:

 

The order of objects in "cart.AllZObjects" differs between the different modules.

Now in general it is bad to assume that there is an order, but it could explain why one crashes and the other doesn't.

 

Here is an example:

you have a zone and media with same name "Monster 1"

Now consider the code below.

 

For Emulator and Iphone, my app didn't crash as hard-coded media are always the first in the AllZObjects table.

However, on Android, Zones come before Media and this code crashed, as the 'table.get' returns a zone and not the media I was looking for.

 

Ways to prevent this is not to have duplicate names, or to use ID for the table retrieval and not the name. In Urwigo that would mean you have to hard-code all IDs.

 

function TestX()

local thisname="Monster 1"

local objMedia = table.get(myCart.AllZObjects,thisname)

Wherigo.MessageBox{Text="Hello world",Media=objMedia}

 

end

 

 

-- Get item from table

function table.get(table, name)

for _, value in pairs(table) do

if value.Name ==name then

return value

end

end

return nil

end

Link to comment

Ahh ok, I see it now.

 

B.t.w. this is a fabulous topic thread.

 

I've been having major headaches with the differences in the players. I have a couple play-anywhere cartridges that will not work on Android, but work on Oregons & iPhone. I have several other Play Anywheres that work fine on Android. Just have not been able to fix it, but coding for 3 platforms is just frustrating. The net effect is I have to put out simple/easy/basic cartridges now as to do anything beyond that I have problems.

 

My example wasn't great:

ptStartPoint is uninitialized in my example, android just skips NIL in zone points, but Iphone bombs.

 

Trying to see what crashes it here, is it the extra comma on the zone.Points (see bolded area)?

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...