Jetcan Hauler Transfer

GliderPro

Active Member
Here is my first ever Lavishscript release ;) It goes with Teht's Jetcan miner script. All this one does is move ore from a jetcan into your ship. It takes over an hour to fill up my hauler so I just let this run and manually dock/unload once an hour. One thing that I should add is a check to verify the owner of the can you are stealing from. It would be bad to steal from an unfriendly ;)

Code:
function main()
{
	variable string ContainerName = "MY ORE"
	variable index:item ContainerCargo
	variable int ContainerCargoCount
	variable int i = 1
	variable bool ContainerOpen
	variable bool EndScript
	
	ContainerOpen:Set[FALSE]
	EndScript:Set[FALSE]
	
	do
	{	
		; Make sure that there is actually a cargo container there that matches the name we set
		if !${Entity[${ContainerName}](exists)}
		{
			echo No Entities in the area that match the name you provided.
			wait 100
		}
		
		; If it exists, get close enough to it!
		if (${Entity[${ContainerName}].Distance} > 1300)
		{
			Entity[${ContainerName}]:Approach
			do
			{
				wait 20
			}
			while ${Entity[${ContainerName}].Distance} > 1300
		}
		
		if !${ContainerOpen}
		{
			if ${Entity[${ContainerName}](exists)}
			{
				Entity[${ContainerName}]:OpenCargo
				ContainerOpen:Set[TRUE]
				wait 30
			}
		}
		
		ContainerCargoCount:Set[${Entity[${ContainerName}].GetCargo[ContainerCargo]}]
		
		do
		{
			ContainerCargo.Get[${i}]:MoveTo[MyShip]
			wait 15
		}
		while ${i:Inc} <= ${ContainerCargoCount}
		
		; After everything is looted...let's clean up our Cargo
		Me.Ship:StackAllCargo
	
		if ${ContainerOpen}
		{
			if ${Entity[${ContainerName}](exists)}
			{
				Entity[${ContainerName}]:CloseCargo
				wait 30
			}
			ContainerOpen:Set[FALSE]
		}
		
		; wait ten minutes
		echo waiting for ten minutes
		wait 6000
	}
	while !${EndScript}
	
	echo Script Ended
}
 
Top Bottom