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

Author Topic: ExpoScript: Expedition *Update 02.04*  (Read 23050 times)

0 Members and 1 Guest are viewing this topic.

anonymous19

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
    • View Profile
ExpoScript: Expedition *Update 02.04*
« on: March 13, 2012, 08:48:30 PM »



Hello guys, i played a little bit with the new scripting engine, and this script is my result: ExpoScript

It simply checks whether you have a free Expedition- & Fleetslot. If you have both, he rans through all your planets and checks where you have the needed fleet to send to the expo (config). When he finds the fleet on the planet, he starts the expedition with the specified fleet (config).

The check occurs all xx seconds, like you have chosen in the script's config. So when you activate "Execute after OA Execution" it will send anytime if it is possible expeditions :-)

Scroll down to the newest Version.

Newest Version: ExpoScript v1.3 http://forum.ogameautomizer.com/index.php/topic,1728.msg6591.html#msg6591

Have fun at trying.

wulf3010

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 447
    • View Profile
Re: ExpoScript: Expedition
« Reply #1 on: March 13, 2012, 09:21:18 PM »

Oh men you awesome ;-) Finally someone arrived who has more clou about scripting as anyone else besides Devil

yes i have massive amount of scripting needs ;-)
To might start with an easy one.
http://forum.ogameautomizer.com/index.php/topic,1726.0.html

and really good job, that helps specially that it looks on every planet. Is it possible to make a check that there is at least xxx amounts of big or small transporters left ?

So what i am tying to say is:
check if lc = 200 for expo + 200 for saving ressources, otherwise it can be stolen
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2,523
    • View Profile
Re: ExpoScript: Expedition
« Reply #2 on: March 13, 2012, 09:47:00 PM »

@anonymous19:
Well done ;)

Code: [Select]
def plani = p.coordinates.toString()
def pos = (plani.lastIndexOf(":"))+1
def pstring = p.coordinates.toString().substring(0,pos)
...
pstring+"16]"
you can replace pstring calculation by the following code:
Code: [Select]
p.coordinates.galaxy+":"+p.coordinates.system+":16"
Regards,
« Last Edit: March 13, 2012, 09:49:33 PM by Devil's Hand »
Logged

anonymous19

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
    • View Profile
Re: ExpoScript: Expedition
« Reply #3 on: March 13, 2012, 10:35:25 PM »

Update Version 1.1:

* Added Devils tip for shorter source code & deleted some useless stuff
* Added wulf3010's Feature Request: Now you can choose how much large cargos have to be additionaly be on planet for saving reasons
* Expo Script does work with Large Cargos only!! Maybe more ship types will be supported when Devil helps me xD

Code: [Select]
//Config
def sleepTime=2000 //in seconds * 1000
def expofleet=200 //amount of large cargos for the expo
def savefleet=150 //amount of large cargos which have to be left on planet for saving reasons

printOut "ExpoScript v1.1 | started"

while(true)
{
if(hasAvailableFleetSlot() && hasAvailableExpeditionFleetSlot())
{
  Iterator<Planet> iter = getPlanets().iterator()
  while(iter.hasNext())
  {
    Planet p = iter.next();
    if(getNumberOf('LARGECARGO', p.coordinates) >= (expofleet+savefleet))
    {
     printOut "trying to send from "+p.name
     printOut "koords: "+p.coordinates
 
     def sent = sendFleet(
         p.name,
          p.coordinates.galaxy+":"+p.coordinates.system+":16",
          FleetMission.EXPEDITION_MISSION,
          100,
      [LARGECARGO : expofleet]
      );
     
    if(sent)
    {
      printOut "Fleet sent !"
      break
    }
     else
    {
      printOut "Fleet sent failed !"
    }
     }
  }
}
sleep sleepTime
}

Ablesegenauigkeit

  • Jr. Member
  • **
  • Offline Offline
  • Posts: 75
    • View Profile
Re: ExpoScript: Expedition
« Reply #4 on: March 13, 2012, 10:38:17 PM »

Congratz + WELL DONE!!!

I DO LIKE what is going on around here. Hoping for more excellent scripts :)

Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2,523
    • View Profile
Re: ExpoScript: Expedition
« Reply #5 on: March 13, 2012, 11:20:37 PM »

Quote
Expo Script does work with Large Cargos only!! Maybe more ship types will be supported when Devil helps me xD
the 'Fleet Sending' script shows how to set several ship types:
Code: [Select]
...
[SMALLCARGO : 1, ESPIONAGEPROBE : 1]  //SMALLCARGO, LARGECARGO, LIGHTFIGHTER, HEAVYFIGHTER, CRUISER, BATTLESHIP, COLONYSHIP, RECYCLER, ESPIONAGEPROBE, BOMBER, DESTROYER, DEATHSTAR, BATTLECRUISER
...

So you can make something like:
Quote
def expofleetLC=200
def expofleetSC=0
...
[SMALLCARGO : expofleetSC, LARGECARGO : expofleetLC]

or directly by proposing a fleet composition:
Code: [Select]
def expofleet =
[
  SMALLCARGO : 0,
  LARGECARGO : 200,
  LIGHTFIGHTER : 0,
  HEAVYFIGHTER : 0
  ...
]

Regards,
Logged

anonymous19

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
    • View Profile
Re: ExpoScript: Expedition
« Reply #6 on: March 13, 2012, 11:25:04 PM »

Thanks for the reply,
this is not my problem with sending!

My problem is checking all ship types

Code: [Select]
if(getNumberOf('LARGECARGO', p.coordinates)
...

I dont know how to access all the elements of expofleet when it is directly composed like you said.

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2,523
    • View Profile
Re: ExpoScript: Expedition
« Reply #7 on: March 13, 2012, 11:37:18 PM »

I dont know how to access all the elements of expofleet when it is directly composed like you said.

Here the way to iter over:
Code: [Select]
def expofleet =
[
  SMALLCARGO : 0,
  LARGECARGO : 200,
  LIGHTFIGHTER : 0,
  HEAVYFIGHTER : 0
]

def iter = expofleet.keySet().iterator()
while(iter.hasNext()) {
  String key = iter.next()
  printOut key + ": " + expofleet.get(key)
}

Regards,
Logged

anonymous19

  • Newbie
  • *
  • Offline Offline
  • Posts: 24
    • View Profile
Re: ExpoScript: Expedition
« Reply #8 on: March 14, 2012, 12:33:18 AM »

Update: ExpoScript v.1.2
* You can now choose your own Expo Fleet (check expofleet in config)
* You can now choose your own Save Fleet (check savefleet in config)
* Logfile Output: All actions done by the Script, will be written in the logfile (config: logFile)

Code: [Select]
//Config
def logFile = "expolog.txt"
def sleepTime=2000 //in seconds * 1000
def expofleet = //your expo fleet
[
  SMALLCARGO : 0,
  LARGECARGO : 200,
  HEAVYFIGHTER : 0,
  DESTROYER : 0,
  ESPIONAGEPROBE : 0,

  LIGHTFIGHTER : 0,
  BOMBER : 0,

  CRUISER : 0,
  BATTLECRUISER : 0,
  BATTLESHIP : 0,

  COLONYSHIP : 0,
  RECYCLER : 0,
  DEATHSTAR : 0
]
def savefleet = //your fleet which have to be left on planet for saving reasons
[
  SMALLCARGO : 0,
  LARGECARGO : 215,
  HEAVYFIGHTER : 0,
  DESTROYER : 0,
  ESPIONAGEPROBE : 0,

  LIGHTFIGHTER : 0,
  BOMBER : 0,

  CRUISER : 0,
  BATTLECRUISER : 0,
  BATTLESHIP : 0,

  COLONYSHIP : 0,
  RECYCLER : 0,
  DEATHSTAR : 0
]

printOut "ExpoScript v1.2 started"
appendToFile logFile, Time.getTime()+" | "+"ExpoScript v1.2 | started"+" \r\n"

while(true)
{
if(hasAvailableFleetSlot() && hasAvailableExpeditionFleetSlot())
{
  Iterator<Planet> iter = getPlanets().iterator()
  while(iter.hasNext())
  {
    Planet p = iter.next();

    def iter_f = expofleet.keySet().iterator()
    def okay=true
    while(iter_f.hasNext())
    {
      String key = iter_f.next()
      if(getNumberOf(key, p.coordinates) < (expofleet.get(key)+savefleet.get(key)))
      {
    okay=false
    break
      }
     }
   
    if(okay)
    {
     printOut "trying to send from "+p.name
     appendToFile logFile, Time.getTime()+" | "+"trying to send from "+p.name+" \r\n"
     printOut "koords: "+p.coordinates
     appendToFile logFile, Time.getTime()+" | "+"koords: "+p.coordinates+" \r\n"
 
     def sent = sendFleet(
         p.name,
          p.coordinates.galaxy+":"+p.coordinates.system+":16",
          FleetMission.EXPEDITION_MISSION,
          100,
          expofleet
      );
     
    if(sent)
    {
      printOut "Fleet sent !"
      appendToFile logFile, Time.getTime()+" | "+"Fleet sent !"+" \r\n"
      break
    }
     else
    {
      printOut "Fleet sent failed !"
      appendToFile logFile, Time.getTime()+" | "+"Fleet sent failed !"+" \r\n"
    }
   }
  }
}
sleep sleepTime
}

Dievas

  • Newbie
  • *
  • Offline Offline
  • Posts: 5
    • View Profile
Re: ExpoScript: Expedition
« Reply #9 on: March 16, 2012, 08:05:45 AM »

Nice one , thanks :)
Logged

zaltan

  • Newbie
  • *
  • Offline Offline
  • Posts: 17
    • View Profile
Re: ExpoScript: Expedition
« Reply #10 on: March 19, 2012, 03:06:27 PM »

I've been testing the script since you made it and it works pretty good man!! the only mistake that I've seen is the fact that expedition are always in the same Coord and after some days most of the expeditions bring nothing (if a 16 position is used a lot it will give less rewards), to solve it I've done another script just the same but with different coords. and I use 1 of the some days and the other one some other days so i think it would be interesting to make a ramdom coords between a range, for example range 5, it'll send expedition to systems  near your planet 5 systems more or 5 less.

Sorry my english ._.
Logged

Jentec

  • Full Member
  • ***
  • Offline Offline
  • Posts: 168
    • View Profile
Re: ExpoScript: Expedition
« Reply #11 on: March 21, 2012, 09:20:53 PM »

any way to make a little bit random galaxy ?

p.coordinates.galaxy+":"+p.coordinates.system+":16",

so like
p.coordinates.galaxy+":"+p.coordinates.system+ (random +- 5)   +":16",

was try to make it self but the random funktion will only support positiv numbers ... and i dont know to calc with this script

Random randomNbr = new Random()
//prints 10 random [0-9]
for(int i = 0; i < 10; i++){
  printOut randomNbr.nextInt(10)
}
Logged

Devil's Hand

  • Administrator
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 2,523
    • View Profile
Re: ExpoScript: Expedition
« Reply #12 on: March 21, 2012, 09:35:52 PM »

Quote
random funktion will only support positiv numbers

=>
Code: [Select]
p.coordinates.galaxy+":"+ ( p.coordinates.system - 5 + randomNbr.nextInt(10) ) +":16",Seems Mathematics was not your favorite subject in school ;)

Regards,
Logged

Jentec

  • Full Member
  • ***
  • Offline Offline
  • Posts: 168
    • View Profile
Re: ExpoScript: Expedition
« Reply #13 on: March 22, 2012, 07:56:31 PM »

ok so i hope this is working

    if(okay)
    {
     printOut "trying to send from "+p.name
     appendToFile logFile, Time.getTime()+" | "+"trying to send from "+p.name+" \r\n"
     printOut "koords: "+p.coordinates
     appendToFile logFile, Time.getTime()+" | "+"koords: "+p.coordinates+" \r\n"
    Random randomNbr = new Random()
     def sent = sendFleet(
         p.name,
   
          p.coordinates.galaxy+":"+ ( p.coordinates.system - 5 + randomNbr.nextInt(10) ) +":16",
          FleetMission.EXPEDITION_MISSION,
          100,
          expofleet
      );
     
Logged

Roses

  • Newbie
  • *
  • Offline Offline
  • Posts: 15
    • View Profile
Re: ExpoScript: Expedition
« Reply #14 on: March 30, 2012, 11:40:54 PM »

is there a possibility that i can run this script in and infinite loop and start expos as soon as they return?

im think about this (freecode):

Code: [Select]
while(true) {
    while(freeexposlots != 0) {
         sendRandomExpo();
    }
    sleep(60000);
}

and what about never sending an expo to the same sunsystem multiple times? would be nice if the script recognize which sunsystems are in use by expos. Ofc if one expo comes back, the sunsystem should be ready for attack again. im just thinking about the possibility of sending 3 expos to the same sunsystem.. which is kind of waste :)

But nice script so far, works well :D

Regards roses
Logged
Pages: [1] 2 3 4
 

Page created in 0.033 seconds with 20 queries.