OGame Automizer Development Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome on the OGame Automizer Development/Support Forum

If this is your first visit, be sure to check out the
http://ogameautomizer.com/doc/manual.html : A guide written by OA users with consultation of OA author (En)

http://ogameautomizer.com/doc/manual_de.html : A guide written by OA users with consultation of OA author (Benutzerschnittstellenhandbuch) (GE)

http://ogameautomizer.com/doc/scripting_manual.html : OA Scripting Manual (En)

Pages: 1 [2] 3 4 5

Author Topic: AllResToCoords - **Version 2.0 - Updated 2013/10/23**  (Read 22207 times)

0 Members and 1 Guest are viewing this topic.

wulf3010

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 447
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #15 on: August 14, 2013, 11:16:33 AM »

Death, u saved my day. Thanks a lot.
Now i need a loop in it. I want that this scripts checks every hour, but only between 8 and 11 and 18-22 o clock server time.

possible?
Logged

Death

  • Newbie
  • *
  • Offline Offline
  • Posts: 38
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #16 on: August 14, 2013, 06:53:22 PM »

dont know the command but im sure devil knows... :P :D

I think it should work with a simple while-function
Code: [Select]
int hours = date.getHours()

while ((hours>= 8 && hours<=11) || (hours>=18 && hours<=22)){

//>>> code <<<

TimeUnit.MINUTES.sleep(5);
int hour = date.getHours()

}
« Last Edit: August 14, 2013, 06:55:23 PM by Death »
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2,523
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #17 on: August 14, 2013, 08:24:31 PM »

Death, u saved my day. Thanks a lot.
Now i need a loop in it. I want that this scripts checks every hour, but only between 8 and 11 and 18-22 o clock server time.

possible?

Create a new script with that inside, modify the SCRIPT_NAME_IN_ANOTHER_TAB to the script you want to execute every hour between 8 and 11, and between 18 and 22:
Code: [Select]
addCronExec "0, [8:11], *, *, *", {
    startScript('SCRIPT_NAME_IN_ANOTHER_TAB')
}

addCronExec "0, [18:22], *, *, *", {
    startScript('SCRIPT_NAME_IN_ANOTHER_TAB')
}
« Last Edit: August 14, 2013, 08:26:20 PM by Devil's Hand »
Logged

ferry79

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #18 on: September 09, 2013, 09:55:16 AM »

Hy,

It is possible to make Deployment and not Transport of fleet? Is a way to set the speed?

Thank you all for help.
Logged

wulf3010

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 447
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #19 on: September 10, 2013, 04:20:27 PM »

Death, u saved my day. Thanks a lot.
Now i need a loop in it. I want that this scripts checks every hour, but only between 8 and 11 and 18-22 o clock server time.

possible?

Create a new script with that inside, modify the SCRIPT_NAME_IN_ANOTHER_TAB to the script you want to execute every hour between 8 and 11, and between 18 and 22:
Code: [Select]
addCronExec "0, [8:11], *, *, *", {
    startScript('SCRIPT_NAME_IN_ANOTHER_TAB')
}

addCronExec "0, [18:22], *, *, *", {
    startScript('SCRIPT_NAME_IN_ANOTHER_TAB')
}

btw. that doesnt work !
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2,523
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #20 on: September 10, 2013, 06:48:45 PM »

Quote
btw. that doesnt work !
Logs, screens ?
Logged

zhlo

  • Newbie
  • *
  • Offline Offline
  • Posts: 15
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #21 on: September 10, 2013, 10:52:04 PM »

my script do
updating planet1
updating planet2
.
.
.

then stops
Logged

kasp8838

  • Newbie
  • *
  • Offline Offline
  • Posts: 1
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #22 on: January 05, 2014, 12:54:44 AM »

My script just updates all the planets, and then it stops. Does this happen to anyone else?
Logged

o2o

  • Newbie
  • *
  • Offline Offline
  • Posts: 26
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #23 on: January 13, 2014, 01:29:29 PM »

My script just updates all the planets, and then it stops. Does this happen to anyone else?

Are you sending to a moon?

This happened to me when the co-ords weren't right (usually a moon is involved), try the following: Anyway if you note this section...
def targetCoords = "[2:50:10]" // Target Planet Coordinates
def targetName = "Mondschein" // Target Planet Name

Try adding the co-ords and the name to "targetcoords" for example:  "[3:400:7]Moon" and then just the name in "targetname" = "moon".

I had some trouble with that at the beginning as it wouldn't send to a moon - changing the variable above fixed it for me?
Logged

Kaelan

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #24 on: January 14, 2014, 10:58:58 PM »

Quote
int remainingDeut = 25000 // Deuterium which has to remain on Planet
int minRess = 200000 // minimum Ressources on Planet for starting a Transport
def targetCoords = "[2:472:11]Mond" // Target Planet Coordinates
def targetName = "Beta" // Target Planet Name
def moon = "Mond" // enter the String "Moon" on your OGame-language
boolean updatePlanets = true // (true) if you want to update planet before sending, or (false) not. Recommended: (true)

That my settings. I want that the ressource are sent to a moon but the script dont sent the ressources to the moon.

Why?
Logged

o2o

  • Newbie
  • *
  • Offline Offline
  • Posts: 26
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #25 on: January 15, 2014, 06:46:22 PM »

Quote
int remainingDeut = 25000 // Deuterium which has to remain on Planet
int minRess = 200000 // minimum Ressources on Planet for starting a Transport
def targetCoords = "[2:472:11]Mond" // Target Planet Coordinates
def targetName = "Beta" // Target Planet Name
def moon = "Mond" // enter the String "Moon" on your OGame-language
boolean updatePlanets = true // (true) if you want to update planet before sending, or (false) not. Recommended: (true)

That my settings. I want that the ressource are sent to a moon but the script dont sent the ressources to the moon.

Why?

The name of the moon and the co-ord section are different change it to:
int remainingDeut = 25000 // Deuterium which has to remain on Planet
int minRess = 200000 // minimum Ressources on Planet for starting a Transport
def targetCoords = "[2:472:11]Beta" // Target Planet Coordinates
def targetName = "Beta" // Target Planet Name
def moon = "Mond" // enter the String "Moon" on your OGame-language
boolean updatePlanets = true // (true) if you want to update planet before sending, or (false) not. Recommended: (true)

Logged

Kaelan

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #26 on: January 15, 2014, 08:48:48 PM »

Quote
int remainingDeut = 25000 // Deuterium which has to remain on Planet
int minRess = 200000 // minimum Ressources on Planet for starting a Transport
def targetCoords = "[2:472:11]Mond" // Target Planet Coordinates
def targetName = "Beta" // Target Planet Name
def moon = "Mond" // enter the String "Moon" on your OGame-language
boolean updatePlanets = true // (true) if you want to update planet before sending, or (false) not. Recommended: (true)

That my settings. I want that the ressource are sent to a moon but the script dont sent the ressources to the moon.

Why?

The name of the moon and the co-ord section are different change it to:
int remainingDeut = 25000 // Deuterium which has to remain on Planet
int minRess = 200000 // minimum Ressources on Planet for starting a Transport
def targetCoords = "[2:472:11]Beta" // Target Planet Coordinates
def targetName = "Beta" // Target Planet Name
def moon = "Mond" // enter the String "Moon" on your OGame-language
boolean updatePlanets = true // (true) if you want to update planet before sending, or (false) not. Recommended: (true)


Thanks but it doenst work :-(

Quote
//Config
int remainingDeut = 25000 // Deuterium which has to remain on Planet
int minRess = 200000 // minimum Ressources on Planet for starting a Transport
def targetCoords = "[2:472:11]Beta" // Target Planet Coordinates
def targetName = "Beta" // Target Planet Name
def moon = "Mond" // enter the String "Moon" on your OGame-language
boolean updatePlanets = true // (true) if you want to update planet before sending, or (false) not. Recommended: (true)


printOut "AllResToCoords v1.1 started!"

//Code (do not enter this area)

def message=[]
def resourse=[]
int i=0
int r=0
Iterator<Planet> iter = getPlanets().iterator()
  while(iter.hasNext())
  {
    Planet p = iter.next();

   if(updatePlanets)
   {
  printOut "[Updating Planet "+p.coordinates
  updatePlanetCoord(p.coordinates)
    }

   if(p.coordinates.toString() != targetCoords && p.name != targetName && p.coordinates.toString().contains(moon))
   {
    def met = p.getMetal()
  def kris = p.getCrystal()
  def deut = (p.getDeuterium()-remainingDeut)
  int res = (met+kris+deut)
  int capOfSmall = 5000*getNumberOf(SMALLCARGO, p.coordinates)
  int capOfLarge = 25000*getNumberOf(LARGECARGO, p.coordinates)

if ((kris+met+deut-remainingDeut) < minRess){
    printOut "Avaiblable Ressources on planet" +p.name+ " are less than "+ minRess}

else {
 
       
       
if((capOfLarge+capOfSmall)<=res){

message="\nYou dont have enough of cargo ships on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="Thease resourse weren't transported "+met+" met "+kris+" deut "+deut
i++
r++

}

else if(capOfLarge>res){
int lcs = Math.ceil(res/25000)
int consumption = getTripConsumption( p.coordinates, targetCoords, 100, [LARGECARGO : lcs])
if(consumption<deut){
   printOut "[Sending Cargos's with: "+met+" Met, "+kris+" Kris and "+deut+" Deut from "+p.name+" to "+targetName+"."
 sendFleetWithResources (p.name,targetCoords,FleetMission.TRANSPORT_MISSION,100,met,kris,deut,[LARGECARGO : lcs])
     printOut " DONE Sending transport from "+p.name}else {
message="\nYou dont have enough of deut for trip on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="Thease resourse weren't transported "+met+" met "+kris+" deut "+deut
r++
i++
}
   
 }
else    {

    int lcs = getNumberOf(LARGECARGO, p.coordinates)
    int restres=res-capOfLarge
    int scs =Math.ceil(restres/5000)
int consumption = getTripConsumption( p.coordinates, targetCoords, 100, [SMALLCARGO : scs])
if(consumption<deut){
printOut "[Sending Cargos's with: "+met+" Met, "+kris+" Kris and "+deut+" Deut from "+p.name+" to "+targetName+"."
 sendFleetWithResources (p.name,targetCoords,FleetMission.TRANSPORT_MISSION,100,met,kris,deut,[LARGECARGO : lcs,SMALLCARGO : scs])
     printOut " DONE Sending transport from "+p.name}else {

message="\nYou dont have enough of deut for trip on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="Thease resourse weren't transported "+met+" met "+kris+" deut "+deut
r++
i++
}
}
    }

 


}
  }
for(x=0; x < i;x++){
printOut message

printOut resourse


}

Logged

o2o

  • Newbie
  • *
  • Offline Offline
  • Posts: 26
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #27 on: January 15, 2014, 11:01:17 PM »

Try my script - it is very very similar, based upon the original in this thread (all credit to him) - only slight amendments/tinkering for me and it doesn't include every feature (no minimum resources etc)

Code: [Select]
// ---------------------------------------------------------------------------------------------------------------------
// Author - originally Anonymous19
// Date   - Nov 13
// Script - Collect_Res
// Purpose- Collects res from all planets/moons and sends to target location
// ---------------------------------------------------------------------------------------------------------------------
// Set up configuration
// ---------------------------------------------------------------------------------------------------------------------
int remainingDeut = 0 // How much duet do we leave on the planet/moon?
def targetCoords = "[X:XXX:X]Moon Name" // Target Moon/Planet co-ordinates (for planets use [X.XXX.X] for moons use [X.XXX.X]moon name
def targetName ="Moon Name" // Target Planet/moon Name
boolean updatePlanets = true // Do we update the planets/moons before sending - recommended true as it updates resource count
// ---------------------------------------------------------------------------------------------------------------------
// begin script
// ---------------------------------------------------------------------------------------------------------------------
printOut "================================================================================================================"
printOut " Script -  Collect_Res started"
printOut "================================================================================================================"
printOut " Target Co-ordinate: "+targetCoords
printOut " Target Name: "+targetName
printOut "================================================================================================================"

// ---------------------------------------------------------------------------------------------------------------------
// main script
// ---------------------------------------------------------------------------------------------------------------------
def message=[]
def resourse=[]
int i=0
int r=0

// Update the planets
Iterator<Planet> iter = getPlanets().iterator()
  while(iter.hasNext()){
   Planet p = iter.next();
   if(updatePlanets){
  printOut "*****Updating Planet "+p.coordinates
  updatePlanetCoord(p.coordinates)
    }
}
printOut "================================================================================================================"

// begin transportation
Iterator<Planet> iter8 = getPlanets().iterator()
  while(iter8.hasNext()){
Planet p = iter8.next();
   if(p.coordinates.toString() != targetCoords && p.name != targetName){
  def met = p.getMetal()
  def crys = p.getCrystal()
  def deut = (p.getDeuterium()-remainingDeut)
  int res = (met+crys+deut)
  int capOfSmall = 5000*getNumberOf(SMALLCARGO, p.coordinates)
int capOfLarge = 25000*getNumberOf(LARGECARGO, p.coordinates)
if((capOfLarge+capOfSmall)<=res){
message[i]="\nYou dont have enough of cargo ships on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="Thease resourse weren't transported "+met+" met "+crys+" deut "+deut
i++
r++
}
   else if(capOfLarge>res){
int lcs = Math.ceil(res/25000)
int consumption = getTripConsumption( p.coordinates, targetCoords, 100, [LARGECARGO : lcs])
if(consumption<deut){
    printOut "Sending Cargos's with: "+met+" Met, "+crys+" Kris and "+deut+" Deut from "+p.name+" to "+targetName+"."
sendFleetWithResources (p.name,targetCoords,FleetMission.TRANSPORT_MISSION,100,met,crys,deut,[LARGECARGO : lcs])
    printOut "Fleet sent from: "+p.name
printOut "================================================================================================================"
}
else {
message[i]="\nYou dont have enough of deut for trip on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="NO RESOURCES WERE TRANSPORTED FROM THIS LOCATION"
r++
i++
}
   
  }
  else{
int lcs = getNumberOf(LARGECARGO, p.coordinates)
int restres=res-capOfLarge
int scs =Math.ceil(restres/5000)
int consumption = getTripConsumption( p.coordinates, targetCoords, 100, [SMALLCARGO : scs])
if(consumption<deut){
printOut "[Sending Cargos's with: "+met+" Met, "+crys+" Kris and "+deut+" Deut from "+p.name+" to "+targetName+"."
  sendFleetWithResources (p.name,targetCoords,FleetMission.TRANSPORT_MISSION,100,met,crys,deut,[LARGECARGO : lcs,SMALLCARGO : scs])
    printOut "Fleet sent from: "+p.name
}
else{
printOut "================================================================================================================"
message[i]="\nYou dont have enough of deut for trip on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="NO RESOURCES WERE TRANSPORTED FROM THIS LOCATION"
i++
}
  }
 }
}
for(x=0; x < i;x++){
printOut message[x]
printOut resourse[x]
}




I include a lot more comments and echoes as I used this to figure out how it all works...the output in the script screen should be a bit more detailed but if it does run and still doesn't work could you copy and paste the log from the script screen and the overview log - it should state why it hasn't sent the fleet...if it sends it to another co-ordinate then it will log it as successful..copy it either way.
« Last Edit: January 15, 2014, 11:05:42 PM by o2o »
Logged

Kaelan

  • Newbie
  • *
  • Offline Offline
  • Posts: 8
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #28 on: January 15, 2014, 11:13:14 PM »

Try my script - it is very very similar, based upon the original in this thread (all credit to him) - only slight amendments/tinkering for me and it doesn't include every feature (no minimum resources etc)

Code: [Select]
// ---------------------------------------------------------------------------------------------------------------------
// Author - originally Anonymous19
// Date   - Nov 13
// Script - Collect_Res
// Purpose- Collects res from all planets/moons and sends to target location
// ---------------------------------------------------------------------------------------------------------------------
// Set up configuration
// ---------------------------------------------------------------------------------------------------------------------
int remainingDeut = 0 // How much duet do we leave on the planet/moon?
def targetCoords = "[X:XXX:X]Moon Name" // Target Moon/Planet co-ordinates (for planets use [X.XXX.X] for moons use [X.XXX.X]moon name
def targetName ="Moon Name" // Target Planet/moon Name
boolean updatePlanets = true // Do we update the planets/moons before sending - recommended true as it updates resource count
// ---------------------------------------------------------------------------------------------------------------------
// begin script
// ---------------------------------------------------------------------------------------------------------------------
printOut "================================================================================================================"
printOut " Script -  Collect_Res started"
printOut "================================================================================================================"
printOut " Target Co-ordinate: "+targetCoords
printOut " Target Name: "+targetName
printOut "================================================================================================================"

// ---------------------------------------------------------------------------------------------------------------------
// main script
// ---------------------------------------------------------------------------------------------------------------------
def message=[]
def resourse=[]
int i=0
int r=0

// Update the planets
Iterator<Planet> iter = getPlanets().iterator()
  while(iter.hasNext()){
   Planet p = iter.next();
   if(updatePlanets){
  printOut "*****Updating Planet "+p.coordinates
  updatePlanetCoord(p.coordinates)
    }
}
printOut "================================================================================================================"

// begin transportation
Iterator<Planet> iter8 = getPlanets().iterator()
  while(iter8.hasNext()){
Planet p = iter8.next();
   if(p.coordinates.toString() != targetCoords && p.name != targetName){
  def met = p.getMetal()
  def crys = p.getCrystal()
  def deut = (p.getDeuterium()-remainingDeut)
  int res = (met+crys+deut)
  int capOfSmall = 5000*getNumberOf(SMALLCARGO, p.coordinates)
int capOfLarge = 25000*getNumberOf(LARGECARGO, p.coordinates)
if((capOfLarge+capOfSmall)<=res){
message[i]="\nYou dont have enough of cargo ships on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="Thease resourse weren't transported "+met+" met "+crys+" deut "+deut
i++
r++
}
   else if(capOfLarge>res){
int lcs = Math.ceil(res/25000)
int consumption = getTripConsumption( p.coordinates, targetCoords, 100, [LARGECARGO : lcs])
if(consumption<deut){
    printOut "Sending Cargos's with: "+met+" Met, "+crys+" Kris and "+deut+" Deut from "+p.name+" to "+targetName+"."
sendFleetWithResources (p.name,targetCoords,FleetMission.TRANSPORT_MISSION,100,met,crys,deut,[LARGECARGO : lcs])
    printOut "Fleet sent from: "+p.name
printOut "================================================================================================================"
}
else {
message[i]="\nYou dont have enough of deut for trip on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="NO RESOURCES WERE TRANSPORTED FROM THIS LOCATION"
r++
i++
}
   
  }
  else{
int lcs = getNumberOf(LARGECARGO, p.coordinates)
int restres=res-capOfLarge
int scs =Math.ceil(restres/5000)
int consumption = getTripConsumption( p.coordinates, targetCoords, 100, [SMALLCARGO : scs])
if(consumption<deut){
printOut "[Sending Cargos's with: "+met+" Met, "+crys+" Kris and "+deut+" Deut from "+p.name+" to "+targetName+"."
  sendFleetWithResources (p.name,targetCoords,FleetMission.TRANSPORT_MISSION,100,met,crys,deut,[LARGECARGO : lcs,SMALLCARGO : scs])
    printOut "Fleet sent from: "+p.name
}
else{
printOut "================================================================================================================"
message[i]="\nYou dont have enough of deut for trip on planet named >> "+p.name+" << on cordinates "+p.coordinates
resourse[r]="NO RESOURCES WERE TRANSPORTED FROM THIS LOCATION"
i++
}
  }
 }
}
for(x=0; x < i;x++){
printOut message[x]
printOut resourse[x]
}




I include a lot more comments and echoes as I used this to figure out how it all works...the output in the script screen should be a bit more detailed but if it does run and still doesn't work could you copy and paste the log from the script screen and the overview log - it should state why it hasn't sent the fleet...if it sends it to another co-ordinate then it will log it as successful..copy it either way.

Sorry but it doent work :-(

Quote
23:06:51 : ================================================================================================================
23:06:51 :  Script -  Collect_Res started
23:06:51 : ================================================================================================================
23:06:51 :  Target Co-ordinate: [2:472:11]Beta
23:06:51 :  Target Name: Beta
23:06:51 : ================================================================================================================
23:06:51 : *****Updating Planet ***
23:07:48 : *****Updating Planet *** Mond
23:07:59 : *****Updating Planet ***
23:08:15 : *****Updating Planet *** Mond
23:08:20 : *****Updating Planet ***
23:08:37 : *****Updating Planet *** Mond
23:08:48 : *****Updating Planet ***
23:08:57 : *****Updating Planet ***
23:09:02 : *****Updating Planet ***
23:09:07 : *****Updating Planet ***
23:09:26 : *****Updating Planet ***
23:09:43 : *****Updating Planet *** Mond
23:09:57 : *****Updating Planet ***
23:10:04 : ================================================================================================================
23:10:04 : Sending Cargos's with: 5495197 Met, 796515 Kris and 1033686 Deut from Alpha to Beta.
23:10:28 : Fleet sent from: Alpha
23:10:28 : ================================================================================================================
23:10:28 : Sending Cargos's with: 7356444 Met, 1252532 Kris and 1655517 Deut from Delta to Beta.
« Last Edit: January 15, 2014, 11:15:26 PM by Kaelan »
Logged

o2o

  • Newbie
  • *
  • Offline Offline
  • Posts: 26
    • View Profile
Re: AllResToCoords - Version 1.1
« Reply #29 on: January 16, 2014, 09:18:25 AM »

Is there anything in the overview log?  This can also be found in the <installation directory>/logs/****.overview.log

I am afraid I am struggling now - that script works fine for my moons.  I don't know a whole lot about the API yet but I would make sure you are completely up-to-date with ogame automiser and does it continue to just send the fleet to the planet (not the moon)?

One more thing to note - to send to a planet, you only need the co-ords in the targetCoords variable.  Only add the name if sending to a moon...I have just tested again and it works fine for me.  I recommend updating to see if that helps, maybe you need a new version of the ogameautomiser.jar file which contains the API I think.

Edit - as mentioned above the overview log may contain something extra - for example when a fleet is sent it will state where too and how many cargos - i assume this is fine for you but just the planet?
« Last Edit: January 16, 2014, 09:23:31 AM by o2o »
Logged
Pages: 1 [2] 3 4 5
 

Page created in 0.065 seconds with 20 queries.