Jump to content

Urwigo emulator bug (?) - when modifying the points of a zone via LUA, the Player.ObjectLocation also changes


watersphere

Recommended Posts

Posted (edited)

Hi,

 

I had a strange emulator behavior when I tried to move a zone depending on the player's position via LUA code. To reproduce the behavior I build a simple urwigo cartrdige (you'll find it here: https://www.magentacloud.de/lnk/zlBJpYKa#file). 

 

wandering_zone_resized.jpg.f7297127e6c6057c23d8caef2082664b.jpg

 

It's very simple: the Wherigo has a zone and once entered, a timer starts. Every turn it calls a LUA function "catch_up", which recalculates the zone points via Wherigo.TranslatePoint and assigns them to the zone:

 

-- make the zone catch up to Player -------------------------------------------------------------------------------------------

function catch_up(zoo)

	-- Determine a triangle around the player
	local pt_1 = Wherigo.TranslatePoint(Player.ObjectLocation, Wherigo.Distance(50, 'm'), 270.0) 
	local pt_2 = Wherigo.TranslatePoint(Player.ObjectLocation, Wherigo.Distance(30, 'm'), 135.0) 
	local pt_3 = Wherigo.TranslatePoint(Player.ObjectLocation, Wherigo.Distance(30, 'm'), 45.0) 

	-- Assing the triangle as new zone corners
	zoo.Active = false
	zoo.Points={Wherigo.ZonePoint(pt_1.latitude, pt_1.longitude, 0),
		Wherigo.ZonePoint(pt_2.latitude, pt_2.longitude, 0),
		Wherigo.ZonePoint(pt_3.latitude, pt_3.longitude, 0),
		}		
	zoo.Active = true
	--Player:RefreshLocation()

end 

 

Without any further user interaction, the latitude of the Player.ObjectLocation increases slightly with each lap - as you can also see in the message log:

 

Sat Mar 13 19:12:42 2021 CARTRIDGE [Lua]: 53.95735|10.86417|0.000|1.000|ZTimer:Start - TheTimer
Sat Mar 13 19:12:42 2021 CARTRIDGE [Lua]: 53.95735|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:42 2021 CARTRIDGE [Lua]: 53.95735|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:39 2021 CARTRIDGE [Lua]: 53.95733|10.86417|0.000|1.000|ZTimer:Start - TheTimer
Sat Mar 13 19:12:39 2021 CARTRIDGE [Lua]: 53.95733|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:39 2021 CARTRIDGE [Lua]: 53.95733|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:36 2021 CARTRIDGE [Lua]: 53.95731|10.86417|0.000|1.000|ZTimer:Start - TheTimer
Sat Mar 13 19:12:36 2021 CARTRIDGE [Lua]: 53.95731|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:36 2021 CARTRIDGE [Lua]: 53.95731|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:33 2021 CARTRIDGE [Lua]: 53.95729|10.86417|0.000|1.000|ZTimer:Start - TheTimer
Sat Mar 13 19:12:33 2021 CARTRIDGE [Lua]: 53.95729|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:33 2021 CARTRIDGE [Lua]: 53.95729|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:30 2021 CARTRIDGE [Lua]: 53.95727|10.86417|0.000|1.000|ZTimer:Start - TheTimer
Sat Mar 13 19:12:30 2021 CARTRIDGE [Lua]: 53.95727|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:30 2021 CARTRIDGE [Lua]: 53.95727|10.86417|0.000|1.000|AttributeChanged - TheZone, Active
Sat Mar 13 19:12:27 2021 CARTRIDGE [Lua]: 53.95727|10.86417|0.000|1.000|ZTimer:Start - TheTimer
Sat Mar 13 19:12:27 2021 CARTRIDGE [Lua]: 53.95727|10.86417|0.000|1.000|Zone:Enter - TheZone
Sat Mar 13 19:12:20 2021 CARTRIDGE [Lua]: 53.95828|10.86387|0.000|1.000|Zone:Proximity - TheZone
Sat Mar 13 19:12:19 2021 CARTRIDGE [Lua]: 0.00000|0.00000|0.000|0.000|ZCartridge:Start - Downloaded Sat Mar 13 19:12:16 2021
Sat Mar 13 19:12:19 2021 CARTRIDGE [Lua]: 0.00000|0.00000|0.000|0.000|Engine Version 2.11, Player Name: Mr. Smith, Device ID: Desktop

 

Fortunately it seems to work in real life environment. I tested the cartridge with Fake GPS plus WhereYouGo on my tablet and it worked fine...

 

Is this a (known) bug or am I missing something?

 

Greetings - Chris

 

 

Edited by watersphere
Typo

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...