www.ClassicTW.com
http://www.classictw.com/

2 ship colo script problem
http://www.classictw.com/viewtopic.php?f=15&t=33153
Page 1 of 1

Author:  Helix [ Mon Apr 09, 2012 7:58 pm ]
Post subject:  2 ship colo script problem

This started as a simple macro to do 2 ship coloing in an unlimited. I added an edited version of one of prom's menus. The macro idea came from Xanos, and built up from there. I still plan to add a status window instead of the send "' Planet " $coloPlanet " product trips left: " index number "*" "" after each cycle. And some error checking for the variables and a navhaz check.

I am having a problem with this script. It works but in the equipment cycle, I am getting 9 extra trips and I cannot figure out why. I added the full script as an attachment.
Attachment:
___colomac.zip [1.28 KiB]
Downloaded 530 times


Code:
#This variable is for the planet to be colo'ed:  $coloPlanet
#This variable is for the ship you are in:  $ship1
#This variable is for the 2nd ship: $ship2
#This variable is for the sector outside fedspace: $sector1
#This variable is for the fed space sector (must be 3-7): $sector2
#This variable is for the number of trips to be dropped in fuel: $trips_f
#This variable is for the number of trips to be dropped in organics: $trips_o
#This variable is for the number of trips to be dropped in equipment: $trips_e

# Set the user input variable
setVar $i_coloPlanet 0
setVar $i_ship1 0
setVar $i_ship2 0
setVar $i_sector1 0
setVar $i_sector2 0
setVar $i_trips_f 0
setVar $i_trips_o 0
setVar $i_trips_e 0

# Load the script variables
loadVar $coloPlanet
loadVar $ship1
loadVar $ship2
loadVar $sector1
loadVar $sector2
loadVar $trips_f
loadVar $trips_o
loadVar $trips_e


#Removed the menu - see the attachment

#start the script run.
:beginWindow
#emply the holds of both ships
send " q j y"
send " x " $ship2 "**"
send " j y *"
send " x " $ship1 "**"
send "l " $coloPlanet " *"

#Fuel grab working fine, removed.
#uses $trips_f for the number of trips and $n as the index

#Organics grab working fine, removed.
#uses $trips_o for the number of trips and $i as the index

#Equ grab - here is the problem, I am getting 9 extra trips here
setvar $r 0
setvar $r $trips_e
while ($r>0)
   send "q w n " $ship2 " * " $sector2 " * 1 * l 1 * * * x * " $ship2 " * * l 1 * * * w n " $ship1 " * " $sector2 " * " $sector1 " * z a 999 * f 1 * c d * l " $coloPlanet " * s * l 3 * q x " $ship1 " * *l " $coloPlanet " * s * l 3 **"
   subtract $r 1
   send "' Planet " $coloPlanet " equipment trips left: " $r "*"
end
send "*"
halt

Author:  The Bounty Hunter [ Mon Apr 09, 2012 9:28 pm ]
Post subject:  Re: 2 ship colo script problem

One thing I suggest is to build you macro in increments. This is a modified version of lonestars 2 ship mow colonizer.

while ($i <= $Trips)
setVar $trip_macro " w n " & $ship2 & "* "
setVar $trip_macro ($trip_macro & $twarp_macro)
if ($quikstats~PLANET_SCANNER = "Yes")
setVar $trip_macro ($trip_macro & " l 1* * * ")
else
setVar $trip_macro ($trip_macro & " l * * ")
end
setVar $trip_macro ($trip_macro & "x " & $ship2 & "* * ")
if ($ship2_PScan)
setVar $trip_macro ($trip_macro & " l 1* * * ")
else
setVar $trip_macro ($trip_macro & " l * * ")
end
setVar $trip_macro ($trip_macro & " w n " & $ship1 & "* ")
setVar $trip_macro ($trip_macro & $mow_from)
setVar $trip_macro ($trip_macro & " l z" & #8 & $planet & "* * J s n l " & $Product_Cat & "* j q * x " & $ship1 & "* * l z" & #8 & $planet & "* * J s n l " & $Product_carCat & "* j q ")
add $i 1
end

Author:  The Bounty Hunter [ Mon Apr 09, 2012 9:30 pm ]
Post subject:  Re: 2 ship colo script problem

The macro actually has a lot more spaces but the forum deletes them. Look in LS's pack.. It is lsect script. I don't see the error with what you posted but I am not seeing straight right now. Little tired. Will look at the source tomorrow.

If you build your macro in increments it is easier to troubleshoot.

Author:  T0yman [ Mon Apr 09, 2012 9:58 pm ]
Post subject:  Re: 2 ship colo script problem

Bounty Hunter if you use the "Code Option" it will keep all formatting, I ran into this a lot until I noticed how others were posting code. Hope this helps.

Author:  Kaus [ Sat Apr 14, 2012 10:31 am ]
Post subject:  Re: 2 ship colo script problem

Helix wrote:
This started as a simple macro to do 2 ship coloing in an unlimited. I added an edited version of one of prom's menus. The macro idea came from Xanos, and built up from there. I still plan to add a status window instead of the send "' Planet " $coloPlanet " product trips left: " index number "*" "" after each cycle. And some error checking for the variables and a navhaz check.

I am having a problem with this script. It works but in the equipment cycle, I am getting 9 extra trips and I cannot figure out why. I added the full script as an attachment.



When in doubt Echo it out.

Helix,
I took a brief look at your code it looks solid, it's actually the same across f,o,e so it's likely not coming from the mac itself but from the index. Hard to believe since its a direct result of your Echo menu. However my recommendation is to add some Echo flag's to help track down the issue.

i.e.
Echo e_trips_index
*some code you think is causing the issue*
Echo e_trips_index


I'm sure your already doing this but without running your code its really hard to diagnose what is causing you the issue. Your code looks solid but it's likely something easy. For me adding Echo flags is a best practice and I highly recommend it.

Hope that helps

Author:  Helix [ Sat Apr 14, 2012 11:25 am ]
Post subject:  Re: 2 ship colo script problem

Kaus wrote:
Helix wrote:
This started as a simple macro to do 2 ship coloing in an unlimited. I added an edited version of one of prom's menus. The macro idea came from Xanos, and built up from there. I still plan to add a status window instead of the send "' Planet " $coloPlanet " product trips left: " index number "*" "" after each cycle. And some error checking for the variables and a navhaz check.

I am having a problem with this script. It works but in the equipment cycle, I am getting 9 extra trips and I cannot figure out why. I added the full script as an attachment.



When in doubt Echo it out.

Helix,
I took a brief look at your code it looks solid, it's actually the same across f,o,e so it's likely not coming from the mac itself but from the index. Hard to believe since its a direct result of your Echo menu. However my recommendation is to add some Echo flag's to help track down the issue.

i.e.
Echo e_trips_index
*some code you think is causing the issue*
Echo e_trips_index


I'm sure your already doing this but without running your code its really hard to diagnose what is causing you the issue. Your code looks solid but it's likely something easy. For me adding Echo flags is a best practice and I highly recommend it.

Hope that helps

What I ended up doing was copying the macro from the organics drop to the equipment drop and changing the the drop category in the macro and everything is working now. I agree its something to do with the index.

H

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