Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : General : A script problem with Beethros position
New Topic New Poll Post Reply
Poster Message
GerAvos
Level: Delver
Rank Points: 51
Registered: 05-28-2016
IP: Logged

File: Beethros Position.hold (810.9 KB)
Downloaded 37 times.
License: Public Domain
icon A script problem with Beethros position (0)  
I've come across another script problem that doesn't make sense to me. It could be a bug with DROD.

I have an example hold attached. If you press the special command key and select Teleport, Beethro teleports 2 tiles into the direction he is facing. If the destination is not a open move Beethro will say "That doesn't work" in german.

So far so good, but there is a weird problem. If Beethro is in column 7 and uses the Teleport while facing down, he will teleport diagonally... even if there is a wall. Why is this only in column 7?
10-16-2016 at 06:49 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 2670
Registered: 07-11-2014
IP: Logged
icon Re: A script problem with Beethros position (+2)  
It's a _MyScript error.

Almost every single command in DROD gets overidden by MyScript values. This includes Wait for player to face direction. When MyScriptX is 7, this treats the wait for player to face southeast question as though you're actually checking to test if the player is facing south, so it executes the code for when you should face Southeast too.

Allowing MyScript values to be anything other than -9999 for more than one command is just asking for problems. If you need to store a value in the meantime, create a new variable, don't store the value in MyScript.
10-16-2016 at 07:27 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Lucky Luc
Level: Smitemaster
Rank Points: 1215
Registered: 08-19-2012
IP: Logged
icon Re: A script problem with Beethros position (+1)  
Yeah, what Kieran said.

Unless I'm missing something, a simple way to fix this would be to directly use "TeleDestX" and "TeleDestY" in the if-clauses, so the _MyScript-values aren't touched. In general, changing them and leaving them for a while is a pretty unsafe thing to do unless you really know what you're doing.

And as a side note, you could quite probably use the overriding feature for "Wait for player to face" combined with a loop to avoid a lot of code duplication. If you'd like some help with that, just let us know! :)
10-16-2016 at 07:31 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
GerAvos
Level: Delver
Rank Points: 51
Registered: 05-28-2016
IP: Logged
icon Re: A script problem with Beethros position (0)  
Ah, damn. xD I see. I really have to be more careful with the MyScript variables.

Thank you both.

[Last edited by GerAvos at 10-16-2016 07:45 PM]
10-16-2016 at 07:45 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
kieranmillar
Level: Smitemaster
Rank Points: 2670
Registered: 07-11-2014
IP: Logged
icon Re: A script problem with Beethros position (+3)  
For funsies I decided to make my own version of this script that strips out massive amounts of code duplication.

Click here to view the secret text

10-16-2016 at 07:48 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
GerAvos
Level: Delver
Rank Points: 51
Registered: 05-28-2016
IP: Logged
icon Re: A script problem with Beethros position (0)  
Interesting.. Another thing I realised is that you won't be able to teleport through opposing force arrows.

Is there a way to make the "Wait for open move" command ignore force arrows? I'm trying to remove and rebuild a force arrow and have the "Wait for open move" command in between but that doesn't seem to work.
10-16-2016 at 10:18 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1531
Registered: 06-13-2015
IP: Logged
icon Re: A script problem with Beethros position (0)  
If you only want specific things like walls and pits to apply and not force arrows you'll have to go the route of checking the target tile for presence of every single kind of item you don't want to allow the teleportation to land on. Be prepared to make a very long series of Else If's.

____________________________
109th Skywatcher

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

10-17-2016 at 02:17 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
GerAvos
Level: Delver
Rank Points: 51
Registered: 05-28-2016
IP: Logged
icon Re: A script problem with Beethros position (+1)  
Haha, nevermind. Removing and rebuilding a force arrow worked. My scripts work perfectly now.
10-17-2016 at 05:02 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : General : A script problem with Beethros position
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.