Jump to content
Sign in to follow this  
Followers 2
HuntingB

Earwigo: Current Zone.Active

Recommended Posts

Hello, as we have the lockdown in Belgium due to the Corona virus, I wanted to put some time in creating a second Wherigo. The first one I created it in Urwigo. For this one I wanted to this in Earwigo, to be able to use the multilingual capabilities. 

Now I am stuck on 1 issue: in Urwigo I would use the "Current Zone.Active" as shown in the picture attached. However, I don't see how to do this in Earwigo... Is this not possible in Earwigo?

Any suggestions are more than welcome!!!

Urwigo.png

Share this post


Link to post

What are you trying to accomplish? In my mind, if a zone is current (i.e. if the player is located in the zone), it means that it is active.

 

Some help could be found in these old threads:

or

 

I'm pretty sure that if you describe what you're trying to accomplish we could find a way to.

Share this post


Link to post

Well, In the cartridge, there's a moment where there are no zones visible, but they are active. There's an item in the inventory that can be used to check if the player is in an active zone. If so, he gets one point, and can continue for his search to enough hidden zones. Each zone should give only 1 point. If I could use "Current Zone.Active" operator, that would be such an easy way to create this.

 

I can put the name of the current zone in a variable, but than, how do I retrieve the active parameter of this zone? How can I put the zone inactive? So that if the user would pass it again, it doesn't show up anymore?

Share this post


Link to post
On 3/23/2020 at 8:35 AM, HuntingB said:

Well, In the cartridge, there's a moment where there are no zones visible, but they are active. There's an item in the inventory that can be used to check if the player is in an active zone. If so, he gets one point, and can continue for his search to enough hidden zones. Each zone should give only 1 point. If I could use "Current Zone.Active" operator, that would be such an easy way to create this.

 

You can try this cartridge I made for you. You'll have to "Restore" it in Earwigo.

 

It contains three zones, two messages, two objects, two functions and this little piece of "Author Code":

function CheckIfActive()
  local nbTriggered = 0
  for _,z in pairs(cartHuntingB.AllZObjects) do
    if Wherigo.NoCaseEquals(tostring(z), "a Zone instance") then
      if z.Active then
        if z:Contains(Player) then
          funcDeactivate(z)
          nbTriggered = nbTriggered + 1
        end
      end
    end
  end
  if nbTriggered == 0 then
    funcToobad()
  end
end

Note that if you change the cartridge name, you'll have to change its name in line 3 too (look for "Lua Name" indication in Property sub-tab of Cartridge tab).

 

funcDeactivate and funcToobad are defined in the Functions tab.

  • funcDeactivate sets the Active property of zone z to false, increments YourScore variable (see below) and displays a message named MsgSuccess.
  • funcToobad only displays a message named MsgFailure.

 

Two objects named ActiChecker and YourScore are defined too.

  • ActiChecker has an action attached to it. When chosen, it runs the CheckIfActive function defined in the Author Code.
  • YourScore displays the current score. Its description field is dynamically modified by funcDeactivate when it is called.

Both objects are moved to the Player Inventory at game start (Cartridge Start Event).

 

I tried to make the code as simple as possible. I hope it will be of some use for you.

Edited by Tungstène
I forgot to mention the three zones and the onStart Event.

Share this post


Link to post

Hello Tungstène, thanks for your help. It helped me a lot.

 

Now I am strugling with 2 more simular issues. How do you program these instruction on Earwigo?

 

    set value FoundZones => Concatenate(FoundZones; ", ";ActualZone)
    set value Result => counter/10

Edited by HuntingB

Share this post


Link to post
53 minutes ago, HuntingB said:

Now I am strugling with 2 more simular issues. How do you program these instruction on Earwigo?

 

    set value FoundZones => Concatenate(FoundZones; ", ";ActualZone)
    set value Result => counter/10

 

First add these two variables: FoundZones and Result.

 

Then modify funcDeactivate:

  • Add this "LUA Action": var_FoundZones = var_FoundZones .. ", " .. z.Name
  • Add another "LUA Action": var_Result = var_counter / 10

There are other possibilities for second question. Look at Earwigo's FAQ "How to display a variable value to user" (or something similar).

Share this post


Link to post

Hello, thanks, and further the development goes. Your remark at the end, I had already found...

Share this post


Link to post

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...
Sign in to follow this  
Followers 2

×
×
  • Create New...