+Geo-Goober Posted August 24, 2008 Posted August 24, 2008 Hi, I'm unsure if this has been discussed but haven't been able to find anything from searching the forum. I've just completed building my first Wherigo. Its become a lot more complex than I anticipated but has been a great way for me to learn the ropes - sink or swim..... One quirk thats got me beat is the behaviour of multiple items interracting with each other. (At this stage not sure if its a quirk of mine or the builder - hopefully mine!) I have two items - bat and ball bat has a swing command ball has a place command bat can swing at any time but will display "your swinging at air" if ball not placed. AND ball cannot be placed unless player within correct zone (i.e. playing field) ---- here follows the code in goober-speak ---- ball in player / visible / active place visible bat in player / visible / active swing visible ---- ball - place command ---- if player not in zoneField then message "cannot place here" else if player in zoneField then message "ball placed ready to hit" move ball to zoneField ***see below*** ---- its with the bat - swing command I had trouble ----- ---- Bat swing conditional on where ball is ---- if ball not in zoneField then message "swinging at air - place ball first" else if ball in zoneField then message "you hit the ball!!" move ball to zoneFindBall This didn't work. As soon as player was within zoneField the "swing bat without place ball" condition didn't work. It went straight to "you hit the ball" regardless of placing the ball. What I had to do to make it work was to create a character and move the ball to the character rather than the zone. WHY? Is it because the player contains ball and player is within zoneField therefore ball is in zoneField ??? I hope someone can shed some light on this Thanks in advance for any help Wayne (Geo-Goober) Quote
+Touchstone Posted August 24, 2008 Posted August 24, 2008 Is it because the player contains ball and player is within zoneField therefore ball is in zoneField ??? Yes, that is what it sounds like to me. Since You contain the Ball, and You are contained within the zoneField, it appears the condition has been met, and indeed, you can hit the Ball. You might need to try something else, such as... 1. You could create another Character and give the Ball to the Character that resides within the zoneField to meet the conidition (e.g. a Pitcher, or a T-ball stand for instance). 2. There might be ways to use the Flags, or Counters to meet the condition, but it seems a bit more complex than just creating the additional character. Quote
+Audion64 Posted August 24, 2008 Posted August 24, 2008 (edited) 2. There might be ways to use the Flags, or Counters to meet the condition, but it seems a bit more complex than just creating the additional character. Using the flags should be pretty simple. Just use the 'Locked' flag for the Ball, that flag is built into every Item by default. Set the 'Locked' status for the Ball item to 'Locked' when starting the cartridge or when the Player acquires the Ball. Only set it to 'Unlocked' when the Player successfully completes the 'Place' command (ie, they have the Ball and are in the correct zone to be able to Place it). Then your Swing Check just has to look at the Locked/Unlocked status of the Ball to determine if it has been properly Placed. Edited August 24, 2008 by Audion Quote
+Touchstone Posted August 24, 2008 Posted August 24, 2008 Using the flags should be pretty simple. Just use the 'Locked' flag for the Ball, that flag is built into every Item by default. Elegant yet simple I knew there had to be a relatively easy way to do this. Good luck with the Cartridge. Quote
+Geo-Goober Posted August 24, 2008 Author Posted August 24, 2008 Awesome! Thanks for your help! I was going round the twist trying to work this out. Thanks for explaining the lock flag -- a much more elegant solution than a dummy character. Thanks Again Wayne (G-G) Quote
Recommended Posts
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.