+Tungstène Posted March 11, 2019 Share Posted March 11, 2019 I'm trying to develop a new cartridge (named cartIloveStrasbourg). On cartridge start and restore events, it scans all the zones and modifies some properties... First, it ran perfectly with the webwigo emulator. This was the code: function InitZones() for k,z in pairs(cartIloveStrasbourg:GetAllOfType('Zone')) do if string.sub(z.Name, 1, 3) == "TA " then z.Visible = false z.Active = false function z:OnEnter() AddToPassport(self) end end end end When I tried it IRL, WhereYouGo crashed with an error. I understood that OpenWIG doesn't implement the GetAllOfType method. I corrected my code with this new one: function InitZones() for k,z in pairs(cartIloveStrasbourg.AllZObjects) do if Wherigo.Zone:made(z) then if string.sub(z.Name, 1, 3) == "TA " then z.Visible = false z.Active = false function z:OnEnter() AddToPassport(self) end end end end end This code is working both with the emulator (webwigo) and the Android players (WhereYouGo and Wherigeooh). I asked a friend of mine to test with his iPhone and the cartridge crashes with this error message: Quote LUA Alert luaNext: first parameter is not a table There is nothing else displayed (no line number, nothing). Did I make something wrong? It's hard to test without an iPhone at hand... Any help would be appreciated. Quote Link to comment
+Tungstène Posted March 13, 2019 Author Share Posted March 13, 2019 (edited) I wrote a test cartridge. My friend tried it with his iPhone. This cartridge just shows the type of the cartridge's property AllZObjects using different ways to access it. cartridge.AllZObjects is not a table but nil. _G["cartridge"]["AllZObjects"] is not a table either but nil too. I found an old thread on this forum saying that iPhone Wherigo Player wasn't able to use this property but I looked at the code of some open source cartridge known to work with iPhones and they use this property. What could be wrong? Edited March 13, 2019 by Tungstène English is not my native language... Quote Link to comment
+Tungstène Posted March 21, 2019 Author Share Posted March 21, 2019 (edited) I finally found what's wrong. Despite iOS Wherigo Player telling us AllZObjects is nil, access to this table's members is possible. So, I was investigating in a wrong direction. This code works on iPhone (and on Android): function InitZones() for k,z in ipairs(cartIloveStrasbourg.AllZObjects) do if Wherigo.NoCaseEquals(tostring(z), "a Zone instance") then if string.sub(z.Name, 1, 3) == "TA " then z.Visible = false z.Active = false function z:OnEnter() AddToPassport(self) end end end end end Do you see what has changed? Call to the "made" method of the Wherigo class seems not to be implemented either in iOS Wherigo Player! Edited March 21, 2019 by Tungstène Quote Link to comment
Recommended Posts
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.