SOLVED Seeking something like .getTag()

Need help with your script? Want to know how to do something? Want to post an example? Post it here!

SOLVED Seeking something like .getTag()

Postby CyricV » Sat Mar 12, 2016 8:44 am

FOUND THE SOLUTION!

I'm making a recipe for EnderIO capacitor banks. They store their stored RF value in the tag storedEnergyRF. Here is the code I have presently, with the missing piece indicated.
: [Select all] [/] [] (tellura_enderio.zs)
  1. # Capacitor Bank
  2. recipes.remove(capacitorBank);
  3. recipes.addShaped(capacitorBank, [
  4.     [steelIngot,            doubleLayerCapacitor,               steelIngot],
  5.     [doubleLayerCapacitor,  capacitorBankBasic.marked("inp"),   doubleLayerCapacitor],
  6.     [steelIngot,            doubleLayerCapacitor,               steelIngot]],
  7.     function(output, inputs, crafting) {
  8.         return output.withTag({type: "ACTIVATED", storedEnergyRF: inputs.inp.....WHAT GOES HERE....});
  9.     }
  10. );
  11.  
GeSHi © Codebox Plus


Something along the lines of
: [Select all] [/] [] ()
  1. inputs.inp.getTag("storedEnergyRF") as int
  2.  
GeSHi © Codebox Plus

would be absolutely perfect, but I don't know what the syntax is or it it exists.
I'm also open to alternate ways of implementing this code and completely scrapping this bit if it's not possible.
Last edited by CyricV on Sun Mar 13, 2016 9:52 am, edited 1 time in total.
CyricV
 
Posts: 9
Joined: Sun Jan 31, 2016 12:23 am

Re: Seeking something like .getTag()

Postby CyricV » Sun Mar 13, 2016 4:28 am

Here is the code that does the trick!
: [Select all] [/] [] ()
  1. # Capacitor Bank
  2. recipes.remove(capacitorBank);
  3. recipes.addShaped(capacitorBank, [
  4.     [steelIngot,            doubleLayerCapacitor,               steelIngot],
  5.     [doubleLayerCapacitor,  capacitorBankBasic.marked("inp"),   doubleLayerCapacitor],
  6.     [steelIngot,            doubleLayerCapacitor,               steelIngot]],
  7.     function(output, inputs, crafting) {
  8.         return output.withTag({type: "ACTIVATED", storedEnergyRF: inputs.inp.tag.storedEnergyRF});
  9.     }
  10. );
  11.  
GeSHi © Codebox Plus


This was tough for me to figure out but the kind folks over at ConfigTheUniverse really helped me out! I basically just kept throwing things until I got useful error messages. Then I compared it with the stuff on the Minetweaker GitHub. This was a satisfying issue to solve!
CyricV
 
Posts: 9
Joined: Sun Jan 31, 2016 12:23 am

Re: SOLVED Seeking something like .getTag()

Postby puheruw » Fri Nov 08, 2019 11:30 am

i love thisa blog.
thank you
In this site you can came across with the program that provokes more about it. Hence you can save paperfellows reviews that are known in all the essential places for giving the people known ways to deal with them influentially.
puheruw
 
Posts: 1
Joined: Fri Nov 08, 2019 11:21 am


Return to Scripting Help

Who is online

Users browsing this forum: MSN [Bot] and 2 guests