Jump to content

Urwigo - Pick up items without on click


Paul & Ros

Recommended Posts

Although I'm a seasoned geocacher I am a complete newbie as far as Wherigos are concerned.

 

I just did my first one a couple of weeks back and was inspired to try and produce one myself.

 

After reading through a few of the forum posts I downloaded Urwigo as my builder of choice.

 

My programming experience only goes as far as 1980s Basic and the odd excel macro so Urwigo seemed the best starting point as it had a nice UI hiding all the coding.

 

I have figured out how to create zones and make other zones appear and disappear as the player moves in and out of them.

 

I have also figured out how to use timers and to create items.

 

I'm starting with a simple linear cartridge untill I get the hang of it.

 

Walk to A, Pick up B, Go to C, if you arrive without B get a message saying go back etc.

 

My problem is this...I keep seeing forum posts warning me to avoid using the on click event to try and make the finished cartridge more compatible with different hardware.

 

How do I go about picking up and dropping off items without using on click ?

 

It took me quite a while to figure out how to do it with the on click event, I've no idea where to start without it. :-(

 

Can someone point me in the right direction using language I can understand ?

 

I've searched the forums already but I cant find an explanation simple enough to follow.

 

From what I have seen so far Urwigo looks very exiting, if only there was a better online manual to show you how to use it.

 

Many Thanks in anticipation

Link to comment

For example create an item "Hammer", Location Zone 1 / Display True.

Make a command "Take" and "Use" (if player have to work with it). In this case you have to make the command "Use" invisible (diplay=false)

 

The action of the "Take" command simply is :

move hammer to player

set hammer.take.display = false

set hammer.use.display = true

Show screen Main screen

 

When the player enters the zone, the hammer is visible, he clicked on it and sees only "take". After click the hammer is in his inventory. When he clicked again, only the command "use" is visible.

 

You also can move the hammer without any click to player : Use the onEnter event on zone1 with the command "move hammer to player"

Link to comment

Many Thanks Jonny65

 

I have used your instructions to create 'pick up' and 'drop' buttons and can now move items to and from my inventory.

 

However, when I drop them, how do I drop them into the 'current' zone rather than a named zone

 

the action "Move" appears to require a named zone to move things to. I want to use whatever zone I am in. Is there some sort of "current zone" variable I can use.

 

I cant see anything anywhere.

 

I tried to set up a variable called "current zone" which was set on entering a zone.

 

This seemed to work but I couldnt then use the move action to move things to "current zone"

 

Do you have to use a series of if/else to do this : if current zone = zone a then move hammer to zone a etc. etc. or is there an easier way ?

 

Paul

Link to comment

 

This seemed to work but I couldnt then use the move action to move things to "current zone"

Do you have to use a series of if/else to do this : if current zone = zone a then move hammer to zone a etc. etc. or is there an easier way ?

 

I think an easier but harder way :unsure:<_< is making an user function directly in LUA, otherwise a function of a serie of if statements, which you call from every zone :

 

A "current zone" variable is not available, use instead of this :

 

if zone1 contains player then move hammer to zone1

if zone2 contains player then move hammer to zone2

if zone3 contains player then move hammer to zone3

 

Quick and easy with copy & paste

 

By the way...I think you only need the hammer in a couple of zones and not in every. If you have not too much zones this is a good way.

Link to comment

You could use a author scrpt to get the first active zone. It looks like the following:

 

function GetActiveZone()

-- Get first active zone

local varZone = nil

if table.getn(Player.InsideOfZones) > 0 then

varZone = Player.InsideOfZones[1]

end

return varZone

end

 

If you create this with if/else and you have overlapping zones beware of the order of the zones. Player could belong to more than one zone.

Link to comment

A "current zone" variable is not available, use instead of this :

 

if zone1 contains player then move hammer to zone1

if zone2 contains player then move hammer to zone2

if zone3 contains player then move hammer to zone3

 

Quick and easy with copy & paste

 

By the way...I think you only need the hammer in a couple of zones and not in every. If you have not too much zones this is a good way.

 

This worked great, kind of obvious when you see it and easy to do in urwigo, Many Thanks.

 

Really looking forward to finishing my Wherigo :-)

Link to comment

You could use a author scrpt to get the first active zone. It looks like the following:

 

function GetActiveZone()

-- Get first active zone

local varZone = nil

if table.getn(Player.InsideOfZones) > 0 then

varZone = Player.InsideOfZones[1]

end

return varZone

end

 

If you create this with if/else and you have overlapping zones beware of the order of the zones. Player could belong to more than one zone.

 

Many thanks for the post but unfortunately I dont understand how to do the author script bit.

 

Johnny65s suggestion worked well so no problem, but thanks for your warning about overlapping zones. I don't have any but see how it would be a problem if I did using the solution I have.

Link to comment

I have implemented 'where is the Player' in both ways (if conditions targeting every zone, or with nearly the same LUA function shown, although I like the > 0 check in case they are not even in a zone.. didn't have that in mine, think I'll add it now :).

 

In my experience, the LUA one is better. With the conditional check I would sometimes get bad results. Due to lag? got me but it didn't always update the player location very fast. When I pulled from the InsizeOfZones table, as far as the wherigoPlayer is concerned that is where the player is. So it's kind of like derived data and actual data.

 

Sure you could still have a zone overlap problem with the InsideOfZones, but I don't make any of my wherigos with overlapping zones so it is not a problem.

 

The LUA user code is actually much easier to implement then people think. If using URWIGO there is a Lua Functions tab under VIEW that you can drop this in, then use LUA user expression bubbles to call it. Works great.

 

You could use a author scrpt to get the first active zone. It looks like the following:

 

function GetActiveZone()

-- Get first active zone

local varZone = nil

if table.getn(Player.InsideOfZones) > 0 then

varZone = Player.InsideOfZones[1]

end

return varZone

end

 

If you create this with if/else and you have overlapping zones beware of the order of the zones. Player could belong to more than one zone.

 

Many thanks for the post but unfortunately I dont understand how to do the author script bit.

 

Johnny65s suggestion worked well so no problem, but thanks for your warning about overlapping zones. I don't have any but see how it would be a problem if I did using the solution I have.

Edited by bretina
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...