Updated to Beta V2.0
Screenshots!
Spoiler
No Input:

After Dice Roll:

While Choosing Color:

After Choosing (I Choose Blue In This Pic):


After Dice Roll:

While Choosing Color:

After Choosing (I Choose Blue In This Pic):

The code can be found Here
And here:
Spoiler
--------------------------------------------------
--API Load--
file = fs.exists("themccm")
if file == false then
fs.makeDir("themccm")
end
file = fs.exists("themccm/enderapi")
if file == false then
shell.run("pastebin", "get", "5ww6Pb8i", "themccm/enderapi")
end
os.unloadAPI("themccm/enderapi")
os.loadAPI("themccm/enderapi")
--------------------------------------------------
--Color Loading--
file = fs.exists("themccm/enderdice")
if file == false then
fs.makeDir("themccm/enderdice")
end
file = fs.exists("themccm/enderdice/textcolor")
if file == false then
colorfile = fs.open("themccm/enderdice/textcolor", "w")
colorfile.writeLine("red")
colorfile.close()
end
colorfile = fs.open("themccm/enderdice/textcolor", "r")
textcolor = tostring(colorfile.readLine())
colorfile.close()
--------------------------------------------------
--Functions--
function introPrint()
print[[
Enter 'help' For A List Of Commands
What Dice Do You Want To Roll? -In Numbers-]]
term.write("Roll A d")
end
--------------------------------------------------
--Clear--
enderapi.clear()
--------------------------------------------------
--Visuals--
term.setTextColor(colors.lime)
print[[
--------------------------------------------------]]
term.setTextColor(colors.purple)
print[[
---- ----
/ 20 \ -------------------- / 20 \
\ 20 / /Welcome To EnderDice\ \ 20 /
---- |For Your Dicey Needs| ----
---- \ Made By: theMCcm / ----
/ 10 \ -------------------- / 10 \
\ 10 / \ 10 /
---- Beta V2.0 ----]]
term.setTextColor(colors.lime)
print[[
--------------------------------------------------]]
if colors[textcolor] then
term.setTextColor(colors[textcolor])
end
introPrint()
--------------------------------------------------
--Main Code--
while true do
input = read()
inp = tonumber(input)
if type(inp) == "number" then
if inp < 1 then
term.clearLine()
print("Sorry, But Dice Need To Be Atleast One-Sided!")
elseif inp > 100000000000 then
term.clearLine()
print("That Would Crash The Program! Try A Smaller Number")
else
dice = math.random(input)
term.clearLine()
print("You Rolled A d"..inp.." And Got "..dice)
end
enderapi.lineUp()
enderapi.lineUp()
term.clearLine()
term.write("Roll A d")
else
if input == "exit" or input == "Exit" or input == "E" or input == "e" or input == "EXIT" then
enderapi.clear()
break
elseif input == "help" or input == "h" or input == "Help" or input == "H" or input == "HELP" then
enderapi.lineUp()
term.clearLine()
term.write("Roll A d")
enderapi.lineDown()
enderapi.lineDown()
print[[
Type 'Exit' To Exit (Duh :P/>/>/>/>/>/>/>)
Type 'Color' To Change Text Color]]
enderapi.lineUp()
enderapi.lineUp()
enderapi.lineUp()
enderapi.lineUp()
term.write("Roll A d")
elseif input == "color" or input == "c" or input == "Color" or input == "C" or input == "COLOR" then
enderapi.lineUp()
term.clearLine()
term.write("Pick A Color: ")
textcolor = read()
if colors[textcolor] then
term.setTextColor(colors[textcolor])
colorfile = fs.open("themccm/enderdice/textcolor", "w")
colorfile.writeLine(textcolor)
colorfile.close()
end
term.clearLine()
enderapi.lineDown()
term.clearLine()
enderapi.lineDown()
term.clearLine()
enderapi.lineUp()
enderapi.lineUp()
enderapi.lineUp()
term.clearLine()
enderapi.lineUp()
term.clearLine()
enderapi.lineUp()
term.clearLine()
introPrint()
else
enderapi.lineUp()
term.clearLine()
term.write("Roll A d")
enderapi.lineDown()
term.clearLine()
print("That Wasnt A Number! Try Again.")
enderapi.lineUp()
enderapi.lineUp()
term.write("Roll A d")
end
end
end
--------------------------------------------------
--Extras--
--Pastebin: www.pastebin.com/KXRzGDcC
--CompCraft Forums:
---http://www.computercraft.info/forums2/index.php?/topic/24031-enderdice/
--Thanks All And Hope You Enjoy My Dice Roller!
--------------------------------------------------
(Little graphical bug if youre reading the above code instead of on pastebin, but it looks fine in the program)Install:
To use this program first download by inputting this command:
pastebin get KXRzGDcC diceAnd then type in "dice"
Updates:
Spoiler
Updates:
-Beta 2.0
-Beta 2.0
Spoiler
-Beta 1.0--Integrated my api (will auto download, to remove just delete "themccm/enderapi" or "themccm" but that will remove all my files if you have different programs of mine
--Made the color save between sessions (if you want to delete the file for some reason its located here: "themccm/enderdice/textcolor"
--Fixed some random bugs
--Made the color save between sessions (if you want to delete the file for some reason its located here: "themccm/enderdice/textcolor"
--Fixed some random bugs
Spoiler
-Alphas--BETA IS HERE!!!!!
--Added the ability to change text color
--Added a help command
--Fixed the exit function so it will now clear the screen
--Changed default colors
--Cleaned up the code
--Added the ability to change text color
--Added a help command
--Fixed the exit function so it will now clear the screen
--Changed default colors
--Cleaned up the code
Spoiler
-Alpha 1.9
Spoiler
-Alpha 1.8--Fixed a bug where inputting more than 100000000000 (10 trillion) would crash the program
Spoiler
-Alpha 1.6/Alpha 1.7--Fixed a bug where inputting anything less than one would crash the program
Spoiler
-Alpha 1.5--Colored Text
Spoiler
-Alpha 1.1-1.4--Cleaned up code
--Added an exit function ("exit" or "e")
--Added an exit function ("exit" or "e")
Spoiler
--Made response other than what you rolled (IE: "That wasnt a number!", "You rolled a d*input* and got *output*)
Planned Features:
Spoiler
-Exit function
-Choosing your own text colors
-Saving your color choice as default
-Bringing in my API
-A non-colored version for those without an advanced comp (low priority, however, because 99% of people have an advanced computer
)
-A clickable GUI
-Choosing your own text colors
-Bringing in my API
-A non-colored version for those without an advanced comp (low priority, however, because 99% of people have an advanced computer
-A clickable GUI
Notes:
-YOU NEED AN ADVANCED COMPUTER TO RUN THIS (Due to the color, will make a non-color one soon)
-While changing color do it in only lowercase
-To exit type "exit" or "e" (capitals work)
-Its supposed to say "Roll A d", as it was created to be a DnD dice roller, it isnt a bug.
-Ideas for this, or other projects would be much appreciated, thanks.
Edited by Zenon, 01 April 2017 - 08:08 AM.




















