GithubHelp home page GithubHelp logo

Comments (4)

egomeh avatar egomeh commented on August 15, 2024

I don't remember how I got the list in the first place, but you can take some of this

std::string resourceIDToString(uint32_t id)

I do remember that I wanted a more automatic method to fetch the ids, but this might be enough to get you started? :)

Controlling trade routes was actually the latest thing I looked into. I got to a point where I could read route data (stops, goods, ships etc). I never got to the point where I could modify them or make new ones. I'm very interested to hear more if you find out anything!

from anno1800-scripting-api.

mm04926412 avatar mm04926412 commented on August 15, 2024

I did actually solve my problem! I pulled out the english localization XML and turned it into a python dictionary. I'm very interested in how you read route data as the XML I'm looking at right now is formatted terribly and I can barely navigate it with my XML library since it doesnt follow proper syntax.

from anno1800-scripting-api.

mm04926412 avatar mm04926412 commented on August 15, 2024

I have an example of a route in the save file below

<None>66</None>
<None>
  <ID>66</ID>
  <IsDefaultName>01</IsDefaultName>
  <Name>Ivy - Mir</Name>
  <Ships>
  </Ships>
  <LostShips />
  <Owner>
    <id>101</id>
  </Owner>
  <OwnerType>
    <OwnerType>1</OwnerType>
  </OwnerType>
  <Type>
    <id>0000</id>
  </Type>
  <Stations>
    <None>
      <StationID>7</StationID>
      <AreaID>8710</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>11</StationID>
      <AreaID>8966</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>4</StationID>
      <AreaID>9158</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>3</StationID>
      <AreaID>8838</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>12</StationID>
      <AreaID>9286</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>9</StationID>
      <AreaID>8902</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>10</StationID>
      <AreaID>9094</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>5</StationID>
      <AreaID>8646</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>8</StationID>
      <AreaID>9030</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>6</StationID>
      <AreaID>8774</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>2</StationID>
      <AreaID>8326</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>6500</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
    <None>
      <StationID>13</StationID>
      <AreaID>9222</AreaID>
      <GoodInfos />
      <Waypoint />
      <TradeRouteID>66</TradeRouteID>
      <IDManager>
        <FreeIDList />
        <NextID>2</NextID>
        <HotIDList>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
          <None>
          </None>
        </HotIDList>
      </IDManager>
      <RouteType />
      <RouteOwner>
        <id>6500</id>
      </RouteOwner>
      <AreaOwner>
        <id>2000</id>
      </AreaOwner>
      <HasTradeRights>01</HasTradeRights>
    </None>
  </Stations>
  <IDManager>
    <FreeIDList />
    <NextID>14</NextID>
    <HotIDList>
      <None>
      </None>
      <None>
      </None>
      <None>
      </None>
      <None>
      </None>
      <None>
      </None>
    </HotIDList>
  </IDManager>
  <LastErrors>30303030303030303030303030303030</LastEr
  <CharterRouteDescription>
    <SourceArea>0000</SourceArea>
    <TargetArea>0000</TargetArea>
  </CharterRouteDescription>
</None>

from anno1800-scripting-api.

egomeh avatar egomeh commented on August 15, 2024

I did not konw that savegames were saved as XML. That is quite nice! Thank you for sharing :D

from anno1800-scripting-api.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.