Thanks. So once the table is created, how can I call the data within it? I.e., the script would trigger on something like ^go <destPlanet>$. If I have two variables, currentPlanet, which is updated by this script and other aliases, and destPlanet = matches[2] from the 'go' command, would my syntax be
Code: Select all
speedwalk(tables.matches(currentPlanet, fromExchange))
or would the tables.matches(currentPlanet... look for a table called currentPlanet and return an error?
I'm including what I've got so far with my comments just to make what I'm trying to figure out a little clearer.
Code: Select all
-- Table has the following information stored:
-- PlanetName - name of Planet
-- System - star system of Planet
-- Cartel -- star systems are collected into several "cartel" star systems
-- in a hub-and-spoke system
-- Cartels serve as hubs to other cartels and can travel directly to
-- Systems contained within them and also other Cartels
-- Systems can travel directly to other Systems within their parent
-- cartel, otherwise they must travel to the Cartel hub
-- fromLink -- Each system has its own outer space and a designated hyperlink
-- to travel to/from other systems/cartels
-- fromLink provides navigation from the System/Cartel hyperlink
-- through the System's space to PlanetName
-- toLink -- contains directions from PlanetName back to Link
-- if PlanetName shares a location with the Link, then fromLink and
-- toLink will be empty [] and there is nothing to send below
-- toExchange -- directions from Planet to its trading exchange
-- fromExchange -- directions back to Landing Pad
destPlanet = matches[2]
-- there should be a variable currentPlanet that can be used by this and
-- other aliases so that the script knows where you are
-- Find out what planet we are standing on if this is the first time starting
-- match currentPlanet and destPlanet to PlanetName in the table, error if either is not found
speedwalk(currentPlanet.fromExchange) -- must be in the exchange to start the command or else you might get lostt
send("buy fuel") -- to make sure you don't get stuck in space
tempTimer(1, [[ send("board" ]])
speedwalk(currentPlanet.toLink)
-- Check to see what cartel destPlanet is in and either jump directly to spoke or navigate to the hub link
if currentPlanet.Cartel == destPlanet.Cartel
then send("j " destPlanet.System) -- and then go to next step
else send("j " currentPlanet.Cartel) -- travel to hubs and then destination spoke
send("j " destPlanet.Cartel)
send("j " destPlanet.System)
speedwalk(destPlanet.fromLink)
tempTimer(1, [[ send("board" ]])
speedwalk(destPlanet.toExchange)
-- You have arrived at your destination and we can update currentPlanet to
-- where you are now
currentPlanet = destPlanet
Here is an example table that I've got from your previous post:
Code: Select all
Sakura = {
planetName="Sakura",
system="Enso",
cartel="Flight",
fromLink = " ",
toLink = " ",
fromExchange="s",
toExchange="n"
},
Goldenshoe = {
planetName="Goldenshoe",
system="Meadows",
cartel="Meadows",
fromLink="w, n",
toLink="s, e",
fromExchange="e",
toExchange="w"
},
So in the example above, if I were on Sakura and wanted to travel to Goldenshoe, the currentPlanet variable would = Sakura and destPlanet = Goldenshoe, and the script would look up directions from Sakura to its main hub link, and then from that link to Goldenshoe.