Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Bugs : "Move" Script should work, completely fails (An hour of checking and no errors found)
New Topic New Poll Post Reply
Poster Message
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon "Move" Script should work, completely fails (+1)  
Okay, for some reason, the following code WILL NOT WORK, despite everything being correct. They should keep moving forward until hitting an obstacle, then flip directions and start going the other way. However, it starts out completely dandy, but as soon as it hits an obstacle, it will just keep flipping forever, unless the obstacle stops blocking them, and then will keep going the direction they previously went, no matter what!
I've checked time and again, and the first two set variable statements always return a correct value for movement (I use them in the missiles, they work perfectly there). I don't know what's going on here, but the script should work perfectly!
Label Loop
  Set var "_MyScriptX" = (_MyO % 3) - 1
  Set var "_MyScriptY" = (_MyO / 3) - 1
  Speech "$_MyScriptX$, $_MyScriptY$",Normal,Self,0,.
  If ... 
        Move 0,0,0,0
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
  Else 
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
     Set var "_MyO" = 8 - _MyO
     Wait 0
  If End 
  Go to Loop


____________________________
lurking

[Last edited by mrimer at 01-17-2016 03:38 PM]
07-11-2009 at 01:17 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Tim
Level: Smitemaster
Avatar
Rank Points: 1979
Registered: 08-07-2004
IP: Logged
icon Re: Script should work, completely fails (0)  
The move command in RPG is borrowed from the original DROD scripting, and works exactly like you described.

It is possible to do the "hit-and-flip" in RPG, but you'll need to use a different command.

I can put a script like that on the Architecture board. But since this is the Bugs Board, I'll just say:

Works as designed.

____________________________
The best way to lose customers is to let little kids running loose on a forum with too many mod points.
07-11-2009 at 03:08 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon Re: Script should work, completely fails (0)  
What? No. It does not work as designed at all. I can only assume that you don't know what the script actually should do, because what you just said makes absolutely no sense in this context. Therefore, I will explain it as plainly as possible, as to clean up any confusion.
Note: Kinda biggish.
Click here to view the secret text
Remember, I'm the guy that can make almost anything happen (if I don't procrastinate it out of existence) with the scripting engine one way or another. I know a scripting bug when I see it.

____________________________
lurking
07-11-2009 at 04:35 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3771
Registered: 12-28-2004
IP: Logged
icon Re: Script should work, completely fails (+1)  
If I am correct, Move doesn't work as expected in RPG (that works differently from TCB) - script which worked in TCB did not work in RPG. It can be easily fixed by writing two functions which check if you can move FROM current tile and other which checks if you can move TO new tile, and with these two coding monsters becomes easy.


____________________________
My website
07-11-2009 at 09:53 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
Tim
Level: Smitemaster
Avatar
Rank Points: 1979
Registered: 08-07-2004
IP: Logged

File: Bumpy.drh (1.5 KB)
Downloaded 53 times.
License: Public Domain
icon Re: Script should work, completely fails (+1)  
Since I'm incredibly busy nowadays, I'll show you a hold I've made earlier.

I've also included your script there as a comparison.

____________________________
The best way to lose customers is to let little kids running loose on a forum with too many mod points.
07-11-2009 at 10:05 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
agaricus5
Level: Smitemaster
Rank Points: 1838
Registered: 02-04-2003
IP: Logged
icon Re: Script should work, completely fails (+2)  
Tim wrote:
It is possible to do the "hit-and-flip" in RPG, but you'll need to use a different command.
That is true, as you demonstrate in your hold.

I can put a script like that on the Architecture board. But since this is the Bugs Board, I'll just say:

Works as designed.
Sorry, but in this case, I think Monkey is right. There apparently is something wrong with the If... Move command (whether this is also true in TCB is unclear), but it's quite subtle and apparently must be a consequence of the way the If... Move command is processed along with the MyScript variables.

Basically, using the script provided, it seems that the character will rotate on hitting an object, and it will output the correct MyScript values on the next turn. However, the If... Move function uses the original MyScript values, and not these new ones, despite being reset several times. It's almost as if the failure of the If... Move command to execute causes whatever coordinates were used to be retained in memory and to be used even if MyScript is different.

For example, if you take that character and make it face south, it will move (0,1) until it hits a wall. On the move it is obstructed, it faces north. On the move after it is obstructed, it calculates MyScriptX=0 and MyScriptY=-1, however, the character still attempts to move (0,1). You can prove this by using a pickaxe to remove the obstructing wall; no matter which way the character faces, it will always move south.

One other buggy thing about this character is the way it will react to you. If the obstruction is a monster, object or some other impenetrable thing, the above happens. If you are the obstacle, however, the script appears to pause for one move at the If... Move statement. Since the character moves after you do, this is clearly non-intuitive and inconsistent.

Remember, I'm the guy that can make almost anything happen (if I don't procrastinate it out of existence) with the scripting engine one way or another. I know a scripting bug when I see it.
Um, yes. But there's no need to be so arrogant about it; you're not the only one here who can use the scripting system.

____________________________
Resident Medic/Mycologist

[Last edited by agaricus5 at 07-11-2009 11:35 AM]
07-11-2009 at 11:34 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1982
Registered: 10-23-2003
IP: Logged
icon Re: Script should work, completely fails (+2)  
Here's a solution for you. It does look like using Move as the condition for an If statement is unreliable. Thankfully, Wait for Open Move is overridable with _MyScriptX. Credit to skell.

The check for Wait for Open Move says northwest, but in reality, the stated direction doesn't matter.

Label Loop
  Set var "_MyScriptX" = _MyO
  If ... 
        Wait for open move northwest
     Set var "_MyScriptX" = (_MyO % 3) - 1
     Set var "_MyScriptY" = (_MyO / 3) - 1
     Move 0,0,0,0
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
  Else 
     Set var "_MyO" = 8 - _MyO
     Set var "_MyScriptX" = (_MyO % 3) - 1
     Set var "_MyScriptY" = (_MyO / 3) - 1
     Move 0,0,0,0
     Set var "_MyScriptX" = -9999
     Set var "_MyScriptY" = -9999
  If End 
  Go to Loop



In this version of the script, turning and moving happens simultaneously. To make it so turning takes it's own turn, remove the bolded lines and put the Wait 0 command back.

Hopefully this works for you - I don't know all the ins and outs of Wait for Open Move, so there may be weird exceptions you don't like. For example, the NPC won't bounce off of Tendry.

This was a fun challenge! Clever scripting!

____________________________
http://beepsandbloops.wordpress.com/

[Last edited by RoboBob3000 at 07-11-2009 07:30 PM]
07-11-2009 at 07:19 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: Script should work, completely fails (+3)  
Been looking at this a bit today, and I think I see where the difference lies. A certain statement was removed from Character's code when implemented in DROD RPG.

CCharacter::Process
Click here to view the secret text

I don't know why this was removed. bMovingRelative is supposed to be set when first running a Move command so that the game knows where its current destination is and doesn't reupdate it until the command is done with. That means that bMovingRelative must be set to false once we're done with this command. If Statements only ever run the command once, so I don't understand why this would be removed for DROD RPG; the source doesn't seem to offer any clues as to why this was done, and its absence leads to the quite clear bug we see here where future Move commands are still trying to reach the old destination set in the If statement.
11-15-2010 at 03:51 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5166
Registered: 02-04-2003
IP: Logged
icon Re: Script should work, completely fails (0)  
Wow, this scripting issue with "Move" has been in DROD RPG forever. My apologies for the trouble. Fixed by putting the missing code back in rev 101.

____________________________
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.

[Last edited by mrimer at 01-15-2016 06:10 PM]
01-13-2016 at 02:08 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: 3027
Registered: 07-11-2014
IP: Logged
icon Re: Script should work, completely fails (+1)  
The script in the opening post now works correctly in 1.2.3.116 :thumbsup
01-17-2016 at 10:27 AM
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 RPG Boards : RPG Bugs : "Move" Script should work, completely fails (An hour of checking and no errors found)
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.