--Developed by Makerimages
--the internal dialogue box instance
local dialogueBox=nil;
os.loadAPI("/apis/gameutils")
local w,h=term.getSize();
local backGround=gameutils.loadSprite("/graphics/dialogueBack.nfp",math.ceil(w/2),math.ceil(h/2));
--[[ Creates a new, blank dialogue box with the set title and text.
]]--
function createDialogueBox(title,text)
dialogueBox=
{
title=title;
text=text;
}
end
--[[
Creates a new, blank dialogue box that has a loading bar;
]]--
function createDialogueBoxWithLoadBar(title, text)
dialogueBox=
{
title=title;
text=text;
loadingBar=gameutils.gameutils.loadAnimation("/graphics/LoadingBar.nfa",math.ceil(w/2-3),math.ceil(h/2));
}
end
function drawDialogueBox(dialogueBoxToDraw)
gameutils.initializeBuffer()
gameutils.writeToBuffer(backGround)
gameutils.drawBuffer()
term.setTextColor(colors.lightGray)
term.setCursorPos(math.ceil(w/2),math.ceil(h/2-5));
print(dialogueBoxToDraw.title);
term.setCursorPos(math.ceil(w/2),math.ceil(h/2-3));
print(dialogueBoxToDraw.text)
end
the startup code is
--Developed by Makerimages
os.loadAPI("/apis/gameutils");--Load the animation api by NitrogenFingers
os.loadAPI("/apis/dialoguehandler")
term.setTextColor(colors.lightGray)
local topBar=gameutils.loadSprite("/graphics/TopBar.nfp",1,1);--top bar
local w, h=term.getSize();
local loadBar=gameutils.loadAnimation("/graphics/LoadingBar.nfa",math.ceil(w/2-3),math.ceil(h/2));--loading bar
local backGround=gameutils.loadSprite("/graphics/b.nfp",1,1)--background
local dBox=dialoguehandler.createDialogueBox("Booting","OS One is booting...")
local addAccountButton=
{
text="+ Add an account";
x=math.ceil(w/2-5);
y=math.ceil(h/2);
w=16;
h=1;
}
loadBar.currentFrame=1;
gameutils.initializeBuffer();
gameutils.writeToBuffer(backGround)
gameutils.writeToBuffer(topBar);
gameutils.writeToBuffer(loadBar);
gameutils.drawBuffer();
while loadBar.currentFrame<=10 do
loadBar:next();
sleep(0.15)
gameutils.writeToBuffer(loadBar);
gameutils.drawBuffer();
dBox.drawDialogueBox(self);
end
if fs.exists("userData/user1.uData") then
shell.run("/OSCore/loginScreen.lua")
else
gameutils.clearBuffer()
gameutils.writeToBuffer(backGround)
gameutils.writeToBuffer(topBar);
while true do
gameutils.drawBuffer();
term.setCursorPos(1,math.ceil(h/2-5))
print("OS One has identified that you do not have an admininstrative user Account set up yet. Please do so now.")
term.setCursorPos(addAccountButton.x, addAccountButton.y)
write("|")write(addAccountButton.text)write("|")
event, button, x, y = os.pullEvent("mouse_click")
if x >= addAccountButton.x and x <= addAccountButton.x + addAccountButton.w - 1 and
y >= addAccountButton.y and y < addAccountButton.y + addAccountButton.h then
os.reboot()
end
sleep(0.15)
end
end
the line that causes the error startup:39 attempt to index ? (a nil value)
is
dBox.drawDialogueBox(self);