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

Can't get trigger to fire
https://mail.black-squirrel.com/viewtopic.php?f=15&t=33427
Page 1 of 1

Author:  The Bounty Hunter [ Sat Aug 18, 2012 10:23 pm ]
Post subject:  Can't get trigger to fire

Here is a snippet of code from my farm script. I am running into issues though. I have been looking at it off and on for 4 days now so I need an extra set of eyes. My main concern is the trigger for under construction. I can't seem to get this trigger to fire. I have tried scanning from cit, dropping into the sector and displaying with no luck. The port upgrade is not completely functional either but I just have not debugged it yet. Once I got stuck on the under construction I got focused on it.

Code:
:check_ports
        killalltriggers
        waitfor "Citadel command (?"
        setTextLineTrigger port_blown :port_blown "<=-DANGER-=>  Scanners indicate massive debris and heavy"
        setTextLineTrigger under_construction :under_construction "(Under Construction - "
        setTextLineTrigger port_here :port_here "Class"
        setTextLineTrigger needs_port :build_port "Warps to Sector(s)"
        send "s*  "
        pause

        :port_here
           killalltriggers
          IF (PORT.CLASS[$CURRENT_SECTOR] <> 3)
               send "qmnt*  c  "
               waitfor "Citadel command"
                        gosub :quikstats
                        IF ($FIGHTERS < $SHIP_MAX_ATTACK)
                                send "'{" $bot_name "} - Not Enough Fighters to Blow Port*"
                                goto  :end_check_ports
                        ELSE
                                send "q q pay" $SHIP_MAX_ATTACK "*  q  z  n *  l  " & #8 & #8 & $planetToFill & "*  mnt*  c  "
                                goto  :end_check_ports
                        END
         ELSE
                        killalltriggers
                        waitfor "Command [TL="
                        setvar $total_creds_needed 0
                        send "o *"
                        settextlinetrigger upgrading_port :upgrade_port "Choice ?"
                        settextlinetrigger under_construction :under_construction "Command [TL="
                        pause

                        :upgrade_port
                                echo "made it to upgrade the port***"
                                halt
                                killalltriggers
                 send "o 1*"
                 waitfor "0 to quit)"
                 getword currentline $totalFuelUpgradeNeeded 9
                 striptext $totalFuelUpgradeNeeded "("
                 striptext $totalFuelUpgradeNeeded ","
                                send "o 2*"
                 waitfor "0 to quit)"
                 getword currentline $totalOrgUpgradeNeeded 9
                 striptext $totalOrgUpgradeNeeded "("
                 striptext $totalOrgUpgradeNeeded ","
                                send "o 3*"
                 waitfor "0 to quit)"
                 getword currentline $totalEquipUpgradeNeeded 9
                 striptext $totalEquipUpgradeNeeded "("
                 striptext $totalEquipUpgradeNeeded ","
                                send "l  " & #8 & #8 & $planetToFill & "*  c  "
                                setVar $total_creds_needed 300*$totalFuelUpgradeNeeded
                 setVar $total_creds_needed $total_creds_needed+500*$totalOrgUpgradeNeeded
                 setVar $total_creds_needed $total_creds_needed+1000*$totalEquipUpgradeNeeded
                 IF ($total_creds_needed > $CREDITS)
                 setVar $cashonhand $CITADEL_CREDITS
                 add $cashonhand $CREDITS
                 IF ($cashonhand > $total_creds_needed)
                  send "T T " & $CREDITS & "* "
                       send "T F " & $total_creds_needed & "* "
                       setVar $CREDITS $total_creds_needed
                       send "q q"
                                           send "o 1" & $totalFuelUpgradeNeeded & "*"
                       waitfor "Command [TL="
                       echo "****"&$totalOrgUpgradeNeeded
                       send "o 2" & $totalOrgUpgradeNeeded & "*"
                       waitfor "Command [TL="
                       echo "****"&$totalFuelUpgradeNeeded
                       send "o 3" & $totalEquipUpgradeNeeded & "**"
                       waitfor "Command [TL="
                       echo "****"&$totalFuelUpgradeNeeded
                       send "l  " & #8 & #8 & $planetToFill & "*  mnt*  c"
                       goto  :end_check_ports
                                     ELSE
                                           send "'{" $bot_name "} - Not Enough Credits in Cidatel to Upgrade Port*"
                                           goto  :end_check_ports
                                     END
                                END
      END
                goto  :end_check_ports

:build_port
        killalltriggers
        IF ($CREDITS < 50000)
                send "T F 50000*"
                gosub :quikstats
                IF ($CREDITS < 50000)
                        send "'{" $bot_name "} - Not Enough Credits to Make Ports*"
                        send "q q q z n * l  " & #8 & #8 & $planetToFill & "*  c  *"
                END
        ELSE
                send "q q q z n * o3y" $portname "* l  " & #8 & #8 & $planetToFill & "*  c  *"
        END

:end_check_ports
        killalltriggers
        RETURN

:port_blown
        killalltriggers
        send "q q q z n * l  " & #8 & #8 & $planetToFill & "*  c  *"
        goto :end_check_ports

:under_construction
        killalltriggers
        echo "***port under construction****"
        halt
        goto :end_check_ports

Author:  Vid Kid [ Sat Aug 18, 2012 10:37 pm ]
Post subject:  Re: Can't get trigger to fire

In this kind of condition , I use a CR* from the cit. and check the % port has and its max ... that way if the port is used .. it moves on .. if its under construction .. it too moves on because the value is < 1% available and max < 1%

I hope this helps.
It does shorten the script module as well.

Author:  ElderProphet [ Sun Aug 19, 2012 8:38 pm ]
Post subject:  Re: Can't get trigger to fire

I've troubleshot trigger problems for people before where the problem turned out to be Escape Codes (e.g. #27[2,15) enclosed within the text they were trying to trigger off of. I wrote a utility script once that displayed the incoming text and Esc Codes to a TWX window, and logged it to a file, to help with just this sort of problem. I'm not sure if it's included in the scripts Helix zipped from me, but let me know if that would be helpful, and I'll attempt to locate it.

And if that still fails to shed some light on it, let me know and I'll look into it.

Regards,
+EP+

Author:  The Bounty Hunter [ Mon Aug 20, 2012 9:42 am ]
Post subject:  Re: Can't get trigger to fire

I hope that is the case because it would fix my issue. I got delusional the other night trying to fix this. I started moving parts of the code that I know had no bearing on the trigger, but I was out of ideas and options. I did compares to other scripts that were similar. Lonestar has a scrip that uses the same trigger so I even copied his over and nothing. I will look and see if it was part of what Helix got.

Author:  Promethius [ Tue Aug 21, 2012 1:14 am ]
Post subject:  Re: Can't get trigger to fire

Just as a guess, but killalltriggers might be causing it. It appears that the trigger on "Class" goes to:

:port_here
killalltriggers

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