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


Caravel Forum : DROD Boards : Architecture : Unsure where I'm going wrong
New Topic New Poll Post Reply
Poster Message
Drgamer
Level: Master Delver
Rank Points: 113
Registered: 09-09-2006
IP: Logged
icon Unsure where I'm going wrong (+1)  
I'm kind of messing around with scripting, to get a feel for it. But for the life of me, I can't figure out why this isn't working.

I'm essentially trying to create a mimic of sorts. I've tried 'wait for player to move to' and 'wait for player to press (movement key)', neither seems to be working right.

Trying different things gets different, unintended behaviors.

I can get it to sometimes move the way I want, but not always. For instance, the following code only lets it move NE after I move NW:
  Imperative 20
Label Loop
  Wait for turn 0
  If ... 
        Wait for player to input northeast
     Move 1,-1,1,0
  Else 
     Wait for player to input northwest
     Move -1,-1,1,0
  If End 
  Go to Loop

However, if I replace that Else with an If End/If, absolutely nothing happens. It just refuses to do anything at all.

I know that with the way it is in the code tags, it waits until northwest is input, but when I use the if statements it waits for... apparently nothing.

The same thing happens if I have just one if statement, wait, and move command.

Another issue I've bumped into is that if the move is partially blocked, it results in outright refusing to acknowledge any future inputs.


07-13-2014 at 01:39 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 4592
Registered: 02-20-2007
IP: Logged
icon Re: Unsure where I'm going wrong (+2)  
You want Wait 0, not Wait for turn 0. The former halts execution for the current turn, which gets you out of an infinite loop. The latter waits for the 0th turn since the start of the room, and if that's already passed, it continues execution as if the command wasn't there.

Then, you need to replace the Else with End If/If, so that it tests for each possible input rather than waiting until the player inputs NW, but it sounds like you're already aware of that, you just tried something different when your Wait command wasn't working.

____________________________
50th Skywatcher
07-13-2014 at 02:41 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Drgamer
Level: Master Delver
Rank Points: 113
Registered: 09-09-2006
IP: Logged
icon Re: Unsure where I'm going wrong (0)  
Messing around a bit more, I figured out another issue.
Ended up having to manually setting x/y coordinates, otherwise it would only react to every other move.

Now I don't know how to make it not move into obstacles. There doesn't seem to be a way to test a direction without having it actually move in that direction.

And I'm a bit unsure why using Move locked the script up if it got partially blocked. Such as attempting to move northwest and being forced to move north.
07-13-2014 at 03:29 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5058
Registered: 02-04-2003
IP: Logged
icon Re: Unsure where I'm going wrong (0)  
Drgamer wrote:
Now I don't know how to make it not move into obstacles. There doesn't seem to be a way to test a direction without having it actually move in that direction.
How about
If
Is Open Move (...)
...

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
07-13-2014 at 03:48 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
Drgamer
Level: Master Delver
Rank Points: 113
Registered: 09-09-2006
IP: Logged
icon Re: Unsure where I'm going wrong (+1)  
Well that did it. It's a mental shift replacing 'wait for' with 'is' whenever it's preceded by an if statement.

I also didn't see that particular one in the list when I was looking.

So while I'm thinking of it, are there any ways of doing the following (In the current script engine):
1) Find out when/if the player is disarmed, such as by oremites/shallow water. I would assume it would be under 'wait until event', but I don't see anything that would do that. The best I can think of would be to manually set region, which wouldn't help if say, oremites were placed by builders/engineers.

2) Have a custom character treated as if it were a sword blade by monsters that care about sword blades. Alternatively, if I'm mistaken and things like Goblins only care about orientation (when armed): Say if this character is SW of a player facing NE, have the enemy treat it as if there is another character in the player's space facing SW. This isn't super important, but it will make some enemies seem rather foolish without it, with what I have planned.

3) Have a way to have a custom character able to be 'intangible', where they don't block the player from moving onto them. While still being 'visible'/having a sword out. Related would be being able to have the custom character be on the same square as the player.

That might not be as necessary if there's a way to do 2, especially in a way that lets them be 'invisible' with Ghost display on. For instance creating a sword, in script, using a character as the sword. This might require a 'pushable into obstacle/wall' imperative.

4) Using the default script of a custom character when using it as a player role.

5) This one I fully understand not having. Some sort of way of causing the player to 'lose' a single turn.

6) Some way of targeting something that the player stunned that turn. Depending on the answer to #2 below, I can think of a workaround without this.

7) Some way of commenting out specific commands. This would be nice, but it's easy enough to just use an outside text editor and ctrl+shift+b into DROD.

8) Some version of 'wait for entity' that involves a square relative to the custom character's location.

Some other questions I have:
1) Since there doesn't seem to be a clear listing of what Events are in the help file, I'd like some clarification on these:
"Double placed" Does this just mean 'clone/decoy/mimic' has been placed?
"Light Toggled" is this any light in the room?
"Splash" I'm assuming this means anything causes a splash.
"Token toggled" Any token? There doesn't seem to be a way to specify token type.

2) Does 'Wait for player to input' take place before the player actually moves, or is it just a way to have something happen even if the player bumps into a wall in that direction?

-
I'm hoping at least some of these things are possible. Well, except for 7; that's more of a nice feature for testing specific script parts and the like. If not, well, I might be able to create a workaround for what I'm trying to do.
07-13-2014 at 06:06 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Nuntar
Level: Smitemaster
Avatar
Rank Points: 4592
Registered: 02-20-2007
IP: Logged
icon Re: Unsure where I'm going wrong (+2)  
Drgamer wrote: So while I'm thinking of it, are there any ways of doing the following (In the current script engine):
I can help with some of them. I've left out the ones I don't have an answer for.

1) Find out when/if the player is disarmed, such as by oremites/shallow water. Set _MyScriptX = _X, Set _MyScriptY = Y, test for oremites/shallows on (0,0). The "MyScript" variables substitute their values for values used in the script, so this will test for oremites/shallows at the player's location. You need to set the MyScript variables back to -9999 after use -- a default value that tells the script not to override other values.

2) Have a custom character treated as if it were a sword blade by monsters that care about sword blades.
Not in the current engine.

5) This one I fully understand not having. Some sort of way of causing the player to 'lose' a single turn.
Cut scene 1, Wait 1, Cut scene 0

8) Some version of 'wait for entity' that involves a square relative to the custom character's location.
Again, use the "MyScript" variables. The custom character's location is stored in _MyX and _MyY (as opposed to the player's location in _X and _Y) and you can add or subtract to get neighbouring squares. Subtract for west and north, add for east and south.

Since there doesn't seem to be a clear listing of what Events are in the help file, I'd like some clarification on these:
"Double placed" Does this just mean 'clone/decoy/mimic' has been placed?
Yes.

"Light Toggled" is this any light in the room?
Yes. There doesn't seem to be a way to test individual lights.

"Splash" I'm assuming this means anything causes a splash.
Yes -- and "Object fell" means anything that can fall into a pit. In beta testing I requested a pit equivalent of "Splash", not realising it was already there due to the misleading name.

"Token toggled" Any token? There doesn't seem to be a way to specify token type.
You can "Wait for entity Player" at the token's location. For weapon tokens, you should be able to do "If... Set Player weapon" to check the player's current weapon. (This was something I requested at the last minute of beta testing, so I don't know for certain if it was implemented as it isn't in the build I have.)

2) Does 'Wait for player to input' take place before the player actually moves, or is it just a way to have something happen even if the player bumps into a wall in that direction?
It tests the player's keyboard input, regardless of what happens as a result.

____________________________
50th Skywatcher
07-13-2014 at 01:24 PM
View Profile Send Private Message 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 : Unsure where I'm going wrong
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.