Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Script Failing Inconsistantly (Non-deterministic beheviour, oh no)
New Topic New Poll Post Reply
Poster Message
hyperme
Level: Smitemaster
Avatar
Rank Points: 1070
Registered: 06-23-2006
IP: Logged
icon Script Failing Inconsistantly (0)  
So I have an NPC:

Click here to view the secret text


Sometimes, it works. Sometimes, however, it doesn't. I can't seem to find any consistent pattern as to why.

All sorts of things make it not work - starting the room via F5 in the editor, restarting, using the special command key.

So I am I missing something, or I have I somehow broken DRODscript?

____________________________
[Insert witty comment here]
Qzvlkx?
07-16-2016 at 05:23 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
averagemoe
Level: Smiter
Avatar
Rank Points: 488
Registered: 03-22-2012
IP: Logged
icon Re: Script Failing Inconsistantly (-1)  
Well, for starters the script will only reset the _MyScriptX and _MyScriptY variables if there is no open move. That tends to mess with itself and other scripts. Put an extra set of = -9999s just before the return to start command. Also, the move command would probably work better as a "move to" command.

____________________________
There are two types of sheep in the world. Those who jump off a bridge when told to, and those who jump off a bridge when told not to. Don't be either.
07-17-2016 at 01:14 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Lucky Luc
Level: Smitemaster
Rank Points: 1215
Registered: 08-19-2012
IP: Logged
icon Re: Script Failing Inconsistantly (0)  
Nah, the script should be fine;

- MyScriptX and MyScriptY actually do get reset before any command requiring them is called and

- The "Move" command is the classic "Move in the direction you're facing" variant.

And actually, the script seems to work fine to me. I just tested it with a single NPC, but it worked just the way I'd expect. Do you have any example rooms where it fails? All of the three things you've mentioned worked perfectly for me.
07-17-2016 at 10:42 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 1070
Registered: 06-23-2006
IP: Logged

File: Broken Script.hold (2.1 KB)
Downloaded 43 times.
License: Public Domain
icon Re: Script Failing Inconsistantly (+1)  
Hold with script attached.

It's still failing for me, and it's seemingly random. Knowing my luck, it will work perfectly for everyone else.

____________________________
[Insert witty comment here]
Qzvlkx?
07-17-2016 at 12:06 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Doom
Level: Smitemaster
Avatar
Rank Points: 3226
Registered: 07-05-2004
IP: Logged
icon Re: Script Failing Inconsistantly (+1)  
I can see some weird stuff happening in hyperme's room that I can't explain. Mostly because I've no idea how MyScript scripts work, having never tried to use it.

Try following these steps for interesting results:

- Press special command key at the start of the room, wait one turn, press R.
- Go straight to the orb and hit it. Decoy isn't moving as it should be. If you skip step one, the decoy moves, so something isn't getting reset properly.
- Wait a dozen turns or so. Hit a CCW arrow token. Decoy starts moving SE.
- Undo. Decoy teleports to the south end of the room, as if it was moving the whole time. You can also press F4 before undoing to record a demo where decoy moves south.


07-17-2016 at 01:58 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
kieranmillar
Level: Smitemaster
Rank Points: 2670
Registered: 07-11-2014
IP: Logged
icon Re: Script Failing Inconsistantly (+2)  
I fixed your script:

  Imperative 11
Label Move Loop
  Set var "_MyScriptX" = _MyX
  Set var "_MyScriptY" = _MyY
  If ... 
        Wait for item Force arrow (northwest),0,0,0,0
     Set var "_MyO" = 0
  Else If 
        Wait for item Force arrow (north),0,0,0,0
     Set var "_MyO" = 1
  Else If 
        Wait for item Force arrow (northeast),0,0,0,0
     Set var "_MyO" = 2
  Else If 
        Wait for item Force arrow (west),0,0,0,0
     Set var "_MyO" = 3
  Else If 
        Wait for item Force arrow (east),0,0,0,0
     Set var "_MyO" = 5
  Else If 
        Wait for item Force arrow (southwest),0,0,0,0
     Set var "_MyO" = 6
  Else If 
        Wait for item Force arrow (south),0,0,0,0
     Set var "_MyO" = 7
  Else If 
        Wait for item Force arrow (southeast),0,0,0,0
     Set var "_MyO" = 8
  If End 
  Set var "_MyScriptX" = (_MyO % 3) - 1
  Set var "_MyScriptY" = (_MyO / 3) - 1
  Move 0,0,1,1
  Set var "_MyScriptX" = -9999
  Set var "_MyScriptY" = -9999
  Go to Move Loop


Why I think it didn't work: As far as I know Wait for open move always checks if the move is open FOR THE PLAYER and assumes the player's position! You can't use it to check for anybody else!

EDIT: nope, my theory is untrue, and Doom's example case proves there's an actual undo desynch bug going on here. My script works because it avoids the problem command entirely.

[Last edited by kieranmillar at 07-17-2016 10:01 PM]
07-17-2016 at 09:49 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1531
Registered: 06-13-2015
IP: Logged
icon Re: Script Failing Inconsistantly (0)  
I can verify Wait for Open Move checks for whether the character running the script has an open move, including seeing the likes of pits as an open move if said character is flying (i.e., wraithwing-based). I've made a "few" scripts relying on that behavior, let's just say. But that command has pretty much never been unstable for me...:?

I copied JUST the arrow-moving character to another room and haven't been able to get inconsistent behavior out of it yet. Maybe the problem is in the other script or the interaction between "Open move" detection and build markers somehow?

____________________________
109th Skywatcher

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


[Last edited by Xindaris at 07-17-2016 11:26 PM]
07-17-2016 at 11:19 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 2670
Registered: 07-11-2014
IP: Logged
icon Re: Script Failing Inconsistantly (+5)  
I have discovered more about what is triggering the issue!

The bug happens under the following conditions:
* The check for the open move is specifically on the character's sword
* A citizen or builder is present.
* A build marker has been placed.

Take the builder out of the room, the problem goes away. Don't try to build anything, the problem goes away. Change the character to e.g. a construct, the problem goes away. Change the location of the open move to be e.g. _MyO + 1, the problem goes away. Set the character's_MyWeapon to -2 (disarmed), the problem goes away.

It seems there is nothing wrong with hyperme's script, but attempting to pathfind to a buildmarker (whether possible or not) appears to cause NPC swords to be treated as an obstacle for that same character in all future checks? Utterly bizarre.

[Last edited by kieranmillar at 07-17-2016 11:55 PM]
07-17-2016 at 11:53 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5058
Registered: 02-04-2003
IP: Logged
icon Re: Script Failing Inconsistantly (0)  
hyperme, is this still an issue?

____________________________
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.
10-03-2020 at 07:23 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
hyperme
Level: Smitemaster
Avatar
Rank Points: 1070
Registered: 06-23-2006
IP: Logged
icon Re: Script Failing Inconsistantly (+1)  
Yep, this is still not working. I'd assume it's something wrong with weapon checking, but I can't see why build markers would affect that.

____________________________
[Insert witty comment here]
Qzvlkx?
10-03-2020 at 12:56 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5058
Registered: 02-04-2003
IP: Logged
icon Re: Script Failing Inconsistantly (0)  
Thanks for confirming.

Looks like this is going to become the subject of a serious debugging session.

____________________________
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.
10-06-2020 at 05:33 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
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Script Failing Inconsistantly (+4)  
Sorry Mike, I had spare 5 minutes. Turned out to be extremely simple - some entities that have their own pathfinding use sword cache calculated once at the start of the pathfinding process.

Character's IsOpenMove function also can use that cache, which is helpful because they can also move using pathfinding. The issue is that the cache was not cleared at the start of character's move, meaning the character could use sword cache generated by, say, an Engineer. Which would cause the character to stop on its own weapon, because the cache included the character's weapon.

PR

____________________________
My website | Facebook | Twitter
10-06-2020 at 11:33 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5058
Registered: 02-04-2003
IP: Logged
icon Re: Script Failing Inconsistantly (+2)  
Wow, that's obscure! You're a genius!

And I am totally put out that I didn't get to spend all night trying to debug this thing.

Nah, I'm good :D

____________________________
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.
10-06-2020 at 10:56 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
kieranmillar
Level: Smitemaster
Rank Points: 2670
Registered: 07-11-2014
IP: Logged
icon Re: Script Failing Inconsistantly (+1)  
Can confirm in 5.1.1.alpha.2020-10-16 that hyperme's example hold seems to work correctly, with the steps outlined by Doom not showing any buggy behaviours. As far as I could tell, all appeared to be working correctly.
10-17-2020 at 09:19 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 : Bugs : Script Failing Inconsistantly (Non-deterministic beheviour, oh no)
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.