Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Testing the status of a tile?
New Topic New Poll Post Reply
Poster Message
Casebier
Level: Master Delver
Avatar
Rank Points: 283
Registered: 08-03-2005
IP: Logged
icon Testing the status of a tile? (0)  
Okay, how would you go about testing to see if the player could move to a tile 2 north of their current position in a global script? Basically, I'm trying to recreate the grappling hook as a passive item that doesn't take up an inventory slot.

____________________________
Casebier
--------------------------------
Revisiting old Project: ZelDROD 1 / ZelDROD RPG (If I can ever find the custom graphic files that I made for it.)

[Last edited by Casebier at 10-27-2009 04:54 PM]
10-18-2009 at 02:37 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 4576
Registered: 02-20-2007
IP: Logged
icon Re: Testing the status of a tile? (0)  
The only way I know of is to test for every individual thing that can block the player, one at a time. I wrote a script for this here -- that script does the same for Wall Walking, but could easily be modified to work for the Grappling Hook. All you'd have to do is add a (shorter) test for the intervening square to make sure it's something you can grapple over.

At the time of writing the above-linked script, you could not test for briars on a square. I noted this in the Bugs forum but don't know if it ever got fixed.

____________________________
50th Skywatcher
10-18-2009 at 03:13 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Casebier
Level: Master Delver
Avatar
Rank Points: 283
Registered: 08-03-2005
IP: Logged
icon Re: Testing the status of a tile? (0)  
Hmm... something strange happens when I use that script for a global entity, it takes six turns after jumping a tile before I can jump a second tile, if I don't move. If I do reposition myself, it takes an extra two moves.

Below is what I added at the start and end of the script for making it a global, repeatable action. The first four checks are to see if there is a PIT in front of the player first.
Click here to view the secret text



____________________________
Casebier
--------------------------------
Revisiting old Project: ZelDROD 1 / ZelDROD RPG (If I can ever find the custom graphic files that I made for it.)
10-19-2009 at 07:05 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 4576
Registered: 02-20-2007
IP: Logged
icon Re: Testing the status of a tile? (0)  
Try replacing "Wait 1" with "Wait 0"?

____________________________
50th Skywatcher
10-19-2009 at 07:32 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Casebier
Level: Master Delver
Avatar
Rank Points: 283
Registered: 08-03-2005
IP: Logged
icon Re: Testing the status of a tile? (0)  
Nope. That's what I had originally, but I thought it was perhaps overloading the NPC, so I switched to Wait 1s...

With both Wait 1 and Wait 0, it takes six turns of bumping against a pit to jump a second time. With a Wait 2, it takes seven turns. So all those logic checks seem to take six turns to recycle before they can fire again.

____________________________
Casebier
--------------------------------
Revisiting old Project: ZelDROD 1 / ZelDROD RPG (If I can ever find the custom graphic files that I made for it.)
10-20-2009 at 02:32 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Testing the status of a tile? (+1)  
Set var "_X" = _MyScriptX
Set var "_Y" = _MyScriptY
Wait 1
My guess is that this wait is being affected by your _MyScript variables.

Edit: It looks to me like you are using _MyScript variables as standard variables rather than override variables. Would this code still work if you created new variables in place of the _MyScripts?

____________________________
http://beepsandbloops.wordpress.com/

[Last edited by RoboBob3000 at 10-20-2009 03:06 AM]
10-20-2009 at 03:02 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 4576
Registered: 02-20-2007
IP: Logged
icon Re: Testing the status of a tile? (0)  
RoboBob3000 wrote:
Edit: It looks to me like you are using _MyScript variables as standard variables rather than override variables. Would this code still work if you created new variables in place of the _MyScripts?
No, no, where his script has AND in big letters is where you're meant to insert my script from the other topic. It uses _MyScriptX / Y to check whether wall, doors etc. are blocking the tile you're trying to jump to.

____________________________
50th Skywatcher
10-20-2009 at 12:24 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Testing the status of a tile? (+1)  
Nuntar wrote:
RoboBob3000 wrote:
Edit: It looks to me like you are using _MyScript variables as standard variables rather than override variables. Would this code still work if you created new variables in place of the _MyScripts?
No, no, where his script has AND in big letters is where you're meant to insert my script from the other topic. It uses _MyScriptX / Y to check whether wall, doors etc. are blocking the tile you're trying to jump to.
Oh. But in any case, is _MyScript overriding the wait command here?

____________________________
http://beepsandbloops.wordpress.com/
10-20-2009 at 04:05 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Casebier
Level: Master Delver
Avatar
Rank Points: 283
Registered: 08-03-2005
IP: Logged
icon Re: Testing the status of a tile? (0)  
Okay, not sure why, but I just got it to work. I took out the 2nd-to-last Wait command from the function and now it responds immediately.

____________________________
Casebier
--------------------------------
Revisiting old Project: ZelDROD 1 / ZelDROD RPG (If I can ever find the custom graphic files that I made for it.)
10-25-2009 at 10:51 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Casebier
Level: Master Delver
Avatar
Rank Points: 283
Registered: 08-03-2005
IP: Logged
icon Re: Testing the status of a tile? (0)  
So here's a question... why did that extra Wait command make the script pause for 6 turns?

____________________________
Casebier
--------------------------------
Revisiting old Project: ZelDROD 1 / ZelDROD RPG (If I can ever find the custom graphic files that I made for it.)
10-27-2009 at 04:54 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Tim
Level: Smitemaster
Avatar
Rank Points: 1979
Registered: 08-07-2004
IP: Logged
icon Re: Testing the status of a tile? (0)  
If you had read RoboBob's posts carefully (and ignoring any of Nuntar's posts) you should be able figure it out.

On the other hand, if you received a version of RPG without help files, I've replied this before in a different thread:
Why is this taking over 5 turns to complete?

____________________________
The best way to lose customers is to let little kids running loose on a forum with too many mod points.

[Last edited by Tim at 10-27-2009 06:47 PM]
10-27-2009 at 06:46 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Testing the status of a tile? (+2)  
Casebier wrote:
So here's a question... why did that extra Wait command make the script pause for 6 turns?
The _MyScriptX variable you used overrode the wait command. My guess is that you would see different wait lengths depending on where in the room you were testing the script, as well as your orientation.

Here are my guidlines for using _MyScript variables:

1) Once you've set a _MyScript variable, use it as soon as possible.
2) Once you've used a _MyScript variable, reset it as soon as possible.
3) Never use _Myscript variables to store data.

Even though it might clutter your code, I would recommend following 1) and 2) strictly. Doing this will ultimately improve readibility and lessen obfuscation. Even if you're being careful with your IF structures, separating the setting and resetting of _MyScript variables can lead to disasterous consequences in the future. If, for example, you return to your script later to extend it in some way and forget how you've managed your _MyScript variables, a simple Goto in your IF blocks that would otherwise make sense can devastate your script. And those sorts of issues can be a nightmare to debug.

Create well-named variables that represent the data you're trying to store, and assign their values to the _MyScript variables as close as possible to the exact moment when they're needed.

Here's a reimagining of your script. This is entirely untested, FYI, so it might break somewhere. But shows how, stylistically, I believe _MyScript variables should be used.

Click here to view the secret text


____________________________
http://beepsandbloops.wordpress.com/
10-27-2009 at 08:30 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Casebier
Level: Master Delver
Avatar
Rank Points: 283
Registered: 08-03-2005
IP: Logged
icon Re: Testing the status of a tile? (0)  
Ah, okay. Never really understood what the MyScript variables actually did until now. Still not sure, however, why testing for a Wait While (0,0,0,0) condition tests the... nevermind, I just figured it out... the first two 0's are being overwritten by the MyScript variables.

____________________________
Casebier
--------------------------------
Revisiting old Project: ZelDROD 1 / ZelDROD RPG (If I can ever find the custom graphic files that I made for it.)
10-28-2009 at 01:29 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Testing the status of a tile?
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.