Jump to content




Blood Magc LP in Altar HELP



  • You cannot reply to this topic
9 replies to this topic

#1 TormDemoniax

  • Members
  • 6 posts

Posted 27 April 2015 - 11:00 PM

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

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 27 April 2015 - 11:51 PM

Moved to Ask A Pro

#3 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

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'
pastebin get sKLqTGrM gm

Then run it, with the altar's side as an argument:
gm <side>


#4 TormDemoniax

  • Members
  • 6 posts

Posted 28 April 2015 - 10:17 PM

Thank you so much for the fast answer. I will sure be looking to that soon :D

#5 MagicPwnies

  • New Members
  • 1 posts

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.

#6 TormDemoniax

  • Members
  • 6 posts

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)




#7 TormDemoniax

  • Members
  • 6 posts

Posted 29 April 2015 - 12:32 AM

Derpie me, I forgot to add the () after the tankinfo

But now, it returns me a table!



#8 Inumel

  • Members
  • 120 posts

Posted 29 April 2015 - 05:25 AM

View PostTormDemoniax, on 29 April 2015 - 12:32 AM, said:

Derpie me, I forgot to add the () after the tankinfo

But now, it returns me a table!

Try this.
for k,v in pairs(altar.getTankInfo()) do
   print(k,v)
end


#9 TormDemoniax

  • Members
  • 6 posts

Posted 29 April 2015 - 08:57 PM

Now im getting as a answer : 1table: 567ad2b0

But the numbers and letters always change



#10 TormDemoniax

  • Members
  • 6 posts

Posted 29 April 2015 - 09:33 PM

Finally found the solution :D
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