[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Using a Table to Chart Course
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Using a Table to Chart Course

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Neoshain   (38 posts)  [Biography] bio
Date Wed 19 Apr 2017 01:20 PM (UTC)

Amended on Wed 19 Apr 2017 01:24 PM (UTC) by Neoshain

Okay, so I have a plan, just wanna run it by you guys to see if I'm on the right track.

My SWR Mud implemented a new Hyperspace Route system where you have to chart a route from system to system to get across the galaxy.

Let's say I want to go from the Corellian System to the Kashyyyk system, when I'm in the Corellian System I then type
chart Kashyyyk

Then, after one minute, I receive


[Ship Computer] Hyperspace course charted.
Coruscant System
Chandrila System
Lantillies System
Kashyyyk System

So, I want to take that list, and put it into a Lua Table.

Then I initiate a trigger, just one, but it iterates through the table, as I go through the systems.

Something like this, (I haven't looked up the syntax for Lua tables, yet, so I know this probably isn't correct, I'm thinking of them like arrays for C++, which may be my error) where
is set at the initiation of the entire process.

--trigger matches coming out of hyperspace into the current system

Send("calc " .. routeListTable[i] .. " 1000 1000 1000"")

i = i + 1

[Go to top] top

Posted by Fiendish   USA  (1,775 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Fri 21 Apr 2017 11:46 AM (UTC)
In my experience there's no such thing as a right track. Infinite code paths lead to the same result.

[Go to top] top

Posted by Nick Gammon   Australia  (21,669 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 21 Apr 2017 08:57 PM (UTC)
Your question isn't really answerable. Certainly you can subscript tables in Lua similarly to C (note that subscripts usually start at one, not zero).

As for the rest, try some code and see what happens.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]