Updated Basalt (markdown)

Robert Jelic
2022-04-19 20:16:47 +02:00
parent e37bb22751
commit aae0ca1d5a

@@ -96,29 +96,32 @@ This is a visual version, it asks the user if he wants to install basalt.lua (if
![](https://i.imgur.com/b4Ys7FB.png) ![](https://i.imgur.com/b4Ys7FB.png)
````lua ````lua
--Basalt configurated installer --Basalt configurated installer
--Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then if not(fs.exists(filePath))then
local w,h = term.getSize() local w,h = term.getSize()
term.clear() term.clear()
local _installerWindow = window.create(term.current(),w/2-7,h/2-3,16,6) local _installerWindow = window.create(term.current(),w/2-8,h/2-3,18,6)
_installerWindow.setBackgroundColor(colors.blue) _installerWindow.setBackgroundColor(colors.gray)
_installerWindow.write("Basalt Installer ") _installerWindow.setTextColor(colors.black)
_installerWindow.write(" Basalt Installer ")
_installerWindow.setBackgroundColor(colors.lightGray) _installerWindow.setBackgroundColor(colors.lightGray)
for line=2,6,1 do for line=2,6,1 do
_installerWindow.setCursorPos(1,line) _installerWindow.setCursorPos(1,line)
if(line==3)then if(line==3)then
_installerWindow.write("No Basalt found! ") _installerWindow.write(" No Basalt found! ")
elseif(line==4)then elseif(line==4)then
_installerWindow.write("Install it? ") _installerWindow.write(" Install it? ")
elseif(line==6)then elseif(line==6)then
_installerWindow.setBackgroundColor(colors.green) _installerWindow.setTextColor(colors.black)
_installerWindow.write("yes") _installerWindow.setBackgroundColor(colors.gray)
_installerWindow.write("Install")
_installerWindow.setBackgroundColor(colors.lightGray) _installerWindow.setBackgroundColor(colors.lightGray)
_installerWindow.write(string.rep(" ",11)) _installerWindow.write(string.rep(" ",5))
_installerWindow.setBackgroundColor(colors.red) _installerWindow.setBackgroundColor(colors.red)
_installerWindow.write("no") _installerWindow.write("Cancel")
else else
_installerWindow.write(string.rep(" ",16)) _installerWindow.write(string.rep(" ",18))
end end
end end
_installerWindow.setVisible(true) _installerWindow.setVisible(true)
@@ -126,14 +129,17 @@ if not(fs.exists(filePath))then
while(not(fs.exists(filePath))) do while(not(fs.exists(filePath))) do
local event, p1,p2,p3,p4 = os.pullEvent() local event, p1,p2,p3,p4 = os.pullEvent()
if(event=="mouse_click")then if(event=="mouse_click")then
if(p3==math.floor(h/2+2))and(p2>=w/2-7)and(p2<=w/2-5)then if(p3==math.floor(h/2+2))and(p2>=w/2-8)and(p2<=w/2-2)then
shell.run("wget https://raw.githubusercontent.com/NoryiE/Basalt/master/basalt.lua "..filePath) shell.run("wget https://raw.githubusercontent.com/NoryiE/Basalt/master/basalt.lua "..filePath)
_installerWindow.setVisible(false) _installerWindow.setVisible(false)
term.clear() term.clear()
break break
end end
if(p3==h/2+2)and(p2<=w/2+7)and(p2>=w/2+5)then if(p3==h/2+2)and(p2<=w/2+9)and(p2>=w/2+4)then
_installerWindow.clear()
_installerWindow.setVisible(false) _installerWindow.setVisible(false)
term.setCursorPos(1,1)
term.clear()
return return
end end
end end