/* REXX _portore */ /* By Francis */ call zocsynctime 250 CALL ZOCSEND "P" ANS=zocwaitmux("[T]","There is no port") SELECT when ANS=0 THEN DO CALL ZOCSEND "t" if ZOCWAITmUX("Docking.","You don't have any")=2 then EXIT END /*do*/ when ANS=1 then EXIT end /*select*/ call zocwait "of max OnBoard" do forever ANS=zocwaitmux("We are buy","We are sel","Command","You don't have any","Shutdown Autopilot") select when ANS=0 then do call zocwait "]?" call zocsend "^M" call haggle 1 end /*do*/ when ANS=1 then do t2=zocwaitmux("Fuel Ore","Organics","Equipment") t2=t2+1 if t2=1 then do call zocwait "]?" call zocsend "^M" call haggle -1 end /*do*/ else do call zocsend "0^M" end end /*do*/ OTHERWISE leave end /*select*/ end /*do*/ getnum: final=arg(1) call zocwait final line=zoclastline() numb="" do i=1 to length(line) char=substr(line,i,1) if pos(char,"-0123456789") > 0 then numb=numb||char end /*do*/ return numb haggle: q1=arg(1) temp=0 call zocwait "offer [" num1=getnum("]") if num1 < 25000 then do g1=q1*(num1*85%1000)+num1 end else do g1=q1*(num1*20%1000)+num1 end call zocwait "? " call zocsend g1||"^M" DO forever ans=zocwaitmux("final ","empty cargo","We'll buy them for","We'll sell them for") SELECT WHEN ans=0 then do temp=num1 call zocwait "offer [" num1=getnum("]") g1=num1-(temp-g1)+((temp-num1)*35%10)-(q1*4) end WHEN ans=1 then leave OTHERWISE do temp=num1 call zocwait "offer [" num1=getnum("]") g1=g1+((temp-num1)*2)-q1 end end call zocwait "? " call zocsend g1||"^M" end /*do*/ return