Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("btn")
- modemSide = "top"
- useSplash = false
- brewerID = 82
- rednet.open(modemSide)
- --function that draws all the buff potions
- local function buffs()
- btn.deActivateAllDraw()
- btn.activateDraw("strength")
- btn.activateDraw("speed")
- btn.activateDraw("fireResist")
- btn.activateDraw("healing")
- btn.activateDraw("nightVision")
- btn.activateDraw("invisible")
- btn.activateDraw("regen")
- btn.activateDraw("back")
- btn.changeText("back","Back")
- btn.changePos("back",1,7,17,19)
- term.clear()
- btn.createScreen("Buff Potions", colors.white)
- backTo = "main"
- end
- -- function that activates all offensive potions
- local function offensive()
- btn.deActivateAllDraw()
- btn.activateDraw("slowness")
- btn.activateDraw("poison")
- btn.activateDraw("harming")
- btn.activateDraw("weakness")
- btn.activateDraw("back")
- btn.changeText("back","Back")
- btn.changePos("back",1,7,17,19)
- term.clear()
- btn.createScreen("Offensive Potions", colors.white)
- backTo = "main"
- end
- --function that draws the main menu
- local function mainMenu()
- btn.deActivateAllDraw()
- btn.activateDraw("buffs")
- btn.activateDraw("offensive")
- term.clear()
- btn.createScreen("Select a Category",colors.white)
- end
- --function called when the back button is pressed
- local function back()
- if backTo == "main" then
- mainMenu()
- elseif backTo == "offensive" then
- offensive()
- btn.deActivate("splash")
- useSplash = false
- btn.changePos("iDur",12,40,8,12)
- btn.changePos("norm",12,40,14,18)
- btn.changePos("iPotency",12,40,2,6)
- btn.changeText("back","Back")
- btn.changePos("back",1,7,17,19)
- elseif backTo == "buffs" then
- buffs()
- btn.deActivate("splash")
- useSplash = false
- btn.changePos("iDur",12,40,8,12)
- btn.changePos("norm",12,40,14,18)
- btn.changePos("iPotency",12,40,2,6)
- end
- btn.changeText("back","Back")
- end
- --function called when splash button is pressed
- local function splash()
- useSplash = not useSplash
- btn.toggle("splash")
- end
- --function called when a potion button is pressed
- local function potion(name)
- btn.deActivateAllDraw()
- color = btn.getColor(name)
- potionName = btn.getText(name)
- btn.changeColor("iPotency",color)
- btn.changeColor("iDur",color)
- btn.changeColor("norm",color)
- if name == "speed" or name == "poison" or name == "strength" or name == "regen" then
- btn.activateDraw("iPotency")
- else
- btn.changePos("iDur",12,40,3,7)
- btn.changePos("norm",12,40,11,15)
- end
- btn.activateDraw("iDur")
- btn.activateDraw("norm")
- btn.activateDraw("splash")
- btn.activateDraw("back")
- term.clear()
- btn.createScreen("Select Variation of potion",colors.white)
- if name == "slowness" or name == "poison" or name == "harming" or name == "weakness" then
- backTo = "offensive"
- else
- backTo = "buffs"
- end
- end
- local function orderScreen(name)
- btn.deActivateAllDraw()
- term.clear()
- btn.changeText("back"," Cancel")
- btn.changePos("back",1,8,17,19)
- btn.activateDraw("back")
- btn.activateDraw("order")
- if potionName ~= "Fire Resist" and potionName ~= "Healing" then
- if potionName == " Speed" then
- begin = 3
- else
- begin = 2
- end
- nameLength = string.len(potionName)
- potionName = string.sub(potionName,begin,nameLength)
- end
- btn.createScreen("Order Screen",colors.white)
- btn.centerText(5,"Your order:",colors.white)
- btn.centerText(6,"1 Potion of: "..potionName,colors.white)
- if name == "iPotency" then
- iPotency = true
- btn.centerText(7,"With Increased Potency",colors.white)
- elseif name == "iDur" then
- iDur = true
- btn.centerText(7,"With Increased Duration",colors.white)
- end
- if useSplash == true then
- btn.centerText(8,"Splash Potion",colors.white)
- end
- end
- local function progressScreen()
- term.clear()
- time = 7
- btn.centerText(6,"Brewing...",colors.white)
- btn.centerText(7,"Estimated time: "..time, colors.white)
- end
- local function order(potion, useSplash)
- progressScreen()
- rednet.send(brewerID, potion.." "..useSplash)
- end
- --category buttons
- btn.fillTable("buffs",12,40,3,7,"Buff Potions",buffs,colors.red,false)
- btn.fillTable("offensive",12,40,11,15,"Offensive Potions",offensive,colors.green,false)
- --buff potions
- btn.fillTable("strength",8,17,2,6," Strength",potion,colors.purple,false)
- btn.fillTable("speed",34,44,2,6," Speed",potion,colors.lightBlue,false)
- btn.fillTable("fireResist",19,32,2,6,"Fire Resist",potion,colors.orange,false)
- btn.fillTable("healing",8,17,8,12,"Healing",potion,colors.red,false)
- btn.fillTable("nightVision",19,32,8,12," Night Vision",potion,colors.blue,false)
- btn.fillTable("invisible",19,32,14,18," Invisibility",potion,colors.lightGray,false)
- btn.fillTable("regen",34,44,8,12," Regen",potion,colors.magenta,false)
- --offensive potions
- btn.fillTable("slowness",19,32,3,7," Slowness",potion,colors.lightGray,false)
- btn.fillTable("poison",8,17,3,7," Poison",potion,colors.green,false)
- btn.fillTable("harming",34,44,3,7," Harming",potion,colors.purple,false)
- btn.fillTable("weakness",19,32,9,13," Weakness",potion,colors.gray,false)
- --variation buttons
- btn.fillTable("iPotency", 12,40,2,6,"Increased Potency",orderScreen,color,false)
- btn.fillTable("iDur", 12,40,8,12,"Increased Duration",orderScreen,color,false)
- btn.fillTable("norm",12,40,14,18,"Normal Potion",orderScreen,color,false)
- btn.fillTable("splash",1,8,1,3,"Splash",splash,nil,false)
- --misc buttons
- btn.fillTable("back",1,7,17,19," Back",back,colors.red,false)
- btn.fillTable("order",44,51,17,19," Order",order,colors.red,false)
- mainMenu()
- while true do
- event, button, x, y = os.pullEvent("mouse_click")
- btn.checkClick(x,y)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement