Announcement: Why not try our official idea generator for inspiration when making puzzles?


Caravel Forum : DROD Boards : Architecture : Clone scripting question
New Topic New Poll Post Reply
Poster Message
disoriented
Level: Smitemaster
Rank Points: 1093
Registered: 08-07-2007
IP: Logged
icon Clone scripting question (0)  
Is it possible in DRODscript to distinguish between, say, Beethro and a preplaced clone?

I want to do something different depending on which entity does something.

(As an aside, it's not possible to have 2 clones with different player roles simultaneously, is it?)

____________________________
34th Skywatcher
07-07-2017 at 07:53 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
superluminal
Level: Delver
Rank Points: 55
Registered: 05-26-2016
IP: Logged
icon Re: Clone scripting question (0)  
The game does indeed let you distinguish between the player and a clone.
Wait for entity...
lets you check for Doubles, which includes clones. More specifically,
Wait for entity type...
lets you check for clones.

I've designed a script that lets you use the CMD key to switch between two characters of different types:
Click here to view the secret text

This script will preserve your clone's ally's position, orientation, and even weapon type! Unfortunately, the CMD key doesn't work like the TAB key -- there's a turn-long delay between when you switch from one character to the other. Also, your ally isn't immune to monster attacks. Finally, you need to buttress this script with a bit of extra code to have your ally keep following you to different rooms. So my script kinda works like two clones with two different players roles, but it's not quite the same. Use it if you want, ignore it if you don't.

____________________________
spacelike
07-08-2017 at 12:02 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Resert On
Level: Goblin
Avatar
Rank Points: 26
Registered: 05-02-2017
IP: Logged
icon Re: Clone scripting question (0)  
I think preplaced clone is the clone before placed to the field.

____________________________
Don't take it seriously.
Click here to view the secret text

07-08-2017 at 12:25 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
disoriented
Level: Smitemaster
Rank Points: 1093
Registered: 08-07-2007
IP: Logged
icon Re: Clone scripting question (0)  
Thanks superluminal.


I know "Wait for..." hangs around until the condition is met.

"If... Wait for..." checks the condition once and proceeds inside the body if the condition is true.

But what does it mean to have a "set" statement as the condition for an If statement?

____________________________
34th Skywatcher
07-08-2017 at 12:30 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
superluminal
Level: Delver
Rank Points: 55
Registered: 05-26-2016
IP: Logged
icon Re: Clone scripting question (+1)  
The "Set..." commands are queryable. You can place them on their own, and they'll work on their own, but you can also place them after an If statement to make them work like a "Wait for..." command. Using them like this makes them return a True/False that the If statement can interpret.

In other words, ignore the word "Set". Read the script like "If set player role == Beethro, then do xyz". The grammar's not perfect, but it works.

____________________________
spacelike
07-08-2017 at 12:45 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
disoriented
Level: Smitemaster
Rank Points: 1093
Registered: 08-07-2007
IP: Logged

File: open.png (306.1 KB)
Downloaded 100 times.
License: Public Domain
icon Re: Clone scripting question (0)  
Thanks.

Sorry for the endless questions, but does this command actually exist?



It doesn't seem like Wait for Open Move will do what I want. I am trying to check if a particular tile (relative to the player) is open.

____________________________
34th Skywatcher

[Last edited by disoriented at 07-08-2017 07:01 AM]
07-08-2017 at 06:59 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smiter
Avatar
Rank Points: 428
Registered: 06-13-2015
IP: Logged
icon Re: Clone scripting question (0)  
Based on its description, I'm 99% sure that's just a mislabeled "Wait for Open Move". I have definitely never seen that command in the editor.

If you want to know whether or not a tile adjacent to the player is an open move for the player, you can have an invisible NPC with the same appearance as the current player role teleport onto the player's tile (_X, _Y) and then wait for open move while in that location. I did this with a wraithwing-based character to make "jumping" check for obstructions properly in Beethro's Awakening.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 07-08-2017 02:42 PM]
07-08-2017 at 02:40 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Resert On
Level: Goblin
Avatar
Rank Points: 26
Registered: 05-02-2017
IP: Logged
icon Re: Clone scripting question (0)  
Sorry to ask it here, but what means of variable _ReturnX and _ReturnY? Also, what is 'Return' command for?

____________________________
Don't take it seriously.
Click here to view the secret text

07-08-2017 at 03:40 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Xindaris
Level: Smiter
Avatar
Rank Points: 428
Registered: 06-13-2015
IP: Logged
icon Re: Clone scripting question (0)  
_ReturnX, Y variables are what "Get Natural Target" and maybe some other commands output their results to. The Return command is for use with GoSub. If you call a label with GoSub then a Return inside that label returns the script to the point just after the GoSub command. Very good for recursion.

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text

07-08-2017 at 05:19 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
superluminal
Level: Delver
Rank Points: 55
Registered: 05-26-2016
IP: Logged
icon Re: Clone scripting question (0)  
_ReturnX and _ReturnY are where the "Get natural target" and "Get entity direction" store their results. Those commands don't do anything but update those variables. They aren't queryable. Also, keep in mind that _ReturnX, Y, are global variables, so if two characters use these commands on the same turn, you can only use the latest result.

"Return" is used in conjunction with "GoSub" for modular scripting. Here's an example script:
  Speech "1",Normal,Self,0,.
  Speech "2",Normal,Self,0,.
  GoSub Label
  Speech "4",Normal,Self,0,.
  Speech "5",Normal,Self,0,.
  End
Label Label
  Speech "3",Normal,Self,0,.
  Return 
This character will say 1 and 2. "GoSub" jumps him to the label, where he says 3. "Return" jumps him back to "GoSub" and the script continues on from there. It's surprisingly useful! I wish it was in DROD RPG!
quote:
Xindaris wrote:
Very good for recursion.
I see what you did there. :P

____________________________
spacelike

[Last edited by superluminal at 07-08-2017 05:33 PM]
07-08-2017 at 05:33 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
disoriented
Level: Smitemaster
Rank Points: 1093
Registered: 08-07-2007
IP: Logged
icon Re: Clone scripting question (0)  
quote:
Xindaris wrote:
If you want to know whether or not a tile adjacent to the player is an open move for the player, you can have an invisible NPC with the same appearance as the current player role teleport onto the player's tile (_X, _Y) and then wait for open move while in that location. I did this with a wraithwing-based character to make "jumping" check for obstructions properly in Beethro's Awakening.


Thanks, this works.

____________________________
34th Skywatcher

[Last edited by disoriented at 07-09-2017 02:37 AM]
07-09-2017 at 12:37 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Architecture : Clone scripting question
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.