This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
OminousPenguin's profile picture

[Railcraft Mod] Elevator Control

Started by OminousPenguin, 16 April 2012 - 01:03 AM
OminousPenguin #1
Posted 16 April 2012 - 03:03 AM
Latest version: 2.2.0b - (18 September 2013)

For use with Railcraft Mod.



[media]http://www.youtube.com/watch?v=KuvnpW-fmxg[/media]

Description
Your elevator may have as many floors as you wish. - They discover each other automatically.
Computer console with modem on each floor wired to; the elevator, a cart detector and a boarding (or holding) rail.
The user arrives at the boarding or holding rail and activates the computer. They see this:



The number is the height coordinate. They use the up/down arrow keys to select their destination and then press Enter. They are then moved onto the elevator by the boarding rail.
The console at the destination floor displays the message "Incoming cart, Please clear the track". All other consoles display the message "Elevator busy, please wait" and do not accept input until the cart has cleared the elevator.

Physical Setup
MineFactory Reloaded:


RedPower2:


The three colours are currently (2.2.0b) hard coded as easily accessible variables at the top of the program.

Software Installation

Pastebin code: VYwxa3su

Using the pastebin API:
1. Right click the computer and type: pastebin get VYwxa3su setup and press Enter/Return
2. Type setup and press Enter/Return
3. Follow the on screen instructions

Manual installation:

Setup wizard: http://pastebin.com/VYwxa3su
Main elevator control program: http://pastebin.com/iJWyUQVr

Very important note on using GPS
GPS can not work if all the hosts are on one axis. For example if all your hosts are exactly vertically above/bellow eachother it won't work. Place a computer off to the side and run gps host x y z

Feedback welcome. Please report any bugs or problems so I can fix them!


ComputerCraft + Railcraft: Elevator Control by Hamish Robertson aka OminousPenguin is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Edited on 18 September 2013 - 03:15 PM
Leo Verto #2
Posted 16 April 2012 - 09:14 PM
Looks amazing! I'll install this on my tekkit server tomorrow!
To fix disk drives, you should take a look at http://thetekkit.wikia.com/wiki/ComputerCraft_Bug_Fixes or tell the server owner about it. :)/>/>
OminousPenguin #3
Posted 17 April 2012 - 02:08 AM
Let me know how you get on and what your users think.

Thanks for that link. I'll pass it on.
Wolvan #4
Posted 17 April 2012 - 08:29 AM
I maybe could help you with the peer system thingy :)/>/>
OminousPenguin #5
Posted 17 April 2012 - 04:31 PM
Go for it. Just share your work here.
Or we could use an online collaborative editor like this: http://piratepad.net/uov5M1grVf

I guess the first thing to do would be removing
if inputFloor==tonumber(thisFloor) or inputFloor<0 or inputFloor>5 then
And adding instead a table of floors. The key could be the ID of the computer and the value could be the label of the floor.

We'd need to have a unique ID for the elevator so that you could have multiple elevators within range of each other without it messing up.
The announcement would have to specify the elevator ID and the label for that floor - These would both be provided by the user on installation.

Each computer maintains its own table of floors and listens for new computers announcing their addition to the system. When a new computer broadcasts it's presence, all existing computers would send their details to that computer.

Now that we've got labels instead of sequential numbers as floor identifiers, it'd make sense to have a 'graphical' interface.. Probably a list of floors with the selected floor indicated by square brackets and you change the selection with the arrow keys.
Leo Verto #6
Posted 18 April 2012 - 09:17 PM
One more thing, I really like the idea of combining Railcraft and Computercraft, there are so many possibilities!
OminousPenguin #7
Posted 19 April 2012 - 07:19 PM
Post deleted
Edited on 23 March 2013 - 03:02 PM
Wolvan #8
Posted 19 April 2012 - 09:17 PM
Latest code here: http://piratepad.net/uov5M1grVf (Not for general use. Still has hard coded test data.)
I changed it slightly :)/>/>
I added a configuration program where the user can input the required data without messing with the code. It is a simple wizard. It gets called at the start of the prorgam. You can delete that line or chnage it if you want

Functions:
Spoilerconfig() - Starts the config wizard. Returns true on success
retrieve() - Gets all saved data. Returns true, "NoError", modemside, bundleside, elevator color, detector color, holding color on success else false and "NoConfig"
autoAssign() - Assigns all saved values to the variables and runs the config wizard automatically if needed
OminousPenguin #9
Posted 19 April 2012 - 09:38 PM
Let's keep dev chat to PiratePad.
Wolvan #10
Posted 20 April 2012 - 11:52 AM
Oh sry Omni
grazazel #11
Posted 24 November 2012 - 10:41 AM
Hi was looking for something like this to use on a tekkit server I play on. Is there anyway you can upload a saved world witht eh elevator setup so i can see exactly how it is built please
grazazel #12
Posted 27 November 2012 - 02:20 AM
I have tried following the instructions but not working for me
Kubikiri #13
Posted 30 November 2012 - 12:56 PM
Same here, on the install I am getting: bios:206: [string "install"]:4: ')' expected .. I'm trying to figure it out
johnm109 #14
Posted 18 December 2012 - 08:29 AM
i would love to do this on the server i play on but can you post more pictures or make a video of all this block placements for 2 floors thanks.
OminousPenguin #15
Posted 23 March 2013 - 02:59 PM
Hi all. I was just sorting through my bookmarks and found this site and thought I'd come and check it out.
computercraft.info was down for a few months lask year so I kinda assumed it was down for ever and stopped checking. (I just looked on wayback-machine and it was down for May and June)

I see some people have had problems. Please use the code from my original post, not anything from pirate pad

If anyone else has any queries or wants help getting my program running, just reply to the thread. I've turned on email notifications so you won't have to wait three months for a reply!!!
Shnupbups #16
Posted 23 March 2013 - 03:10 PM
NO! THE NECROMANCY!!!!!
OminousPenguin #17
Posted 23 March 2013 - 04:12 PM
NO! THE NECROMANCY!!!!!

NOOOOO!!!! WE'RE ALL GOING TO DIE!!!!

People have this notion that necroing an old thread is inherently bad. That is rubbish.
Necroing when you have nothing constructive to add, or if it was a discussion thread and the discussion came to an end, then it would be bad to necro. But I made a constructive post for the benefit of other people who may find this thread as grazazel did 7 months after it was abandoned.
SyberSmoke #18
Posted 21 May 2013 - 03:23 PM
I have been looking to use this also, I have been building a tower that would benefit from it. But at the same time some of the description is a touch confusing. Like you talk about an update computer in the text but make no mention of setting it up. So may be a little added detail would be nice.

Oh yes and Arise Chicken, CHICKEN ARISE!!!
OminousPenguin #19
Posted 21 May 2013 - 06:05 PM
Ok. First question is are you in multiplayer with no access to the server files and so need to type programs in manually? Or can you copy and paste files into the mod directory?
SyberSmoke #20
Posted 21 May 2013 - 06:51 PM
Ok. First question is are you in multiplayer with no access to the server files and so need to type programs in manually? Or can you copy and paste files into the mod directory?

Multiplayer: Yes
HTTP Access: Enabled
So I can run the pastebin commands and in fact have a masterControl computer with all the programs in it.

I am figuring it out as I go. What I am curious about is if you will be adding extra options to your code in the future. Things like touch monitor support, floor naming, spiffy menus…things like that. The niceties.

I am also a little curious, I do not see a "cart detector" (Feed the Beast: MindCrack) so would "Detector - ANY" be aplicable or is there another detector you had in mind.

Addition: Bug - attempting to use the install program returns "bios:338: [string "install"]:19: ')' expected
OminousPenguin #21
Posted 21 May 2013 - 09:24 PM
I am figuring it out as I go. What I am curious about is if you will be adding extra options to your code in the future. Things like touch monitor support, floor naming, spiffy menus…things like that. The niceties.
I have hardly played Minecraft since I made this program last April, and not at all with computer craft. So this is the first time I've even heard of a touch monitor (the version I made it with didn't even have monitors) and have no solid plans to develop the program. Sorry. I might have a look at it if I have time.
Why not use this as an opportunity to teach yourself simple programming?

I am also a little curious, I do not see a "cart detector" (Feed the Beast: MindCrack) so would "Detector - ANY" be aplicable or is there another detector you had in mind.
I don't remember. Try it and find out. I guess any would be best.

Addition: Bug - attempting to use the install program returns "bios:338: [string "install"]:19: ')' expected
That's because this forum stripped some necessary slashes. I've edited the first post to fix this.
SyberSmoke #22
Posted 21 May 2013 - 09:58 PM
I have tried with little success to learn programming. It just does not stick. So…oh well to that one. :-D
OminousPenguin #23
Posted 22 May 2013 - 02:13 PM
What version of MC are you using? I was about to setup MC with ComputerCraft, RailCraft and RedPower2 but I see RP2 is only available for 1.4.7…
SyberSmoke #24
Posted 22 May 2013 - 03:04 PM
Feed the beast mod pack - Mindcrack.

Feed-the-beast.com

That way you can use their launcher to get the proper mod and if say another issue comes about with a FTB mod you can get it and test. :-)

And yeah as usual Eloraam is being seclusive. She is working on a 1.5 port of redpower…but how long people have to wait is any ones guess.
OminousPenguin #25
Posted 22 May 2013 - 05:14 PM
SyberSmoke, give yourself a pat on the back. You've poked me into action.

I've installed Minecraft 1.4.6, ComputerCraft 1.52, Railcraft 6.14.0.0, and RedPower 2.0pr6 (Core and Digital)

First I'll implement peer discovery and floor names with a list of floors to select from.

Other stuff like monitors may follow.
SyberSmoke #26
Posted 22 May 2013 - 05:17 PM
Well it is good to see that you have taken an interest in redeveloping your program. My marble tower looks forward to seeing what you come up with. :-)
OminousPenguin #27
Posted 22 May 2013 - 06:23 PM
Feel free to suggest features.
SyberSmoke #28
Posted 22 May 2013 - 06:28 PM
An installer/updater that will download the latest version using the pastebin api? So all I need to get is install and run it and it will connect, download, and be ready in one shot? hehe…I guess I am just being lazy with that one.

Second through for long term: Multiple elevators running from a single computer terminal. So three shafts with one computer per floor.

Third thought as a possible necessity: It may be necessary for terminals (floors) to relay signals if the master control is to far away from a terminal.
OminousPenguin #29
Posted 22 May 2013 - 08:12 PM
Will do the pastebin thing and the relay thing. Though I don't think a 'master control' will be necessary. Do you think it is? What for?

Multiple elevators with one computer per floor is an interesting idea but as you say, something for the long term.
SyberSmoke #30
Posted 22 May 2013 - 08:29 PM
A master control may not be necessary, no but it would depend on the setup. As I understood it your update computer in the last version was something of a master computer. But my understanding was lacking as creepers kept blowing up my test platform. :-(
OminousPenguin #31
Posted 23 May 2013 - 06:24 AM
Yes the master comptuter was also because when I developed it I either didn't know about the HTTP API from ComputerCraft, or it wasn't enabled on the server, or maybe the version of CC didn't have the HTTP API yet. - So I had to type everything in manually so used the master computer to distribute it to all the floors.

Any ideas for using monitors?
SyberSmoke #32
Posted 23 May 2013 - 02:19 PM
Well…Monitors.

I believe that the Advanced Monitors allow for touch screen interaction. If you leave a little space some where you could show the floor your on, you could allow the player to choose what shaft cart they are going to use (Elevator Shaft 1,2, 3). And to allow then to pick their floor number/ named floor destination for that elevator.

If there are no carts there, then there should be no choices, just a big "Call Elevator" button should work. I did like that you showed the elevator was in use and that would be a handy thing again also.
OminousPenguin #33
Posted 24 May 2013 - 06:37 PM
Quick question: Are your elevator computers on each floor directly above/bellow eachother? ie do they all have the same x and z coordinate?

I'll support them being all over the place but just wondering what to make default. All over the place requires 4 GPS hosts. All above/below eachother only needs 2.
SyberSmoke #34
Posted 24 May 2013 - 07:41 PM
If I may ask, why would you need a GPS system for a static elevator system? I mean I use a GPS system for my turtles, but an elevator with static floors, wouldn;t it be better to be "dumb"??
OminousPenguin #35
Posted 24 May 2013 - 08:36 PM
They need their y coordinate so they know what order they are in. If we're going to have a list of floors to select from, it would kinda suck if they weren't in the right order.
Please choose your destination:

1st Floor
Basement
Ground Floor
Roof

It's not so bad with only 4 floors but if you've got lots of floors then it would be annoying!

So the options are:
1. User specifies y coordinate for each floor. (Fine if you've only got a few)
2. User specifies x,y,z for first 4 floors which then run as GPS hosts in the background, then the rest can get their y coordinate from them (Good if you've got lots of floors).

When setting up each floor they need to follow a quick setup wizard to check for a modem and specify a name for the floor, then they have the option of 1. Specifying the y coordinate, 2. Get coordinate from GPS, 3. Specify x,y,z and start gps.host in the background.
SyberSmoke #36
Posted 25 May 2013 - 12:14 AM
Or of coarse the user could just specificity:

What floor is this: B1/B2/B3, 1/2/3 (B for down if you want to expand down or whole numbers for up)
What is the Floor Name: <Some random name>

Now using a GPS would have benefits of coarse, really you could just set everything up ahead of time and use your Update computer could say:
5 elevator computers found, their heights are: 1, 5, 8, 10, 15.
Is the computer at y=1 ground floor? Y/N
if Y then each computer is assigned a floor value.
if N it asks about next value.

Or just let the player say ground floor is # and floors up are listed, floors down are listed with a B# descending.

And this may all have nothing to do with reality so..yeah.
OminousPenguin #37
Posted 25 May 2013 - 06:59 AM
I'm not planning on having an 'update computer'.

If the user specifies B2/B1/G/1/2/3 etc themselves, then if they want to add another floor between G and B1, two existing floors, then the program should change the existing B1 to B2 and B2 to B3. (That's fine, but adds a bit more work for me)

What if the user builds an elevator stop on the ground floor, and then the 3rd floor, but not on the 2nd floor. Then they dig out another floor between the 1st and 2nd and put an elevator stop on it. They want this new one to be the 2nd floor. How does the elevator know that the 3rd floor should be renamed the 4th floor and they haven't simply built a stop on the original 2nd floor? It has to ask them what to do.
I want to keep it simple, while allowing people to use it however they want.

I think I'll just ask for y coordinate and a name and provide the functionality to rename floors.
SyberSmoke #38
Posted 26 May 2013 - 12:07 AM
that works
SyberSmoke #39
Posted 29 May 2013 - 01:59 PM
So how goes the work? I am very curious.
OminousPenguin #40
Posted 29 May 2013 - 07:59 PM
I keep refactoring it trying to make it smaller and more efficient. I should probably just finish it and leave the optimisation until afterwards.

I'll let you know as soon at there's something to test.
Dlcruz129 #41
Posted 29 May 2013 - 09:29 PM
People have this notion that necroing an old thread is inherently bad. That is rubbish.

Except for the fact that its not allowed on these forums.
SyberSmoke #42
Posted 29 May 2013 - 10:34 PM
People have this notion that necroing an old thread is inherently bad. That is rubbish.

Except for the fact that its not allowed on these forums.

Since the developer and OP of the thread has been active in the thread since the threads resurrection. In fact it's resurrection has caused the developer to pick it back up. So…yeah…get over it.


I keep refactoring it trying to make it smaller and more efficient. I should probably just finish it and leave the optimisation until afterwards.

I'll let you know as soon at there's something to test.

It would be a good idea to release something for commentary and testing. :-)
Leo Verto #43
Posted 31 May 2013 - 12:23 PM
People have this notion that necroing an old thread is inherently bad. That is rubbish.
Except for the fact that its not allowed on these forums.
Necroing is only bad when someone picks up a totally dead discussion thread, Penguin is totally right.
Cranium #44
Posted 31 May 2013 - 12:43 PM
I looked over this topic. There is no necro. Carry on.
OminousPenguin #45
Posted 03 June 2013 - 06:19 PM
Earlier today I hoped to have the program ready for beta testing by this evening but it's not quite there yet. Aiming for tomorrow!

All that remains to be done before I release the beta is controlling the actual elevator, the pastebin thing, and I need to add a section to the setup wizard for choosing the position and colours of the bundled red stone wire.

This initial release is limited by the range of the wireless modem. - Any floors outside of floor X's range will not find out about floor X.
In a subsequent update, floors in-between will pass on details of X so all floors will find out about all other floors.

Also there is no facility for having multiple different elevators within range of each other. You'll be able to work around this by manually specifying a different channel number in the file.

Edit: ok… tomorrow! more needed doing than I thought.
SyberSmoke #46
Posted 04 June 2013 - 10:58 PM
You may get me interested in playing again. :-)
OminousPenguin #47
Posted 05 June 2013 - 03:52 PM
Ok. Beta release of version 2 is here!

See original post for details.

Let me know how you get on!

If you want me to come on your server and help set it up, PM me the address and what time you'll be online (including time zone! I'm in GMT)
OminousPenguin #48
Posted 07 June 2013 - 05:05 AM
Update 2.0b -> 2.0.1b

The four variables bundleSide , elevatorWire, detetctorWire and boardingWire now work.
In 2.0b the colours were still hardcoded where they were actually used. Oops.

Setup program remains unchanged so you can just run the setup program again, or use pastebin get iJWyUQVr elevator-main.lua (You will need to delete your old elevator-main.lua first)
basdxz #49
Posted 07 June 2013 - 08:01 PM
Would this work with RedNet wire from MFR? And could it be made to run from one comp with touch screen monitors with CC rednet cables?
SyberSmoke #50
Posted 07 June 2013 - 09:49 PM
Would this work with RedNet wire from MFR? And could it be made to run from one comp with touch screen monitors with CC rednet cables?

It working with rednet wire would depend on ComputerCraft supporting that specific mod. You would have to check the API's for that. As for the touch screens and such…patience. He has just spent a good amount of time reworking his original code. He is interested in added features, but for now it looks fairly bare bones.
basdxz #51
Posted 07 June 2013 - 10:19 PM
Would this work with RedNet wire from MFR? And could it be made to run from one comp with touch screen monitors with CC rednet cables?

It working with rednet wire would depend on ComputerCraft supporting that specific mod. You would have to check the API's for that. As for the touch screens and such…patience. He has just spent a good amount of time reworking his original code. He is interested in added features, but for now it looks fairly bare bones.
The current CC is MFR Rednet cable compatible while redpower is still 1.4.7 and not 1.5.2. Could this be made to work with MFR rednet cables?
OminousPenguin #52
Posted 08 June 2013 - 05:32 AM
Would this work with RedNet wire from MFR?
Yes, as of CC 1.53 the bundledCable API works with MFR's cables. I have just tested this and it works as expected:


And could it be made to run from one comp with touch screen monitors with CC rednet cables?
Touch screens are definitely on the todo list.

Running it from one computer would essentially be a completely different program… Monitors must be adjacent to a computer so you couldn't have one computer with a monitor on each floor. You'd have to travel back to that one computer to choose your destination.
Why did you want it to run from one computer? What sort of use-case are you imagining?
hpnisse #53
Posted 08 June 2013 - 12:51 PM
Running it from one computer would essentially be a completely different program… Monitors must be adjacent to a computer so you couldn't have one computer with a monitor on each floor. You'd have to travel back to that one computer to choose your destination.
Why did you want it to run from one computer? What sort of use-case are you imagining?

You don´t need to have the monitors adjacent to a computer anymore, in the 1.5 update they added peripheralCable (aka. "Networking Cables" with "Wired Modems".
So you can have the monitor or in this case monitors connected by wire. Multiple monitors (or other peripherals) can be on one network cable and it will only take one side on the computer!
OminousPenguin #54
Posted 08 June 2013 - 04:38 PM
You don´t need to have the monitors adjacent to a computer anymore, in the 1.5 update they added peripheralCable (aka. "Networking Cables" with "Wired Modems".
So you can have the monitor or in this case monitors connected by wire. Multiple monitors (or other peripherals) can be on one network cable and it will only take one side on the computer!
Ok. I'll do some tests.
What sort of setup do you envisage? Why do you want the floors connected by cables? It looks like that would be more expensive and also require a lot more user interaction to set up - they'd need to specify which monitor was on which floor, unless all the monitors have identical display which doesn't seem very efficient.

Maybe I'm missing something but I don't see how this would be a good idea.
basdxz #55
Posted 08 June 2013 - 04:54 PM
You don´t need to have the monitors adjacent to a computer anymore, in the 1.5 update they added peripheralCable (aka. "Networking Cables" with "Wired Modems".
So you can have the monitor or in this case monitors connected by wire. Multiple monitors (or other peripherals) can be on one network cable and it will only take one side on the computer!
Ok. I'll do some tests.
What sort of setup do you envisage?

I would want a monitor on every floor acting like a computer does here but pressing one button is silmpler and faster than a few. Also should work with pick-up rails >: D
OminousPenguin #56
Posted 08 June 2013 - 04:58 PM
I would want a monitor on every floor acting like a computer does here but pressing one button is silmpler and faster than a few. Also should work with pick-up rails >: D

As has already been said, touch monitors are planned, but why do you want one computer, and a load of cable instead of simply a computer on each floor with it's own monitor?

Regarding pick-up rails, you can simply place one between the boarding rail and the detector. That's nothing to do with the program - You can have whatever rail configuration you like.
OminousPenguin #57
Posted 08 June 2013 - 09:44 PM
Update 2.0.1b -> 2.0.2b
  • Fixed bug with GPS options.
Setup program changed so to update use pastebin get VYwxa3su setup then run setup. (You will need to delete your old files first)
No need to update if you don't use any of the GPS options.
SyberSmoke #58
Posted 17 June 2013 - 06:55 PM
I would like to suggest a key feature. The ability to call an elevator from another location. May be it could be just at the top of the list as "Call Elevator" That way some one can use it with out having to climb to it. :-)

Actually I was wondering…what is the reason for the detector? I ask because each floor should only have two states: Has Cart, Does not have cart. If some one went to a floor, that floor should be "Has Cart". While all other floors should be "Does not have cart". So what is there to detect?

This would also make things easier for the user because the computer that has the cart would be able to send that cart to another floor (Full Menu). While all the other floors would only present one option, Call Elevator.

Now this would present an issue if the elevator cart gets broken, the person would need to track down what floor and replace the cart. But in this case there could also be something of a debug where the player could place a cart on any floor and use a command…say "find lost cart" and the system will send it to the lowest floor and register the cart in that position.

Any way as you can see I FINALLY got back in the mood to monkey with my tower…and I am enjoying the elevator even though I can not call the cart to me. I am glad that the elevator rail is also a ladder.
OminousPenguin #59
Posted 17 June 2013 - 07:43 PM
I would like to suggest a key feature. The ability to call an elevator from another location. May be it could be just at the top of the list as "Call Elevator" That way some one can use it with out having to climb to it. :-)
I'll add a 'Call Elevator' button to the next update. I always just carry a cart around with me and take it off the track at my destination. That way you avoid other players colliding with unmanned carts.

Actually I was wondering…what is the reason for the detector? I ask because each floor should only have two states: Has Cart, Does not have cart. If some one went to a floor, that floor should be "Has Cart". While all other floors should be "Does not have cart". So what is there to detect?

This would also make things easier for the user because the computer that has the cart would be able to send that cart to another floor (Full Menu). While all the other floors would only present one option, Call Elevator.

Now this would present an issue if the elevator cart gets broken, the person would need to track down what floor and replace the cart. But in this case there could also be something of a debug where the player could place a cart on any floor and use a command…say "find lost cart" and the system will send it to the lowest floor and register the cart in that position.
Programmers don't like to assume stuff. The detector is so it knows when to stop powering the elevator and free up the system. Just powering the elevator for a certain amount of time is clumsy. If you're going up 10 meters it'll take a few seconds. If you're going up 100 meters it'll take longer.
I would work out the speed and do it exactly, but there is no way to know how far the cart has to go to actually get to the elevator track. (Unless it asks the user, but I don't want to increase the setup complexity)

Unfortunately I have not found a way to have a boarding rail on top of a detector so a computer can not know if there is a cart present. We could have a detector on the side of the track, but that would be ugly.
SyberSmoke #60
Posted 18 June 2013 - 12:12 AM
Well right now I do not know what happened. But I think the system lost track of the elevator. I try to send it some where and well it does not go and the power gets locked on. So a "Find Cart" command may also be a good idea. Just pulses the passenger rail across the system and send to to bottom floor.
OminousPenguin #61
Posted 18 June 2013 - 05:15 AM
It doesn't 'keep track' of the elevator. Each floor can be in one of three states and while not in use all floors are in the same state.
You can put a cart on the track on any floor and use it.

What do you mean by "Just pulses the passenger rail across the system"?

If the elevator power does not come on, the receiving floor may be out of range or no longer exist. Currently if you remove a computer, it does not get removed from the list on the other computers.

If you'd like to PM me the server details I'll gladly take a look.
SyberSmoke #62
Posted 18 June 2013 - 02:05 PM
I will have to talk to the server administrators, but I will see what I can do. :-)

As for pulsing, I thought that you may be tracking the position of the cart to prevent one station from sending it somewhere that floor could not send it. Since each computer is responsible only for it's floor, it would be silly to allow a command that can not fulfilled. It would just lock the system up.

So I was thinking on this:
1. Cart is on the passenger rail.
2. Player gets in, accesses computer.
3. Player chooses a floor and the cart is launched.
4. Cart passes over detector registering cart left.
5. Cart passes over destination detector registering cart is at that floor.
6. cart hits passenger rail and stops.

Consequences:
1. Only the station with the cart can send the cart.
2. All other stations can call the cart.
3. If for some reason the cart gets lost, or does not arrive, the system can try to find the cart py pulsing all of the boarding rails in the system sending the cart to the lowest floor. The system can also before this happens run a check of the active computers to make sure no floors have changed. This way the cart that is lost will either hit a sensor leaving or landing at a station.

As I stands, it looks like the system does not track the cart so it knows where it is. And while a cart can be deployed from any location, the system can lock up if the cart never gets to where it is going for some reason. Any way I will see about getting you access to the server. It is being a little odd right now…for some reason mobs are not spawning…heh. l8r.
SyberSmoke #63
Posted 19 June 2013 - 02:54 AM
Well found two of the issues. I had to wipe the CFG and use setup again as something went odd and I did not have one of my stations properly set for the colored wire I was using. Things are working right again.
OminousPenguin #64
Posted 03 July 2013 - 01:01 PM
Update 2.0.2b -> 2.0.3b
  • Added 'Call Cart' option (Space bar)
To update just run the setup program again or use pastebin get iJWyUQVr elevator-main.lua (You will need to delete your old elevator-main.lua first)

Sorry it took so long. Kinda busy.
DigiDamage #65
Posted 08 July 2013 - 02:08 PM
Hello!
First off, wonderful bit of software and idea! First elevator which makes sense in minecraft.

Second, i'm having a weird error that might, or might not, come from other mods that I've installed, or maybe some bug somewhere.
The thing is, that when I have created the elevator, and runs it, it goes to the floor of my choosing but the computers stays on "Elevator busy Please wait" in the floor i have left, and "Incomming cart Please clear the track" on the floor i'm going to.
I have created 2 elevators now, one replica from your tutorial video, and one of my own designs, but none does it correct. Thing is though, if I exits the world, and goes back in, it seems the computers have resetted and I can make it to another floor before it happens again.

I'm "hoping" that I have just missed something vital in my designs, but I really can't make out what it is. :S

Best Regards, DigiDamage
OminousPenguin #66
Posted 08 July 2013 - 03:24 PM
Hi DigiDamage,

I'm glad you think it's a good idea!

Sorry to hear you're having a problem with it. It sounds like the issue is with the detector.
It could be the actual detector - there are lots of different types of detector and only a few react to the player. Some that only detect empty carts, or carts with animals in etc.
Or it could be the cable connection. Are you using RedPower2 or MFR for the cables?
Note that there are multiple shades of some of the colours and some look very similar. The default for the detector is white so unless you've changed it, I'd be surprised if this was the problem.

Let me know how you get on!
DigiDamage #67
Posted 09 July 2013 - 02:40 AM
Thank you for answering Penguin!

Your welcome!

But, I haven't gotten this thing to work. I really can't even find the issue. And just to be sure, default wires are "White", "Purple" and "Lime insulated wires" right? "Red Alloy Wire" and "Bundled Cable"? Those should work with just running the setup if i'm correct.
And I have tried both Redpower 1 &amp; 2, redpower 1 with MFR, and redpower 2 standalone (except for other needed mods ofc).
As for the detectors, i have tried most of the ones who can detect either a cart or a player, but no one is working.
The only thing i haven't tried, and I hope this is my big flaw, is some newer version of MC. I have been running on 1.4.7 and i might suspect that something isn't working because of that? I read through this forum but can't find much information regarding version and I guess that is because this is more of a software then a version-depending mod.

Is there anything else that I can try at this stage or am I doomed because of a fault that doesn't wanna be found?

Best Regards, DigiDamage
OminousPenguin #68
Posted 09 July 2013 - 05:50 AM
Ok I just tested it on 1.4.6 and it's not working. So it's not just you.

It's strange because v2.0.0 was for 1.4.6 before I knew about MFR's cables.

I'll let you know when I find the bug.

Edit:
It's working for me now.
I think it might have been something to do with the file encoding but once it's been through pastebin I think it's just plain ANSI with Unix file endings…. so not really sure.

Try deleting and trying again: http://pastebin.com/VYwxa3su
DigiDamage #69
Posted 09 July 2013 - 08:50 AM
"Hello again and here to present the award, give a warm apploud for Satan!

- Hey audience! I will be presenting the award for the biggest idiot of the year!
And the winner is….. DigiDamage! Come up here you complete and utter idiot!
- Thank you Satan…."

I am so sorry for have been wasting your time Penguin, it was a minor, but critical error that I made. The fricking detectorblocks were not facing downwards and the opening was on the track, not the alloy wire. I feel so very dumb and I hope you don't get mad!

Your coding is awesome, and now that my stupidity is finally over (xD), i can go on with my life in MC.
Thank you very much for your time, and goodbye!

Best Regards, DigiStupid

Edit: Although, something isn't working. I have 7 floors on my building, ground, f1-5 and top floor, but it will not go from bottom floor to top floor, the ele rails won't activate and just stays offline, and same "error" as before shows up, no detection "Please wait…".
I tried to use the GPS system, but i couldn't get that to work. As my previous stupidity have let me down, i might be doing something wrong when setting up.
I made the first 4 floors as GPS hosts with z,x,y coords, but then when I make the fifth floor computer, it won't find any gps signals.
Is there anything i must setup or use other devices/blocks before I can make use of the GPS system? Is there any script included in the elevator-main that activates "GPS-host on startup, send ping" or something?
OminousPenguin #70
Posted 09 July 2013 - 10:31 AM
Glad it's working!

The whole Satan thing is a bit weird though. He is the father of lies. You are not an idiot. I made the same mistake myself when I first tried using them. I's not obvious and it would seem perfectly logical that the square on the texture could be the detector rather than the output.
DigiDamage #71
Posted 09 July 2013 - 10:43 AM
The whole Satan thing is a bit weird though. He is the father of lies.

Among other things.

But it seems like I will not rest just yet on this. See my previous posts edit if you would like.
OminousPenguin #72
Posted 09 July 2013 - 12:00 PM
Edit: Although, something isn't working. I have 7 floors on my building, ground, f1-5 and top floor, but it will not go from bottom floor to top floor, the ele rails won't activate and just stays offline, and same "error" as before shows up, no detection "Please wait…".
I tried to use the GPS system, but i couldn't get that to work. As my previous stupidity have let me down, i might be doing something wrong when setting up.
I made the first 4 floors as GPS hosts with z,x,y coords, but then when I make the fifth floor computer, it won't find any gps signals.
Is there anything i must setup or use other devices/blocks before I can make use of the GPS system? Is there any script included in the elevator-main that activates "GPS-host on startup, send ping" or something?

The modems have a max range (range is even less in thunder storms). It sounds like the floors may be out of range of eachother.
You can adjust the range in .minecraft\config\ComputerCraft.cfg
At some point I'll make the middle floors relay the message up and down, but it will be a while before I do.

EDIT: Ahhhh. GPS doesn't work if all the hosts are in a line. you need to place a computer (with a modem) off to the side and run gps host x y z
DigiDamage #73
Posted 09 July 2013 - 03:36 PM
EDIT: Ahhhh. GPS doesn't work if all the hosts are in a line. you need to place a computer (with a modem) off to the side and run gps host x y z

Aha! Gonna try that, because maxrange didn't change a bit! Will report back with results!

Best Regards, DigiDamage


Edit: Finally! Got GPS-host to work. Just put 2 computers on first floor and 3 in a row (y), and then I just hade to choose the second option when installing new computers and it got the information.
And most definitly finally! Got the whole elevator to work properly! It worked like a charm until top floor, then it died, fortunatly, I had just missed a alloy cable behind on the elevator track. So now it goes from top to bottom and vice verse without a hickup!

I am very glad that you have taken your time and I giving alot of kudos to you. You have also sparked my flame to continue reading on math so I can take a proper education in programming!

Very Best Regards from Sweden, DigiDamage
SyberSmoke #74
Posted 27 July 2013 - 04:39 AM
Glad it's working!

The whole Satan thing is a bit weird though. He is the father of lies. You are not an idiot. I made the same mistake myself when I first tried using them. I's not obvious and it would seem perfectly logical that the square on the texture could be the detector rather than the output.

Technically that is a misconception. Lucifer with the quire of angels is best related to as opposing council in a court of law…at least before he was cast out. His roll was not lies, but to act as prosecutor of humanity. To keep Gods opinion of his creations close to reality and to prevent a drastic sway of opinion one way or another. This view was later twisted to make the character out to be the bad guy and to place him in the role of tempter and lair, persecuting those of immoral or corrupt soul and deeds. But that was more the Catholic Churches thing as they needed a hell so they had sway and control over the uneducated masses. It is also how they became one of the most powerful and wealthy organizations in the world.

But to get back on topic, any progress?
peachpitt #75
Posted 31 July 2013 - 09:45 PM
Hey, great tutorial there, but I'm having a problem with the program on my server. After running setup and rebooting, it tells me "elevator-main.lua:105: attempt to call nill". Is there another program I have to download or what? Any help would be much appreciated.
Patroad #76
Posted 04 August 2013 - 08:22 PM
ok im in the unleashed pack and saw that you where using the MFR RedNet cable, since Unleashed does not have redpower 2. How do you make it so the computer recognizes the RedNet cables cause i can not figure it out to save my life lol
OminousPenguin #77
Posted 05 August 2013 - 11:49 AM
Hi guys. I'm away until the 15th.. Writing this on my phone.

If you're still getting the error try deleting the files and redownloading the installer. Make sure you're downloading the latest version.

Regarding rednet cables, they work interchangeably with RP2 cables. You don't have to do anything different.
Git #78
Posted 18 August 2013 - 04:28 PM
Hello all,

I've been a long-time follower of this thread, but have yet to post… so I decided to go ahead and register. So far I have to say that I LOVE the program, and am working to implement it as best as possible in my FTB server. I did have a few questions/ideas though…

First: Has there been any attempt at allowing multiple elevators in close proximity to one another? I would love to be ably to use, say, three or four in my tall skyscrapers… as far as I know and have tried though, this is not possible (I did see it previously mentioned).

Second: Would it be at all possible to implement a door system on each floor that allowed the player to call carts, but also kept empty floors closed like a real elevator? I've been expiramenting with redpower 2 and have a basic system in place, but it ain't pretty.

Thanks, Git
OminousPenguin #79
Posted 18 August 2013 - 05:12 PM
Hi Git,

As you said, I've been aware of the desire for multiple elevators near eachother but haven't done anything about it yet. - I rarely play Minecraft or work on this program… sorry!

Your second idea is definitely possible.

I want to keep it as easy as possible for people to set up and get it running so that means making features optional and making a good interface.

Anyway… if you're desperate and want to try editing it yourself, make multiple copies of the pastebin and find and replace all instances of "ELEV_" with "ELE1_" for one elevator, "ELE2_" for another - then the two would ignore eachother's messages. This is obviously just a dirty hack but should get it working for you.
Git #80
Posted 18 August 2013 - 05:25 PM
Hi Git,

As you said, I've been aware of the desire for multiple elevators near eachother but haven't done anything about it yet. - I rarely play Minecraft or work on this program… sorry!

Your second idea is definitely possible.

I want to keep it as easy as possible for people to set up and get it running so that means making features optional and making a good interface.

Anyway… if you're desperate and want to try editing it yourself, make multiple copies of the pastebin and find and replace all instances of "ELEV_" with "ELE1_" for one elevator, "ELE2_" for another - then the two would ignore eachother's messages. This is obviously just a dirty hack but should get it working for you.

I'll give it a try, thanks!

-Git
Git #81
Posted 20 August 2013 - 07:50 PM
Hey Penguin,

Thanks for your help. I was able to get multiple elevators working right next to each other! I have another question though… is it possible to re-name a floor or floors after the initial setup? My thinking was that as I find a use for some of my empty floors, I could re-name them.

-Git :)/>
OminousPenguin #82
Posted 20 August 2013 - 08:28 PM
Ah great! I'm glad you got it working.

If you run the setup program again and specify a different name, it should overwrite it and transmit the new name to the other floors.
grazazel #83
Posted 31 August 2013 - 09:08 AM
Hi trying to set this up on ftb unleashed v1.1.2. The programs is working but I don't get any life when i select the floor the rails seem to stay un-powered. I an using mfr cables as shown in the screenshot but don't seem to get a signal to the track to turn on. Here is a screenshot of how i got it setup. any help would be appreciated

OminousPenguin #84
Posted 31 August 2013 - 09:37 AM
Hi grazazel,

From your screenshot it looks like you haven't set the colours of the rednet cable endpoints.
You do this by right clicking on the coloured collar with a precision sledgehammer.

By default, the connection to the boarding rail should be green; the detector white and the elevator rail purple. Note that some of the colours are very similar, eg there are a few shades of green.

Have a close look at this image and note the colours:


Also make sure your detector block is the right way up: One side has a square in the middle - That is the output and should be facing down.

Hope you get it working!
grazazel #85
Posted 31 August 2013 - 12:16 PM
ok i set the colours up and the cart works fine from upper levels but on the ground floor it launches then bounces back instead of going up. is there something i am missing on the ground floor setup?
OminousPenguin #86
Posted 31 August 2013 - 01:39 PM
Do you just have 2 floors (as in your screenshot) or have you added more? I'll assume you've just got 2.

For the cart to go up, the destination floor must power the elevator from its level. So there are three possible problems:

A. The ground floor is failing to transmit to the 1st floor.
B. The 1st floor isn't receiving the message from the ground floor.
C. The 1st floor is failing to power the elevator.


If you haven't got it working, please perform the following tests so that I can diagnose your problem:

1. Reset everything:
Break any carts on the system.
On each computer hold Ctrl+T until it says Terminated. Then type reboot and press enter.

2. On the ground floor, with no cart on the track, select the 1st floor and press enter.
Go to the 1st floor and look at the computer. What does it say?
a.) Incoming cart, please clear the track
b.) Elevator busy
c.) Still at the floor selection menu
d.) Something else

Let me know what it says.

3. Now reset everything again as described in step 1.

4. The same as step 2, but going from the 1st floor to the ground floor. Remember to do it with no cart present.

Again, let me know what it says on the ground floor computer.
noxiaz #87
Posted 05 September 2013 - 04:12 PM
Hello :)/>

First i want to say, it's a really great project you have created. :)/>

I have a question, and sorry if anyone else has asked it, but hasn’t been able to find my answer :)/> - I’m wondering how you are getting the train out of the track when it’s at the right floor? – Are you willing to explain how you are doing this? :)/>

I really like the project and want to create my own similar to yours, but with my own code because I like that part :D/> I hope you are willing to share the information about how you’re getting the minecart of the elevator track when it’s at the right floor :)/>

Best regards
NoxiaZ
OminousPenguin #88
Posted 05 September 2013 - 10:02 PM
Hi NoxiaZ,

Take a look at the video (http://www.youtube.com/watch?v=KuvnpW-fmxg#t=105) from 1:45. You simply apply redstone power to the elevator track at the level below you want the cart to come off.

I look forward to seeing your program. I don't really have time to keep mine updated with new features, so it would be good if you do!
Git #89
Posted 06 September 2013 - 12:50 AM
Hello again Penguin,

I seem to be having a problem with the GUI because I have so many floors… I was wondering what it would take to make the list of floors scroll as you used the arrow keys… see my picture below. The bad news here is that I have a 21 floor building… this occurred at 10.

OminousPenguin #90
Posted 06 September 2013 - 05:42 AM
Haha. Yeah that's a problem. Sorry about that.

Maybe I'll make the selection remain in the middle and move the whole list up and down?

In the mean time you can probably still select floor 1, you just won't be able to see it. Of course if you go to floor 2 and access the terminal there, you will then be able to see 1 and it will be no 10 that's off the top. - I know it's not satisfactory but at least the elevator is still usable.
Git #91
Posted 06 September 2013 - 12:36 PM
Haha. Yeah that's a problem. Sorry about that.

Maybe I'll make the selection remain in the middle and move the whole list up and down?

In the mean time you can probably still select floor 1, you just won't be able to see it. Of course if you go to floor 2 and access the terminal there, you will then be able to see 1 and it will be no 10 that's off the top. - I know it's not satisfactory but at least the elevator is still usable.

If you could look into it that would be great! I've stopped setup on the rest of my computers because I suspect any update would involve new code. It's a tedious process since I have 21 floors total with 2 elevators… thats 42 computers.

-Git ;)/>
noxiaz #92
Posted 07 September 2013 - 09:11 AM
Hi NoxiaZ,

Take a look at the video (http://www.youtube.c...vnpW-fmxg#t=105) from 1:45. You simply apply redstone power to the elevator track at the level below you want the cart to come off.

I look forward to seeing your program. I don't really have time to keep mine updated with new features, so it would be good if you do!

Thank you so much, that explained it well :)/> I will let you know when i got something to show, its just a side project when im at school :)/>
Git #93
Posted 09 September 2013 - 01:50 PM
Hey Penguin,

You hinted at maybe taking a look at that scroll feature… I'm sure you're really busy, so I don't want to nag… but was I right to assume that?

-Git ;)/>
OminousPenguin #94
Posted 09 September 2013 - 01:57 PM
Sorry, I haven't yet. Will do it this evening. Expect it in the next few hours.
Git #95
Posted 09 September 2013 - 04:51 PM
:wub:/>
OminousPenguin #96
Posted 09 September 2013 - 06:12 PM
Sorry Git. Not going to be tonight. I've done the menu scrolling bit but found a few other bugs. Also I need to implement some sort of mass updating feature. (I could release without it, but then you'd have to update them all manually twice instead of once.)

Sorry for giving you false hope. - I'll just promise to work on it and release asap. It probably won't be tomorrow.
Git #97
Posted 09 September 2013 - 06:50 PM
It's fine, I just wanted to make sure I wasn't forgotten… :P/>
OminousPenguin #98
Posted 10 September 2013 - 12:50 PM
Realised I also need to implement multiple elevators in the setup. If I don't then after the update you'll have to do the same as before and replace ELEV_" with "ELE1_" etc

Might need to have a button for advanced options or something.
Git #99
Posted 10 September 2013 - 03:14 PM
Can't wait to see what you come up with! The program is my entire basis for a minecraft city with tall skyscrapers!

-Git :)/>
Git #100
Posted 13 September 2013 - 11:07 PM
How goes the update process? The suspense is killing me! :wacko:/>

I assume you are still working on an easy way to setup multiple elevators..?
OminousPenguin #101
Posted 14 September 2013 - 01:10 AM
Multiple elevators done. Just need to finish the update system to cope if some floors are out of range.

I'm afraid I'm away this weekend so you'll have to hang on a bit longer.
noxiaz #102
Posted 17 September 2013 - 06:15 PM
Hey OminousPenguin :D/>

Here is a clip of what i created so far :)/>

http://www.youtube.com/watch?v=cwj5i2B6Neg

Its created with a client-server program,

The client code: http://pastebin.com/GRxRhE4X

The server code: http://pastebin.com/8E9CFEch

This are my first lua script i ever have created. So yes, i guess that the code is pretty messy, but seems to work well so far. :D/>
But there are still a lot of work to do :)/>
OminousPenguin #103
Posted 17 September 2013 - 07:53 PM
Nice job. What are your plans for the future?

I admire your lack of efficiency :P/> I'm sure you get much more done than I do thinking about big O of operations and storage space.

I notice you have a space character between explodeChar and y. If you make your explodeChar \031 then that won't be necessary.

Interesting that you went for a client-server architecture. Have you thought about what to do when you have too many floors for just one server? Or multiplayer?
Once I've got this next release published I'm going to add a sort of server element - It'll still be peer to peer but one or more peers will dynamically take on the job of coordinating and relaying messages as required by the range.

What is your experience of programming?
noxiaz #104
Posted 18 September 2013 - 05:10 AM
I’m not sure what my plans are yet, but i think it will be to support the GPS function, and when a client "login" to the server it should send information back to the client if it already exist, so no need of client configuration again. This check will be done by the GPS coordinate.
Away to detect where the minecart is and maybe a screen for the server to display the whole setup, and ofc a more beautiful GUI :)/> - hmm and some way to remember the settings even when you logout of the server and back again, how do you handle that?

Hehe thanks :D/> – I have no idea how lua performs, but when everything is made by events it should be fine I hope, but the time will show.

But I got one problem, if I turn on 4 clients and not the server, the whole computercraft are getting slow :S

Client code:
local keepRunning = true;
while (keepRunning) do
rednet.broadcast("who")
senderId, message, distance = rednet.receive(5)
if (message == "server") then
keepRunning = false
end
end
I’m sure it’s because of this loop but I not sure why :S

The reason for the space between y and the explodechar is that i had a lot of problems with splitting the string when the messages was received from rednet.
I guess its this line you talking about (from client): rednet.send(senderId,"add " .. explodeChar .. " " .. y .. explodeChar .. computerID .. explodeChar .. n)
At start the line looked like: rednet.send(senderId,"add " .. y .. explodeChar .. computerID .. explodeChar .. n)
but i couldn’t split the string, and thought that it was because the char was different when it was received from rednet (the explode char was # at start)
So i changed the line so the client could tell the server about what char the server need to split the string with :)/> - But that didn’t work with # so i went back to your code to see how you did it :D/>
But now I’m keeping it this way so the explode char can be different on server and client :)/>

What is the limit of floors? Is the limit based on the distance from each other when using wireless – Haven’t thought about multiplayer, thanks for remind me :/
Think I’m going to handle this with just add an option to auto detect or manual input of server ID, and turn off the auto detect on the server, so it won’t respond or new clients

The reason I created server/client setup is that I love to have only one that handle all communication and knowledge of the whole setup.
If the distance is becoming a problem I will make a gateway that only is used for forwarding the messages.

That’s sounds really cool, I’m looking forward to see your code for that :)/> your code for this project looks really nice and complicated, what is your experience with lua and other languages?

I have been programming in C# in about 12 years now I think, and been working as a developer in about 6 years now, but also got knowledge about C++, java, PHP, python and now very little about lua :D/>
OminousPenguin #105
Posted 18 September 2013 - 06:34 AM
hmm and some way to remember the settings even when you logout of the server and back again, how do you handle that?

Save it in a file. See the timer event where timerID == newFloorTimer

But I got one problem, if I turn on 4 clients and not the server, the whole computercraft are getting slow :S

Client code:
local keepRunning = true;
while (keepRunning) do
rednet.broadcast("who")
senderId, message, distance = rednet.receive(5)
if (message == "server") then
keepRunning = false
end
end
I’m sure it’s because of this loop but I not sure why :S

You've been programming 12 years and can't spot an infinite loop?
The loop stops when it receives a response from the server.. if there's no server then it's never going to stop.
Also if you have more than two clients, there's a queue of modem events getting bigger and bigger which probably doesn't help. (Events are put into a queue.)

The reason for the space between y and the explodechar is that i had a lot of problems with splitting the string when the messages was received from rednet.
I guess its this line you talking about (from client): rednet.send(senderId,"add " .. explodeChar .. " " .. y .. explodeChar .. computerID .. explodeChar .. n)
At start the line looked like: rednet.send(senderId,"add " .. y .. explodeChar .. computerID .. explodeChar .. n)
but i couldn’t split the string, and thought that it was because the char was different when it was received from rednet (the explode char was # at start)
So i changed the line so the client could tell the server about what char the server need to split the string with :)/> - But that didn’t work with # so i went back to your code to see how you did it :D/>
But now I’m keeping it this way so the explode char can be different on server and client :)/>

The problem you had was that y is a number which got appended to the \31 character code. Character codes can be 3 digits long so if y=5 then the character code becomes \315. - Your explode character is now different and you've lost the y value. If you replace \31 with \031 then that 3 digit code is never going to get messed up. If the string is \0315, only the 3 digits after the \ will get taken as the character code.

What is the limit of floors? Is the limit based on the distance from each other when using wireless

Wireless modems have a range limit that varies with height and weather. - Greatest range at top of the world in clear weather, lowest at the bottom in a storm. This doesnt really make sense as if you're well underground you'll be insulated from the storm.

That’s sounds really cool, I’m looking forward to see your code for that :)/> your code for this project looks really nice and complicated, what is your experience with lua and other languages?

I have been programming in C# in about 12 years now I think, and been working as a developer in about 6 years now, but also got knowledge about C++, java, PHP, python and now very little about lua :D/>

Nice and complicated? ha. I've actually tidied it up a bit for this next release.
I started teaching myself PHP and Javascript at school about 8 years ago. Last summer I graduated from uni with a degree in software engineering, but didn't really learn anything I didn't already know about programming or could have taught myself in an afternoon.

This was my first encounter with Lua but I quite like it. It's simple but meta tables make it pretty powerful.
noxiaz #106
Posted 18 September 2013 - 10:08 AM
You've been programming 12 years and can't spot an infinite loop?
The loop stops when it receives a response from the server.. if there's no server then it's never going to stop.
Also if you have more than two clients, there's a queue of modem events getting bigger and bigger which probably doesn't help. (Events are put into a queue.)
As I said from start, I have no idea how lua perform J - It’s an infinite loop but with a “sleep” of 5 seconds because of the event. So this would not create any issues in any other languages I know about. And thought that each computer was running its own thread so it shouldn’t impact each other, because the code is default hosted by the client and not server (as I have understood it)
The problem you had was that y is a number which got appended to the \31 character code. Character codes can be 3 digits long so if y=5 then the character code becomes \315. - Your explode character is now different and you've lost the y value. If you replace \31 with \031 then that 3 digit code is never going to get messed up. If the string is \0315, only the 3 digits after the \ will get taken as the character code.
Ahh okay, didn’t know about that :D/> – Thanks for telling me.
Wireless modems have a range limit that varies with height and weather. - Greatest range at top of the world in clear weather, lowest at the bottom in a storm. This doesnt really make sense as if you're well underground you'll be insulated from the storm.
Is it possible to get the range limit ? I guess this can be different from each server?

Nice and complicated? ha. I've actually tidied it up a bit for this next release.
It’s your handler I think looks so complicated, but I haven’t put much time in learning lua at all J
This part:
handlers = {
modem_message =
function (_, sChannel, sReplyChannel, sMessage, nDistance)
..
while true do
handlers:handle(os.pullEvent())
end

It looks really nice, but when I have no idea how it works it looks pretty complicated :D/>

I’m not sure I like Lua, but its smart that it is so easy to implement into programs, so your users are able to use scripts in games like minecraft but I don’t like the syntax in Lua it’s like VS and that’s crap if you ask me :D/>
OminousPenguin #107
Posted 18 September 2013 - 10:45 AM
You've been programming 12 years and can't spot an infinite loop?
The loop stops when it receives a response from the server.. if there's no server then it's never going to stop.
Also if you have more than two clients, there's a queue of modem events getting bigger and bigger which probably doesn't help. (Events are put into a queue.)
As I said from start, I have no idea how lua perform J - It’s an infinite loop but with a “sleep” of 5 seconds because of the event. So this would not create any issues in any other languages I know about. And thought that each computer was running its own thread so it shouldn’t impact each other, because the code is default hosted by the client and not server (as I have understood it)
It's a timeout, not a sleep. If there has been no modem_message event for 5 seconds, rednet.receive(5) would return false.

Wireless modems have a range limit that varies with height and weather. - Greatest range at top of the world in clear weather, lowest at the bottom in a storm. This doesnt really make sense as if you're well underground you'll be insulated from the storm.
Is it possible to get the range limit ? I guess this can be different from each server?
Yes. You can set it in ComputerCraft.cfg which is in .minecraft/config

Nice and complicated? ha. I've actually tidied it up a bit for this next release.
It’s your handler I think looks so complicated, but I haven’t put much time in learning lua at all J
This part:
handlers = {
modem_message =
function (_, sChannel, sReplyChannel, sMessage, nDistance)
..
while true do
handlers:handle(os.pullEvent())
end

It looks really nice, but when I have no idea how it works it looks pretty complicated :D/>

handle is a function in the table 'handlers'. We know its a function so we can whack some parentheses on it and call it straight from there. The colon passes a variable 'self' to the handle function which is a reference to the handlers table.
We could instead write handlers["handle"](handlers, os.pullEvent())

Knowing this I expect you can look at the handle function and see what's going on.

I’m not sure I like Lua, but its smart that it is so easy to implement into programs, so your users are able to use scripts in games like minecraft but I don’t like the syntax in Lua it’s like VS and that’s crap if you ask me :D/>
What do you mean by "it’s like VS"? I saw VS and thought Visual Studio but that doesn't make sense in the context.
noxiaz #108
Posted 18 September 2013 - 11:36 AM
Yes. You can set it in ComputerCraft.cfg which is in .minecraft/config

Is it possible to get inside the game with a method ? :)/> – The reason I ask is that it would be awesome to tell the user that it can only be like 62 blocks away from the server before needing a gateway

handle is a function in the table 'handlers'. We know its a function so we can whack some parentheses on it and call it straight from there. The colon passes a variable 'self' to the handle function which is a reference to the handlers table.
We could instead write handlers["handle"](handlers, os.pullEvent())

Knowing this I expect you can look at the handle function and see what's going on.

That was a pretty smart way to do it, think I’m going to look a little more into that, but not sure if I will use it :)/>

What do you mean by "it’s like VS"? I saw VS and thought Visual Studio but that doesn't make sense in the context.


Ohh sorry misspell, it was VB I was referring to :)/>
OminousPenguin #109
Posted 18 September 2013 - 11:59 AM
Is it possible to get inside the game with a method ? :)/> – The reason I ask is that it would be awesome to tell the user that it can only be like 62 blocks away from the server before needing a gateway
I don't think so. It would be very useful so if you find that it is possible please let me know!

Ohh sorry misspell, it was VB I was referring to :)/>
The only similarity I can see is that blocks are closed with 'end' instead of curly braces…
noxiaz #110
Posted 18 September 2013 - 12:27 PM
I don't think so. It would be very useful so if you find that it is possible please let me know!

I will let you know if i find away to do it :D/>

The only similarity I can see is that blocks are closed with 'end' instead of curly braces…

The if statements are nearly wrote at the same way, your variables are typeless and you don’t need to end your lines with ; - There are ofc a lot of difference syntax with the 2 languages, but lua still reminds me of VB :D/>
OminousPenguin #111
Posted 18 September 2013 - 01:03 PM
The if statements are nearly wrote at the same way, your variables are typeless and you don’t need to end your lines with ; - There are ofc a lot of difference syntax with the 2 languages, but lua still reminds me of VB :D/>
The last time I used VB(6) was 7 years ago and I probably wrote a total of a hundred or so lines… so my memory is a little fuzzy :P/>

I'll probably be posting the update tonight btw.
Git #112
Posted 18 September 2013 - 04:09 PM
I'll probably be posting the update tonight btw.

Remember this guy? :D/>
OminousPenguin #113
Posted 18 September 2013 - 05:12 PM
Update 2.1.0b -> 2.2.0b
  • Added support for multiple elevators in close proximity to eachother
  • Made update process much simpler (Sorry, you'll still have to install this update the old fashioned way)
  • Many miscellaneous changes… paving the way for better things to come.
To update:
  1. Hold Ctrl+T to terminate the elevator program and return to a prompt
  2. Delete setup.lua and elevator-main.lua. eg > rm elevator-main.lua
  3. Run this: pastebin get VYwxa3su setup.lua
  4. Run setup.lua
  5. Follow the instructions
Elevator ID can be anything. Examples: Elev1, I love elevators, North Shaft

Please report any bugs.
Git #114
Posted 18 September 2013 - 08:58 PM
One slight issue it appears… I got this right after reboot.

OminousPenguin #115
Posted 19 September 2013 - 05:06 AM
Ah that bug. I got that intermittently and then it went away.

It's failing to overwrite the elevator.cfg file so if you just delete that first, it should work.

I've just changed setup.lua to delete it before writing.
OminousPenguin #116
Posted 23 September 2013 - 10:50 AM
How are you finding the update?

Any other problems?
Git #117
Posted 23 September 2013 - 06:59 PM
I just got my first elevator working with a bit of editing. I'm using different wire colors (red, white, and blue), so I had to change the assigned colors in the main script. Everything is working GREAT! The only issue I maybe foresee is the possibility of a future update changing the wire colors back to stock..? I assume as part of the update process, you download a new main cfg? If this is the case, it may give me issues later… but I'm very happy as of now, thanks for the hard work penguin.

-Git ;)/>
BobJames #118
Posted 02 November 2013 - 09:00 PM
Great mod OminousPenguin but I am having the hardest time trying to get my elevator system setup. I have five floor in my base, I have everything in terms of rails, dectors, computer, wireless modems and cables setup correctly including the color for the cables. I get the software installed on each of the computers, however they all say "No other floors discovered, Once the elevator program is started on other floors, they will appear here." What is odd is as I am setting up the second thru fifth floors I can see the list of the other floor the programs detects so I don't know why it can't detect them once the programs is done and I am trying to use the elevator. I don't know how to use the GPS tool since my 'Z' coordinate is -3805 for example and the programs only seems let me type in 4 charactors in that field.

Any tips on what I might be doing wrong would be most appreciated.
BobJames #119
Posted 03 November 2013 - 08:48 AM
Great mod OminousPenguin but I am having the hardest time trying to get my elevator system setup. I have five floor in my base, I have everything in terms of rails, dectors, computer, wireless modems and cables setup correctly including the color for the cables. I get the software installed on each of the computers, however they all say "No other floors discovered, Once the elevator program is started on other floors, they will appear here." What is odd is as I am setting up the second thru fifth floors I can see the list of the other floor the programs detects so I don't know why it can't detect them once the programs is done and I am trying to use the elevator. I don't know how to use the GPS tool since my 'Z' coordinate is -3805 for example and the programs only seems let me type in 4 charactors in that field.

Any tips on what I might be doing wrong would be most appreciated.

One more thing to add, I recieved the follow error also when I was trying to get the elevator system to work:
http://i.imgur.com/NbDoyXC.png
I don't see the error everytime, but I have seen it a few times.
OminousPenguin #120
Posted 03 November 2013 - 05:28 PM
Sounds like you are confusing elevators with floors. You can specify different elevator IDs so that you can have multiple elevators near eachother without them interfering.

1. The first computer you set up will say No existing elevators detected so you specify an ID for the elevator eg Home Elevator - This is the ID for the whole elevator shaft, not the floor.
2. Then you specify a name for that floor, eg Store Room

3. The second computer you set up will show The following elevator IDs were detected: Home Elevator - You want to add another floor to this elevator so you select it and press enter.
4. Then you specify a name for that floor, eg Machine Room

Now you have 1 elevator with 2 floors.

If at step 3 you make a new elevator, then they will just say No other floor discovered because it only discovers other floors with the same elevator ID.

Sorry about the 4 character limit, I've changed it to 6: http://pastebin.com/VYwxa3su

Regarding that error, the line it references is:
modem.open(os.getComputerID())
os.getComputerID() is a standard function and if modem wasnt defined, you'd have got an error way earlier in the program. So I have no idea why you're getting that error. Sorry.
OminousPenguin #121
Posted 03 January 2014 - 07:44 PM
Hi guys.
I've made some changes to the setup program and made a video demonstrating the build with Rednet cable instead of RP2 wire.

[media]http://www.youtube.com/watch?v=OiMmMBS5e_s[/media]
sjkeegs #122
Posted 09 January 2014 - 09:42 PM
Nice, glad to see the update. I'm going to have to use this at some point.
roadkill613 #123
Posted 19 January 2014 - 03:51 PM
what versions of computercraft and rail craft is this updated for?

im using railcraft 8.3.2.0
and computercraft 1.58
Edited on 19 January 2014 - 02:52 PM
OminousPenguin #124
Posted 20 January 2014 - 05:40 AM
There is no change to version compatibility.
The program is compatible with all versions of ComputerCraft since 1.5 and all versions of railcraft since 3.3.. (I haven't tested this but I can't see anything that should cause incompatibility)
roadkill613 #125
Posted 21 January 2014 - 02:34 PM
i am getting an IO:77: index expected, got nil

i am assuming it has to do with reading the config file but i dont know how to find the error and fix it.
OminousPenguin #126
Posted 21 January 2014 - 09:17 PM
I've tested it on those versions and it's working here.

At what point does this error appear?
When you run the setup? When the computer restarts after the setup? Please be as specific as possible.

Thanks.
Edited on 21 January 2014 - 08:26 PM
roadkill613 #127
Posted 22 January 2014 - 01:20 PM
it makes it through the setup just fine and then reboots. but when the computer reloads the elevator-main.lua side of the program is when it errors.


i ill try to delete everything and run it again and see if maybe i screwed up something..lol
Edited on 22 January 2014 - 12:21 PM
travinns #128
Posted 05 February 2015 - 08:54 PM
I am reviving this old threat because I think this program is amazing! If it works.. I build the entire elevator shaft in my base and got the programs running (the floors detect each other and everything) but when I select a floor to go to it says: "Bon voyage" and nothing happens, the cart just stands still. I guess this is because there have been some changes to RedNet cable and the boarding track has been replaced with the locking track which has a boarding track mode. If anybody could help me get this program to run that would be great!
Cranium #129
Posted 05 February 2015 - 09:10 PM
I am reviving this old threat because I think this program is amazing! If it works.. I build the entire elevator shaft in my base and got the programs running (the floors detect each other and everything) but when I select a floor to go to it says: "Bon voyage" and nothing happens, the cart just stands still. I guess this is because there have been some changes to RedNet cable and the boarding track has been replaced with the locking track which has a boarding track mode. If anybody could help me get this program to run that would be great!
MineFactory Reloaded does not support the ComputerCraft RedNet Cable API since it was updated. We've gotten word that future support is not forthecoming either.
travinns #130
Posted 05 February 2015 - 09:13 PM
I am reviving this old threat because I think this program is amazing! If it works.. I build the entire elevator shaft in my base and got the programs running (the floors detect each other and everything) but when I select a floor to go to it says: "Bon voyage" and nothing happens, the cart just stands still. I guess this is because there have been some changes to RedNet cable and the boarding track has been replaced with the locking track which has a boarding track mode. If anybody could help me get this program to run that would be great!
MineFactory Reloaded does not support the ComputerCraft RedNet Cable API since it was updated. We've gotten word that future support is not forthecoming either.

Thank you for the fast reply!, but that is terrible news… Any workaround?
Bomb Bloke #131
Posted 05 February 2015 - 09:38 PM
That said
travinns #132
Posted 05 February 2015 - 10:48 PM

I read the thread, what are you suggesting?
Bomb Bloke #133
Posted 05 February 2015 - 11:51 PM
I'm "suggesting" that there's at least some options for using bundled cables under later versions of ComputerCraft. Beats me which ones apply to you.
travinns #134
Posted 05 February 2015 - 11:54 PM

Also I read you comment on that thread about the support comming back for version 1.7.10? I am playing on minecraft 1.7.10 with computercraft 1.65 Are you saying there is a version of MFR out that supports CC?
Bomb Bloke #135
Posted 06 February 2015 - 03:31 AM
No, I'm saying that HPWebcamAble is saying that. Whether he's right or not I dunno, but even if he's not, it looks like certain versions of Project Red or Ender IO offer cables that should do the job.

Basically, anything that offers different "colours" of redstone in one cable should work - so long as the mod it comes from supports CC's bundled cable API.
travinns #136
Posted 06 February 2015 - 11:43 AM
No, I'm saying that HPWebcamAble is saying that. Whether he's right or not I dunno, but even if he's not, it looks like certain versions of Project Red or Ender IO offer cables that should do the job.

Basically, anything that offers different "colours" of redstone in one cable should work - so long as the mod it comes from supports CC's bundled cable API.

Hmm, Im afraid he is wrong then, Since I am on a newer version of MFR then the one he states and it isn't working. I'll look into Ender IO then
THC_Butterz #137
Posted 26 February 2015 - 10:50 PM
he updated it today to work with project red bundled cables, and extra peripherals bundled connector for 1.6.4 +,
OminousPenguin #138
Posted 27 February 2015 - 01:22 AM
Indeed I have.
Huge thanks to THC_Butterz/Jonnathon Clayton for identifying Project Red and Extra Peripherals as a replacement for Rednet Cables and even more thanks to him for testing the new version of the elevator program for me.

New version: 2.3.1
Pastebin code is still the same: VYwxa3su

Required mods:
Railcraft: http://www.railcraft.info/releases/
Project Red: http://www.9minecraft.net/project-red-mod/ (Core + Transmission parts)
Extra Peripherals: http://www.computercraft.info/forums2/index.php?/topic/20634-mc-1710cc-164-extra-peripherals/

See Jonnathon Clayton's video for how to set up the bundled calbes here: https://www.youtube.com/watch?v=S-FkfutDp9E

Altenatively see my wiring in this video https://www.youtube.com/watch?v=KuvnpW-fmxg&t=247