Loop error: Accessing value from unitialized register

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

Loop error: Accessing value from unitialized register

Postby spacechase0 » Fri Mar 27, 2015 3:00 am

So I was trying to write a script to replace an old mod I had, this time using the Unbreakable NBT tag... And this is what I get when I run /mt reload:

: [Select all] [/] [] ()
ERROR: Error executing everlasting_tools.zs: (class: ZenClass0, method: process signature: (Lminetweaker/api/item/IItemStack;Ljava/util/Map;Lminetweaker/api/recipes/ICraftingInfo;)Lminetweaker/api/item/IItemStack;) Accessing value from uninitialized register 5
java.lang.VerifyError: (class: ZenClass0, method: process signature: (Lminetweaker/api/item/IItemStack;Ljava/util/Map;Lminetweaker/api/recipes/ICraftingInfo;)Lminetweaker/api/item/IItemStack;) Accessing value from uninitialized register 5
   at Everlasting_tools.__script__(everlasting_tools.zs:62)
   at __ZenMain__.run(everlasting_tools.zs)
   at minetweaker.runtime.MTTweaker.load(MTTweaker.java:157)
   at minetweaker.MineTweakerImplementationAPI.reload(MineTweakerImplementationAPI.java:624)
   at minetweaker.MineTweakerImplementationAPI$1.execute(MineTweakerImplementationAPI.java:82)
   at minetweaker.MineTweakerImplementationAPI$19.execute(MineTweakerImplementationAPI.java:610)
   at minetweaker.mc1710.server.MCServer$MCCommand.func_71515_b(MCServer.java:124)
   at net.minecraft.command.CommandHandler.func_71556_a(CommandHandler.java:94)
   at net.minecraft.network.NetHandlerPlayServer.func_147361_d(NetHandlerPlayServer.java:739)
   at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer.java:718)
   at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFile:37)
   at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFile:9)
   at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212)
   at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165)
   at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659)
   at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547)
   at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:111)
   at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427)
   at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685)
GeSHi © Codebox Plus

The same error appears when logging into a world after restarting, but with a longer stack trace. :P

The script file is here. Is this a problem with my script, or a bug?

EDIT: I should probably mention I'm using 3.0.9C, in 1.7.10.
spacechase0
 
Posts: 4
Joined: Fri Mar 27, 2015 2:41 am

Re: Loop error: Accessing value from unitialized register

Postby Timeslice » Sun Mar 29, 2015 6:10 am

I think that the way that statement (line 76) is parsed is causing you to try to update a register that doesn't exist yet (i.e. the item that you're returning). As in, you're creating a new item with the same values of the input item, and then trying to update an NBT tag that doesn't exist yet. I'm just making an educated guess however.

Try this line instead, and let me know if that works:
return inputs.tool.withTag(tag);
Timeslice
 
Posts: 24
Joined: Fri Mar 27, 2015 4:51 am

Re: Loop error: Accessing value from unitialized register

Postby Timeslice » Sun Mar 29, 2015 6:17 am

Also I'm pretty sure your for loop should look like this:
for tool in tools
Timeslice
 
Posts: 24
Joined: Fri Mar 27, 2015 4:51 am

Re: Loop error: Accessing value from unitialized register

Postby spacechase0 » Sun Mar 29, 2015 11:06 pm

Neither of those changes fixed it. I tried using a couple of temporary variables, and the error just moved to register 7 instead.
spacechase0
 
Posts: 4
Joined: Fri Mar 27, 2015 2:41 am

Re: Loop error: Accessing value from unitialized register

Postby Timeslice » Tue Mar 31, 2015 5:29 am

It's looking more and more like an internal issue. Hopefully StanH can shed some light on it.
In the mean time, try just doing this, to see if maybe the issue isn't where we think it is: return output;

*edit* Tell me you got rid of that extra trailing comma on the end of line 57...
Timeslice
 
Posts: 24
Joined: Fri Mar 27, 2015 4:51 am

Re: Loop error: Accessing value from unitialized register

Postby spacechase0 » Tue Mar 31, 2015 2:04 pm

Yes, I tried removing the comma. :P It doesn't change anything.

Changing it to return output; does work. Just return input.tool; works as well, and it also works if I use withDamage() instead of withTag().
spacechase0
 
Posts: 4
Joined: Fri Mar 27, 2015 2:41 am

Re: Loop error: Accessing value from unitialized register

Postby Stan » Wed Apr 01, 2015 6:55 am

This is a bug (actually an unfinished feature). I hope to have it all fixed in 3.0.10 . You can't yet access variables outside a function literal, so moving the tag variable inside the function literal should solve the problem.
User avatar
Stan
Site Admin
 
Posts: 258
Joined: Fri Jul 11, 2014 9:04 pm

Re: Loop error: Accessing value from unitialized register

Postby spacechase0 » Wed Apr 01, 2015 2:19 pm

That works perfectly. Thanks! :)
spacechase0
 
Posts: 4
Joined: Fri Mar 27, 2015 2:41 am

Re: Loop error: Accessing value from unitialized register

Postby tafafahup » Fri Nov 08, 2019 8:04 am

thanks
Whenever you are finding any error regarding the different things then you can grab the details to remove it. Finally you can lead towards dissertation writer that is giving you the updates regarding it and removing it.
tafafahup
 
Posts: 1
Joined: Fri Nov 08, 2019 8:02 am


Return to Scripting Help

Who is online

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