Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : General : Wait for open move?
New Topic New Poll Post Reply
Poster Message
GerAvos
Level: Delver
Rank Points: 51
Registered: 05-28-2016
IP: Logged
icon Wait for open move? (0)  
The wait for open move command sometimes doesn't work and I can't figure out why. My script:

Label Start
  If ... 
        Wait for player to input Special Command
     If ... 
           Wait for player to face northwest
        Set var "_MyScriptX" = _X-1
        Set var "_MyScriptY" = _Y-1
        Teleport to 0,0
        Set var "_MyScriptX" = _X-2
        Set var "_MyScriptY" = _Y-2
        If ... 
              Wait for open move northwest
           Teleport Player to 0,0
        Else 
           Speech "That doesnt work...",Normal,Player,0,.
        If End 
     If End 
  If End 
  Set var "_MyScriptX" = -9999
  Set var "_MyScriptY" = -9999
  Wait 0
  Go to Start


This is supposed to teleport the player 2 tiles northwest if he is facing northwest and the destination is an open move. For some reason I most of the time can teleport into walls though.

[Last edited by GerAvos at 10-15-2016 06:19 PM]
10-15-2016 at 06: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: Wait for open move? (+1)  
Pretty sure the problem is that "Wait for open move" 's direction is overwritten by one of the Myscript variables (I forget which one). You'll have to reset them both to -9999 before doing the check and then set them to what's needed for the teleport after doing the check.

When dealing with myscript it's generally a good strategy to reset them before doing any command that has numbers you input (including things like directions, a location or location range, and some other things you might not expect) whatsoever unless you want said command to read whatever's in myscript at that time.

____________________________
109th Skywatcher

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


[Last edited by Xindaris at 10-15-2016 06:54 PM]
10-15-2016 at 06:50 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: Wait for open move? (+1)  
Yep, the direction got overwritten. I got my script to work now :)
10-15-2016 at 08:33 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 : Wait for open move?
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.