<< Previous Topic | Next Topic >>Return to Index  

Get an Improved Pair Trade script here:

April 27 2001 at 12:23 PM
 

 
All,
I modifed Earth's trade.zrx script to be a little easier to use, and continue on "We're not interested"
It has a few random querks, but it works very well 95% of the time.
Cut and paste the following into a new text file and save it as [filename].zrx

-------------------------BEGIN CUT HERE---------------
/* REXX Script written by Nate Yaconis*/
/* HAGGLE and GETINFO Procedures modified from trade.zrx provided by Earth */
/*
This script does Paired Port trading and continues on "We're not INterested" so
that you don't have to keep running the script.

INSTRUCTIONS:
-Move to the first sector you are going to start trading in.
-Start the user script pairtrade.zrx
-If you have products in your holds, you will be asked to dump them, if you answer NO
Make sure you hit escape before doing anything else to make sure the script is stopped
If you answer yes, you holds will be dumped and you can continue.
-You will then be asked what you will be buying in the Current sector.
-You will then be asked what you are buying in the Next sector.
-Then you will be asked where the next sector is.
After you click "OK" the magic starts.
Watch as you trade away
-WHEN THE SCRIPT ENDS ON "You don't have anything they want, and they don't have..."
Make sure to hit escape to cancel the script.

Report any bugs to: nyaconis8@aol.com
*/


call zocsend "d"
call zocwait "]:["
sector = GETINFO(0,0)

call zocwait "? :"
call zocsend "i"

/* Check holds to make sure they are empty, if not, ask if you want them jetisoned */

holdRes = ZocWaitMux("Equipment", "Fuel Ore", "Organics","Empty")
SELECT
WHEN holdRes = 0 THEN holdRes = -1
WHEN holdRes = 1 THEN holdRes = -1
WHEN holdRes = 2 THEN holdRes = -1
WHEN holdRes = 3 THEN holdRes = 1
END

IF holdRes = -1 THEN DO

result = ZocRequest("You must begin with all holds Empty. Clear Holds?", "Yes", "No")

IF result = "Yes" THEN DO
call zocsend "jy"
END
ELSE DO
SIGNAL get_out
END
END

/*Get user input*/

firstBuy = ZocRequest("What are you buying in this sector?", "FUEL ", "ORGANICS ", "EQUIPMENT ")
secondBuy = ZOcRequest("What are you buying in the other sector?", "FUEL ", "ORGANICS ", "EQUIPMENT ")
sector2 = ZocAsk("What is the next Sector?")

/*Fill initial holds*/

CALL ZocSend "p"
CALL ZocWait "?"
CALL ZocSend "t"

CALL prodCHECK(firstBuy)

CALL ZocWait "our offer ["
offer2 = GETINFO(0,0)
z=BUYHAGGLE(offer2, firstBuy)
IF z = -1 THEN DO
SIGNAL get_out
END

CALL ZocWait "Command"
CALL ZocSend sector2
CALL ZocSend "^M"

DO 10000

CALL ZocSend "p"
CALL ZocWait " ? "
CALL ZocSend "t"
CALL ZocSend "^M"
call zocwait "our offer ["
offer1=GETINFO(0,0)

z=SELLHAGGLE(offer1)
IF z = -1 THEN DO
SIGNAL get_out
END

CALL prodCHECK(secondBuy)

call zocwait "our offer ["
offer2=GETINFO(0,0)
z=BUYHAGGLE(offer2, secondBuy)
IF z = -1 THEN DO
SIGNAL get_out
END

call zocwait "Command"
call zocsend sector
call zocsend "^M"
call zocwait "Command"


CALL ZocSend "pt"
CALL ZocSend "^M"
call zocwait "our offer ["
offer1=GETINFO(0,0)
z=SELLHAGGLE(offer1)
IF z = -1 THEN DO
SIGNAL get_out
END

CALL prodCHECK(firstBuy)

call zocwait "our offer ["
offer2=GETINFO(0,0)
z=BUYHAGGLE(offer2, firstBuy)
IF z = -1 THEN DO
SIGNAL get_out
END

call zocwait "Command"
call zocsend sector2
call zocsend "^M"
call zocwait "Command"


END

exit


/*FUNCTIONS*/

get_out:
EXIT

GETINFO:
rinfo = ""
call zocwait "]"
temp = ZocLastLine()
DO addchar=1 to length(temp)
temp2 = substr(temp,addchar,1)
if temp2<>"]" then DO
if temp2<>"," then rinfo=rinfo||temp2
END
END
RETURN rinfo

prodCHECK:
buyType = arg(1)
buyFlag = -1
DO WHILE buyFlag <> 0
CALL ZocWait "holds of "
tradeType = GETTYPE(0,0)
CALL ZocWait "]?"
IF tradeType = buyType THEN DO
CALL ZocSend "^M"
buyFlag = 0
END
ELSE DO
CALL ZocSend "0^M"
END
END
RETURN

GETTYPE:
temp = ""
call zocwait " "
temp = ZocLastLine()
RETURN temp


BUYHAGGLE:

buyType=arg(2)
offer1=arg(1)
haggle106=offer2*94/100-1
haggle106=trunc(haggle106,0)
haggle105=offer2*95/100-1
haggle105=trunc(haggle105,0)
haggle104=offer2*96/100-1
haggle104=trunc(haggle104,0)
haggle103=offer2*97/100-1
haggle103=trunc(haggle103,0)
haggle102=offer2*98/100-1
haggle102=trunc(haggle102,0)
haggle101=offer2*99/100-1
haggle101=trunc(haggle101,0)

call zocsend haggle105
call zocsend "^M"

a=3
DO WHILE a<>0
result= ZocWaitMux("You have", "Your offer [", "We're not int", "You don't" )
SELECT
WHEN result=0 THEN x=2
WHEN result=1 THEN x=1
WHEN result=2 THEN x=3
WHEN result=3 THEN x=4
end

if x=1 then DO
if a=4 then do
call zocsend haggle105
call zocsend "^M"
end
if a=3 then do
call zocsend haggle104
call zocsend "^M"
end
if a=2 then do
call zocsend haggle103
call zocsend "^M"
end
if a=1 then do
call zocsend haggle102
call zocsend "^M"
end
if a=0 then do
call zocsend haggle101
call zocsend "^M"
end
a=a-1
end

if x=2 then do
a=0
return(0)
end
if x=3 then do
CALL ZocSend "p"
CALL ZocWait "?"
CALL ZocSend "t"

CALL prodCHECK(buyType)
call zocsend "^M"
RETURN(0)
dead=1

end
IF x=4 THEN DO
SIGNAL get_out
a=0
return(-1)
END

END

RETURN(0)

SELLHAGGLE:

offer1=arg(1)
haggle106=offer1%(94/100)-1
haggle106=trunc(haggle106,0)
haggle105=offer1%(95/100)-1
haggle105=trunc(haggle105,0)
haggle104=offer1%(96/100)-1
haggle104=trunc(haggle104,0)
haggle103=offer1%(97/100)-1
haggle103=trunc(haggle103,0)
haggle102=offer1%(98/100)-1
haggle102=trunc(haggle102,0)
haggle101=offer1%(99/100)-1
haggle101=trunc(haggle101,0)

call zocsend haggle105
call zocsend "^M"

a=3
DO WHILE a<>0
result= ZocWaitMux("You have", "Your offer [", "We're not int", "You don't")
SELECT
WHEN result=0 THEN x=2
WHEN result=1 THEN x=1
WHEN result=2 THEN x=3
end

if x=1 then DO
if a=4 then do
call zocsend haggle105
call zocsend "^M"
end
if a=3 then do
call zocsend haggle104
call zocsend "^M"
end
if a=2 then do
call zocsend haggle103
call zocsend "^M"
end
if a=1 then do
call zocsend haggle102
call zocsend "^M"
end
if a=0 then do
call zocsend haggle101
call zocsend "^M"
end
a=a-1
end

if x=2 then do
a=0
return(0)
end
if x=3 then do
CALL ZocSend "p"
CALL ZocWait "?"
CALL ZocSend "t"
call zocsend "^M"
dead=1
return(0)
end
IF x=4 THEN DO

a=0
SIGNAL get_out
return(-1)
END

END

RETURN(0)

---------------------------END CUT------------------

 
 Respond to this message   
AuthorReply

PP

April 27 2001, 4:01 PM 

nice.
earth.

 
 Respond to this message   
Current Topic - Get an Improved Pair Trade script here:
  << Previous Topic | Next Topic >>Return to Index  
Find more forums on Tradewars 2002Create your own forum at Network54
 Copyright © 1999-2009 Network54. All rights reserved.   Terms of Use   Privacy Statement