Hello, I have recently been getting into programming. Im decently new to all programming language such as lua, but I do have a base knowledge of it. So here is my situation : I have an MFR spawner that spawns villager so I can kill them. But I want to regulate there numbers by reading the amount of LP in the Altar. Basically the only thing I need to know is, how can I read the amount of LP in an Altar? I am not asking for a full program I just want to know that.
Thanks!
TormDemoniax
9 replies to this topic
#1
Posted 27 April 2015 - 11:00 PM
#2
Posted 27 April 2015 - 11:51 PM
Moved to Ask A Pro
#3
Posted 28 April 2015 - 12:04 AM
If the altar is a peripheral, you can wrap it like a monitor or printer
You can check with this program I wrote:
http://pastebin.com/sKLqTGrM
Stick a computer next to the altar, then download and run the program
To download as 'gm'
Then run it, with the altar's side as an argument:
You can check with this program I wrote:
http://pastebin.com/sKLqTGrM
Stick a computer next to the altar, then download and run the program
To download as 'gm'
pastebin get sKLqTGrM gm
Then run it, with the altar's side as an argument:
gm <side>
#4
Posted 28 April 2015 - 10:17 PM
Thank you so much for the fast answer. I will sure be looking to that soon
#5
Posted 28 April 2015 - 10:32 PM
I'm pretty sure with openPeripherals you can wrap the altar and use .getTankInfo to get the amount of LP currently in it. so something like this:
local altar = peripheral.wrap('top') --or whatever side it is on
local tankData = altar.getTankInfo()
I believe that a blood altar has two tanks so to see that main tank amount it will be in tankData[1].amount
Again i'm not 100% sure about this but I know with openPeripherals it can be wrapped and you can read the amount of LP in it.
local altar = peripheral.wrap('top') --or whatever side it is on
local tankData = altar.getTankInfo()
I believe that a blood altar has two tanks so to see that main tank amount it will be in tankData[1].amount
Again i'm not 100% sure about this but I know with openPeripherals it can be wrapped and you can read the amount of LP in it.
#6
Posted 29 April 2015 - 12:30 AM
Well, I tried it but when I do getTankInfo in a program it returns me a function for example my ansmer for my program is function: 66857750
Here is my program :
Altar = peripheral.wrap("back")
Stored = altar.getTankInfo
Print (stored)
Here is my program :
Altar = peripheral.wrap("back")
Stored = altar.getTankInfo
Print (stored)
#7
Posted 29 April 2015 - 12:32 AM
Derpie me, I forgot to add the () after the tankinfo
But now, it returns me a table!
But now, it returns me a table!
#9
Posted 29 April 2015 - 08:57 PM
Now im getting as a answer : 1table: 567ad2b0
But the numbers and letters always change
But the numbers and letters always change
#10
Posted 29 April 2015 - 09:33 PM
Finally found the solution
Here is my program
http://pastebin.com/QSDqG1SX
Thank you to everyone who helped me!
Here is my program
http://pastebin.com/QSDqG1SX
Thank you to everyone who helped me!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












