View unanswered posts | View active topics It is currently Thu Apr 23, 2026 1:48 am



Reply to topic  [ 8 posts ] 
 Bypassing certain prompts 
Author Message
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 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?

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Jun 22, 2009 4:10 pm
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post 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

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Mon Jun 22, 2009 5:34 pm
Profile ICQ WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 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.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Jun 22, 2009 5:45 pm
Profile
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 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

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Fri Jul 03, 2009 9:45 pm
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Bypassing certain prompts
Ewarp is only going to get you killed. Either twarp or macro a lawnmow loop.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Fri Jul 03, 2009 10:24 pm
Profile ICQ WWW
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 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?

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Fri Jul 03, 2009 11:03 pm
Profile
Commander
User avatar

Joined: Fri Jun 09, 2006 2:00 am
Posts: 1401
Location: Canada
Unread post 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
...

_________________
----------------------------
-= QUANTUM Computing 101: 15 = 3 x 5 ... 48% of the time.


Sat Jul 04, 2009 5:04 am
Profile ICQ YIM
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 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.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Sat Jul 04, 2009 10:51 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.