Jump to content

Simualting a conversation, de-activating all active zones


Geldhart

Recommended Posts

I am working with the Urwigo builder, trying to make a more complex cartridge and have two questions.

 

1. I am trying to simulate conversations with an NPC. It would be something like this.

 

You see a barmaid...

 

Followed by conversation topics (Setup as commands with dialog entries)

 

[Ask about the drink specials]

[Ask about the food specials]

 

With the idea that if you ask about the drink specials, she will say "Grog is 5p per glass" and then take you back to the conversation.

 

[Ask about the drink specials]

[Ask about the food specials]

 

It seems to work okay with the Garmin, but on the iPhone Wherigo player, after asking about the drink specials, it goes back to the main menu showing the Zone, Characters, Inventory, and Tasks. I would like to keep the focus on the barmaid.

 

Second item.....

 

I am simulating 5 cities in a country: Arrowhead, Barrow, Chesterfield, Delta, and Emp. They should all show up when the player is not in any of them. If the player makes it to Arrowhead, all the cities should be de-activated, and replaced with Arrowhead-Bar, Arrowhead-Castle, Arrowhead-Market. When the player leaves Arrowhead, then the 5 cities should be reactivated and the zones inside Arrowhead disappear.

 

Is there a simply way (rather than having to hard-code Arrowhead.Active=False, Barrow.Active=False, etc) and just deactivate ALL active zones (then I can just activate the necessary zones). This would also allow me to create an item that will "reset" the players location to the country side, showing all the cities, in case they quit the cartridge inside a distant town and are say 40km away and don't want to drive all the way there just to exit the town cleanly.

 

Does that make any sense? Can anyone help?

Link to comment

For your first question, that of why the iPhone Player goes back to the main screen, you'll have to take that up with the developer. If, instead, you'd like a solution you could implement, I suppose you could fire the barmaid talk event after the player clicks the button on the "Grog is 5p per glass" dialog. I don't think any of the Builders will give you an option to do this, so you'll have to write something in the code.

 

As for the second, marking all zones as inactive at one time, this is what I used in Whack-A-Lackey (for simplicity's sake, I extracted just that code and made it into a function for you):

function DeactivateAllZones(cartridge)
for _,zone in ipairs(cartridge:GetAllOfType('Zone')) do
 if zone ~= nil then
   zone.Active = false
 end
end
end

The function takes one argument: your cartridge object.

Link to comment

For your first question, that of why the iPhone Player goes back to the main screen, you'll have to take that up with the developer. If, instead, you'd like a solution you could implement, I suppose you could fire the barmaid talk event after the player clicks the button on the "Grog is 5p per glass" dialog. I don't think any of the Builders will give you an option to do this, so you'll have to write something in the code.

 

As for the second, marking all zones as inactive at one time, this is what I used in Whack-A-Lackey (for simplicity's sake, I extracted just that code and made it into a function for you):

function DeactivateAllZones(cartridge)
for _,zone in ipairs(cartridge:GetAllOfType('Zone')) do
 if zone ~= nil then
   zone.Active = false
 end
end
end

The function takes one argument: your cartridge object.

 

Thanks, I'll give that a try.

Link to comment

For your first question, that of why the iPhone Player goes back to the main screen, you'll have to take that up with the developer. If, instead, you'd like a solution you could implement, I suppose you could fire the barmaid talk event after the player clicks the button on the "Grog is 5p per glass" dialog. I don't think any of the Builders will give you an option to do this, so you'll have to write something in the code.

 

As for the second, marking all zones as inactive at one time, this is what I used in Whack-A-Lackey (for simplicity's sake, I extracted just that code and made it into a function for you):

function DeactivateAllZones(cartridge)
for _,zone in ipairs(cartridge:GetAllOfType('Zone')) do
 if zone ~= nil then
   zone.Active = false
 end
end
end

The function takes one argument: your cartridge object.

 

I have a question about this wrt performance. Does deactivating an unactive zone cost many cycles? I'd love to take this approach but was wondering about the performance overhead. I would *hope* it would be very quick, but don't know for sure.

 

Thanks in advance...

Link to comment

I honestly can't say if deactivating an inactive zone is a performance hit. I would assume marking a zone as inactive just sets the Boolean Active property. I equate it as having the same performance cost as testing for the zone's active status.

 

For sake of exploring the issue further, let's assume setting a zone's active status also sets each of the zone's constituent ZonePoints. This would, then, be a performance hit because the Wherigo Player Engine would have to iterate through the zone's ZonePoints and set each one's active status. On the other hand, it could therefore be argued that, by testing a zone's active status, the Player must also iterate through a zone's ZonePoints table to determine their active status. That or else the Player could take a shortcut: a zone could be considered active if at least one of its ZonePoints is active, so the Player just considers a zone-level Boolean for this and not the individual ZonePoints. We could then further complicate the issue (too late?) by wondering what would happen if we directly access a zone's ZonePoints table and set all ZonePoints to inactive while not adjusting the zone's active status: what active status would the zone report?

 

So, really, I don't think either way would be a performance hit.

 

--------------

 

I did some experimenting after writing the last paragraph, but before I submitted the post. I discovered a ZonePoint's active status does not matter to the emulator's Player. Every ZonePoint within a zone could be set to inactive, but the zone will still be considered active. Likewise, the zone could be inactive and the ZonePoints active, but the zone will be treated as inactive. This, at least, tells us the ZonePoints' active status is not considered when determining if a zone is active.

 

I have attached my test cartridge. The tests I created are visible under the Lua Debug tab. Please note this cartridge is not built for anything but the emulator; I know it will power off a Garmin Oregon.

Test Zone Active.zip

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