Code error when following Verse Guide.

I am following this > 2. Defining the Pickup and Delivery Zones

My issue is I’m not having any luck with the following pieces of code VS isn’t happy with.

spawn { WaitForZoneCompleted(option{CaptureArea.PlayerEntersEvent}) }
spawn { WaitForZoneCompleted(option{ItemSpawner.ItemPickedUpEvent}) }

Any ideas why it isn’t happy with these. one of the warnings says, “Unknown member PlayerEntersEvent in capture_area_device.” The other says, “This function parameter expects a value of type ?awaitable(player), but this argument is an incompatible value of type ?listenable(agent).”

Any help would be excellent.

TLDR: update WaitForZoneCompleted to take a ?listenable(agent) (or even just ?awaitable(agent)). In WaitForZoneCompleted, you will likely have to cast the result of Await to player - e.g. Player := player[Event.Await()] - but only do this if you really need a player, and an agent isn’t good enough. Long answer: WaitForZoneCompleted is likely defined with argument ?awaitable(player). However, many of the events produce an agent - i.e., they are defined as listenable(agent). player and agent do have a subtyping relationship - but agent is a supertype of player. Because WaitForZoneCompleted states it must have a player - that an agent isn’t good enough - passing a ?listenable(agent) isn’t good enough.

Hey Ryan, thanks for catching this.
We’re going to update that tutorial soon to integrate some fixes.
In the meantime, I’m attaching a zip with the updated code.
PizzaPursuitFixed.zip (7.2 KB)

Please let us know if you encounter any other issues :slight_smile:

1 Like

Hi,

I was wondering when that update will happen. I have identified other parts of the tutorial that are not correct. The only method to correct these issues is using what you have supplied.

With a complete beginner to C++ and Verse this would cause a lot of confusion. In terms of someone who know some C++ not so bad but still confusing, and Verse is a different language in some ways eyc.