Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Using a Table to Chart Course
|
Using a Table to Chart Course
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Neoshain
(38 posts) Bio
|
| Date
| Wed 19 Apr 2017 01:20 PM (UTC) Amended on Wed 19 Apr 2017 01:24 PM (UTC) by Neoshain
|
| Message
| 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
Quote: chart Kashyyyk
Then, after one minute, I receive
Quote:
[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
| | Top |
|
| Posted by
| Fiendish
USA (2,558 posts) Bio
Global Moderator |
| Date
| Reply #1 on Fri 21 Apr 2017 11:46 AM (UTC) |
| Message
| | In my experience there's no such thing as a right track. Infinite code paths lead to the same result. |
https://github.com/fiendish/aardwolfclientpackage | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Fri 21 Apr 2017 08:57 PM (UTC) |
| Message
| 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 | | 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.
15,290 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top