www.ClassicTW.com
https://mail.black-squirrel.com/

Bypassing certain prompts
https://mail.black-squirrel.com/viewtopic.php?f=15&t=22382
Page 1 of 1

Author:  Thrawn [ Mon Jun 22, 2009 4:10 pm ]
Post subject:  Bypassing certain prompts

I have been writing scripts specifically for Daala as I have gotten her back into playing TW full time. One of the scripts I wrote for her has encountered the prompt "Stop in this sector?" as her script moves her past one of her sectors. I did not account for this prompt when I wrote her script, and as she watches the screen scroll, she manually presses N to answer the prompt and the script continues.

My question to the scripters here is can I write our scripts where if a certain prompt appears, it is answered and the script runs, but if the prompt does not appear, the script still runs per normal? So for example, write it so if the "Stop in this sector" prompt happens to appear, the N response is given, but if it does not appear, then it still runs normally. If so, may I ask how exactly to achieve this?

Author:  Singularity [ Mon Jun 22, 2009 5:34 pm ]
Post subject:  Re: Bypassing certain prompts

Yes, you can either do it very slowly using triggers or do it very fast using macros. I wrote a tutorial on this years ago.

http://www.navhaz.com/dny_mac_tutorial.txt

Author:  Thrawn [ Mon Jun 22, 2009 5:45 pm ]
Post subject:  Re: Bypassing certain prompts

Singularity wrote:
Yes, you can either do it very slowly using triggers or do it very fast using macros. I wrote a tutorial on this years ago.

http://www.navhaz.com/dny_mac_tutorial.txt


Ack. I was trying to remember where I read on macros, but it was escaping me. I found what I needed and script for Daala now runs without her having to manually answering prompts. Thanks for the steer in the direction.

Author:  Thrawn [ Fri Jul 03, 2009 9:45 pm ]
Post subject:  Re: Bypassing certain prompts

Ok I now have an issue with the prompt and I think my syntax may be incorrect. I have this script where a "safe sector" is stored in the variable $safe_sector. When I disconnect and reconnect, this script will move me to the safe sector I has saved to the variable.

The problem is I have a bubble of 5 sectors: 19985- 3662- 14834- 5043- 5387. 19985 is the gateway; 3662 just has 5 limpets; 14834 has 1k def figs, 5 planets, 100 armids; 5043 has 5 planets, 1k def figs, 100 armids; 5387 has 5 planets, 100 armids, 1k def figs. When I run the script, it enters the "safe sector" and moves accordingly. If I have 14834 as the safe sector, there are no issues. If I enter 5043 or 5387 as the safe sector, the "Stop in this sector" prompt appears as it moves me from 14834. I would assume I have set the triggers incorrectly.

I would appreciate insight to correcting the error. The code is as follows:

Code:

loadvar $safe_sector
settextlinetrigger msg1 :msg1 "Sub-space comm-link terminated"
setTextTrigger stop1 :stop1 "Stop in this sector"
pause

:stop1
send "*"
pause

:msg1
killtrigger msg1
send "i"
setTextLineTrigger iSector :iSector "Current Sector"
pause

:iSector
getword currentline $curSector 4
if ($curSector <> $safe_sector)
   send "'*SafeSector Activated. Warping to Safe Sector " & $safe_sector & ".**"
   send "*"
   waitfor "Command [TL="
   send $safe_sector & "*"
   waitfor "Do you want to engage the TransWarp drive?"
   send "n"
   waitfor "Engage the Autopilot?"
   send "e"
   waitfor "Command [TL=00:00:00]:[" & $safe_sector & "]"
   echo "*Arriving in Safe Sector.*"
   send "'*Arriving in Safe Sector " & $safe_sector & ".**"
   halt
else
   send "*"
   waitfor "Command [TL=00:00:00]:[" & $safe_sector & "]"
   echo "*Already in Safe Sector.*"
   send "'*Already in Safe Sector " & $safe_sector & ".**"
   halt

end

Author:  Singularity [ Fri Jul 03, 2009 10:24 pm ]
Post subject:  Re: Bypassing certain prompts

Ewarp is only going to get you killed. Either twarp or macro a lawnmow loop.

Author:  Thrawn [ Fri Jul 03, 2009 11:03 pm ]
Post subject:  Re: Bypassing certain prompts

Ok, but why does the script hang when it passes from 14834 to 5043 when coming from outside the bubble? If I run from sector 5387 to 19985, the "Stop in this sector" prompts are answered and the script does not hang. I'm trying to get a wrap on the triggers and the prompts a bit more efficiently. Is my trigger incorrect, or placed in the incorrect spot?

Author:  LoneStar [ Sat Jul 04, 2009 5:04 am ]
Post subject:  Re: Bypassing certain prompts

after you handle the stop1 trigger, you need to set it again before you pause:
Code:
loadvar $safe_sector
settextlinetrigger msg1 :msg1 "Sub-space comm-link terminated"
setTextTrigger stop1 :stop1 "Stop in this sector"
pause

:stop1
send "*"
setTextTrigger stop1 :stop1 "Stop in this sector"
pause


And you should killalltriggers when you don't need to worry about the :stop1 trigger
Code:
:msg1
KillAllTriggers
send "i"
setTextLineTrigger iSector :iSector "Current Sector"
pause
...

Author:  Thrawn [ Sat Jul 04, 2009 10:51 am ]
Post subject:  Re: Bypassing certain prompts

Ok, it appears that my mind is "slipping" the older I get. I found the problem. I had another script running that had that prompt trigger and instead of sending "n", it was trying to display the sector. Once removed, my issues stopped and the "stop in this sector" prompts are now being handled the way I want them.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/