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

My Enchanting Program : XP Turtle

Started by TechGuy427, 07 April 2013 - 02:17 AM
TechGuy427 #1
Posted 07 April 2013 - 04:17 AM
This is my program, I'm using the XP Turtle to auto collect XP in a different program, that works but this is my second program for user input to use the XP stored but line i don't know why it dosen't work? help please :/ Very gratefull :)/> thanks alot to any responses :D/> Line 16 crashes ||||| Pastebin : http://pastebin.com/NZsLa53u |||||


[indent=1]function GetLevels()[/indent]
[indent=1]m = peripheral.wrap("left")[/indent]
[indent=1]local Levels = m.getLevels() [/indent]
[indent=1]print("There are "..Levels.." levels stored")[/indent]
[indent=1]end[/indent]

[indent=1]function EnchantFunction()[/indent]
[indent=1]print("Would You like to enchant an item?")[/indent]
[indent=1]local EnchantTrue = "Yes"[/indent]
[indent=1]local input = read()[/indent]
[indent=1]if input == EnchantTrue then[/indent]
[indent=1]print("Place item in slot 1")[/indent]
[indent=1]select(1)[/indent]
[indent=1]print("Enchanting Slot 1 At Which Level?")[/indent]
[indent=1]local EnchantLevel = read()[/indent]
[indent=1]m.Enchant("EnchantLevel")[/indent]
[indent=1]else[/indent]
[indent=1]print("You have not chosen to enchant, restarting")[/indent]
[indent=1]term.clear()[/indent]
[indent=1]term.setCursorPos(1,1)[/indent]
[indent=1]end[/indent]
[indent=1]end[/indent]

[indent=1]GetLevels()[/indent]
[indent=1]EnchantFunction()[/indent]
darkroom #2
Posted 09 April 2013 - 08:29 AM
You put quote arround enchantLevel in the m.enchant function try this
m.enchant(enchantLevel)
TechGuy427 #3
Posted 10 April 2013 - 05:56 AM
You put quote arround enchantLevel in the m.enchant function try this
m.enchant(enchantLevel)

Thanks for quick response and i fixed this just now it is says "getLevels:16: bad argument #1 (Expected Number)"

My new code is https://www.pastebin.com/4ePSa2sn