Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("back")
- local main_text_scale = 1
- local main_back_color = colors.black
- local main_text_color = colors.lightGray
- local w, h = monitor.getSize()
- monitor.clear()
- local button = {}
- local language = 1
- local page = 1
- local languages_amount = 2
- local pages_amount = 8
- function setupScreen()
- monitor.setTextScale(main_text_scale)
- monitor.setBackgroundColor(main_back_color)
- monitor.setTextColor(main_text_color)
- end
- --button-api start
- function convertColor(color)
- if color == "white" then
- return 1
- end
- if color == "lightgray" then
- return 256
- end
- if color == "gray" then
- return 128
- end
- if color == "black" then
- return 32768
- end
- if color == "brown" then
- return 4096
- end
- if color == "red" then
- return 16384
- end
- if color == "orange" then
- return 2
- end
- if color == "yellow" then
- return 16
- end
- if color == "lime" then
- return 32
- end
- if color == "green" then
- return 8192
- end
- if color == "blue" then
- return 2048
- end
- if color == "cyan" then
- return 512
- end
- if color == "lightblue" then
- return 8
- end
- if color == "purple" then
- return 1024
- end
- if color == "magenta" then
- return 4
- end
- if color == "pink" then
- return 64
- end
- end
- function setButton(name, caption, func, xpos, ypos, width, height, backColor, textColor)
- button[name] = {}
- button[name]["func"] = func
- button[name]["caption"] = caption
- button[name]["x"] = xpos
- button[name]["y"] = ypos
- button[name]["width"] = width
- button[name]["height"] = height
- button[name]["backColor"] = backColor
- button[name]["textColor"] = textColor
- button[name]["visible"] = false
- end
- function drawButton(title)
- for name, data in pairs(button) do
- if name == title then
- data["visible"] = true
- monitor.setBackgroundColor(convertColor(data["backColor"]))
- monitor.setTextColor(convertColor(data["textColor"]))
- local xspot = data["x"] + math.floor((data["width"] - string.len(data["caption"])) / 2 ) + 1
- local yspot = data["y"] + math.floor(data["height"] / 2) + 1
- for i = 1, data["height"] do
- for j = 1, data["width"] do
- monitor.setCursorPos(data["x"] + j, data["y"] + i)
- monitor.write(" ")
- end
- end
- monitor.setCursorPos(xspot, yspot)
- monitor.write(data["caption"])
- end
- end
- end
- function buttonHit(x, y)
- for name, data in pairs(button) do
- if data["visible"] == true then
- if math.floor(y) >= data["y"] + 1 and y <= data["y"] + data["height"] then
- if math.floor(x) >= data["x"] + 1 and x <= data["x"] + data["width"] then
- data["func"]()
- screen()
- return true
- end
- end
- end
- end
- end
- --button-api ende
- --alle button-fkt start
- function assignButtons()
- local caption = language_button_caption[language]
- setButton("Language", caption, nextLanguage, 0, (h-3), 12, 3, "white", "black")
- setButton("PageUp", "-->", pageUp, (w-7), (h-3), 7, 3, "white", "black")
- setButton("PageDown", "<--", pageDown, (w-15), (h-3), 7, 3, "white", "black")
- end
- function nextLanguage()
- language = language + 1
- if language == (languages_amount + 1) then
- language = 1
- end
- end
- function pageUp()
- page = page + 1
- if page == (pages_amount + 1) then
- page = 1
- end
- end
- function pageDown()
- page = page - 1
- if page == 0 then
- page = pages_amount
- end
- end
- function zeilenAnzahl()
- local b = 1
- while text[language][page][b] ~= nil do
- b = b + 1
- end
- return b-1
- end
- --alle Button-Fkt ende
- --alle Screen-Fkt start
- function drawButtons()
- assignButtons()
- drawButton("Language")
- drawButton("PageUp")
- drawButton("PageDown")
- end
- function drawHeading()
- local heading = heading_string[language][page]
- local string_length = string.len(heading)
- setupScreen()
- monitor.setTextColor(colors.white)
- monitor.setCursorPos((w - string_length) / 2 + 1, 2)
- monitor.write(heading)
- end
- function drawLines()
- setupScreen()
- for c = 1, zeilenAnzahl() do
- monitor.setCursorPos(3 , c + 3)
- monitor.write(text[language][page][c])
- end
- end
- function drawHighlights()
- for name, data in pairs(highlight) do
- if data["lang"] == language then
- if data["page"] == page then
- monitor.setBackgroundColor(convertColor(data["backColor"]))
- monitor.setTextColor(convertColor(data["textColor"]))
- local xspot = data["x"]
- local yspot = data["y"]
- monitor.setCursorPos(xspot, yspot)
- monitor.write(data["text"])
- end
- end
- end
- end
- function drawPageNumber()
- setupScreen()
- monitor.setCursorPos(w-2,1)
- monitor.write(string.gsub(page, ".0", ""))
- monitor.write("/")
- monitor.write(string.gsub(pages_amount, ".0", ""))
- end
- function screen()
- setupScreen()
- monitor.clear()
- drawButtons()
- drawHeading()
- drawLines()
- drawHighlights()
- drawPageNumber()
- end
- --alle Screen-Fkt ende
- function main()
- local event, button, x, y = os.pullEvent( "monitor_touch" )
- --if event == "mouse_click" then
- buttonHit(x, y)
- --end
- end
- function textZuweisen()
- --Change Language - Button
- language_button_caption = {}
- language_button_caption[1] = "English"
- language_button_caption[2] = "Deutsch"
- --Headings
- heading_string = {}
- for a = 1, languages_amount do
- heading_string[a] = {}
- end
- --Deutsch
- heading_string[1][1] = "Herzlichen GlåBCckwunsch" --heading_string[language][page]
- heading_string[1][2] = " "
- heading_string[1][3] = "Stadtteam"
- heading_string[1][4] = "GrundsåA4tzliches"
- heading_string[1][5] = "Steuern (Teil 1)"
- heading_string[1][6] = "Steuern (Teil 2)"
- heading_string[1][7] = "InaktivitåA4t (Teil 1)"
- heading_string[1][8] = "InaktivitåA4t (Teil 2)"
- --English
- heading_string[2][1] = "Congratulations!" --heading_string[language][page]
- heading_string[2][2] = " "
- heading_string[2][3] = "City-Staff"
- heading_string[2][4] = "General information"
- heading_string[2][5] = "Taxes (Part 1)"
- heading_string[2][6] = "Taxes (Part 2)"
- heading_string[2][7] = "Inactivity (Part 1)"
- heading_string[2][8] = "Inactivity (Part 2)"
- --Lines
- text = {}
- for d = 1, languages_amount do
- text[d] = {}
- for e = 1, pages_amount do
- text[d][e] = {}
- end
- end
- --Deutsch
- text[1][1][1] = "Du hast in den Regelraum von Fontania gefunden, was" --text[language][page][line]
- text[1][1][2] = "hoffentlich bedeutet dass Du nicht einfach nur hier bist"
- text[1][1][3] = "weil es Dir ans Herz gelegt wurde, sondern Du daran"
- text[1][1][4] = "interessiert bist mehr als nur drei RubberbåA4ume zu"
- text[1][1][5] = "pflanzen und danach zu tåBCrmen (wie es die meisten tun)."
- text[1][1][6] = " "
- text[1][1][7] = "Hier findest Du alles was Du wissen musst um nicht"
- text[1][1][8] = "unwissend zu bleiben - alle Fragen zur Stadt, deren"
- text[1][1][9] = "Regeln, dem GrundståBCcks-Kauf bzw. -Verkauf und dem "
- text[1][1][10] = "Stadtteam wird Dir dieser Raum beantworten kåB6nnen..."
- text[1][1][11] = "Hoffentlich"
- text[1][2][1] = "Sollten dennoch Unklarheiten aufkommen - stelle einfach"
- text[1][2][2] = "Deine Frage ans Stadtteam, jemand wird Dir bestimmt"
- text[1][2][3] = "weiterhelfen kåB6nnen."
- text[1][2][4] = " "
- text[1][2][5] = "Auf den nåA4chsten Seiten dieses Monitors findest du"
- text[1][2][6] = "allgemeine Informationen zur Stadt, wåA4hrend die anderen"
- text[1][2][7] = "Monitore nach Thema farblich unterteilt sind:"
- text[1][3][1] = "Mayor:"
- text[1][3][2] = " "
- text[1][3][3] = " "
- text[1][3][4] = "Co-Mayor:"
- text[1][3][5] = " "
- text[1][3][6] = " "
- text[1][3][7] = " "
- text[1][3][8] = " "
- text[1][3][9] = "Helper:"
- text[1][4][1] = "Bei jeder Regel kåB6nnen Ausnahmen gemacht werden, sprecht"
- text[1][4][2] = "Euch aber dafåBCr bitte vorher mit dem Stadtteam ab!"
- text[1][4][3] = " "
- text[1][4][4] = "Bei Verstoss gegen Stadtregeln sind måB6gliche Konsequenzen"
- text[1][4][5] = "Entzug von Sonderrechten, Entzug des Stadtstroms oder"
- text[1][4][6] = "ein Kick aus der Stadt. Meist weisen wir Bewohner aber"
- text[1][4][7] = "vorher auf einen Verstoss hin."
- text[1][4][8] = " "
- text[1][4][9] = "Die Serverregeln gelten hier logischerweise immer noch!"
- text[1][4][10] = " "
- text[1][4][11] = "Stadtbezogene Diskussionen bitte im TownChat -> /tc"
- text[1][5][1] = "Jeder Stadtbewohner, auch diejenigen ohne eigenes GS,"
- text[1][5][2] = "zahlt tåA4glich um circa 12:00 Uhr CET die Stadtsteuer."
- text[1][5][3] = " "
- text[1][5][4] = "Die HåB6he der Stadtsteuer ist abhåA4ngig von Eurem "
- text[1][5][5] = "aktuellen Kontostand, und zwar immer 1% des selbigen."
- text[1][5][6] = " "
- text[1][5][7] = "Ab einem Kontostand von 20.000$ habt ihr die MåB6glichkeit"
- text[1][5][8] = "VIP zu werden - als VIP zahlt ihr keine Steuern mehr und"
- text[1][5][9] = "werdet bei /t als VIP angezeigt."
- text[1][5][10] = " "
- text[1][5][11] = "Mit /t deposit [betrag] kann man manuell Geld spenden"
- text[1][6][1] = "Wenn jemand nicht in der Lage ist eine Steuer >0$ zu"
- text[1][6][2] = "zahlen wird er automatisch vom Towny-Plugin aus der"
- text[1][6][3] = "Stadt gekickt, was im GrundståBCcksverlust endet."
- text[1][6][4] = " "
- text[1][6][5] = "Achtung:"
- text[1][6][6] = "-> Das Towny-Plugin kennt keine Einheit kleiner als "
- text[1][6][7] = " 0.01$, was bedeutet dass ihr NICHT die Steuer"
- text[1][6][8] = " zahlen kåB6nnt wenn ihr zwischen 0 und 1$ habt."
- text[1][6][9] = " "
- text[1][6][10] = "-> Die Steuer wird auch eingezogen wenn man nicht"
- text[1][6][11] = " online ist."
- text[1][7][1] = "Solltest Du unangekåBCndigt fåBCr mehr als 4 Wochen inaktiv"
- text[1][7][2] = "sein (im Zweifelsfall zåA4hlt die Angabe bei /seen) geht"
- text[1][7][3] = "Dein GrundståBCck an die Stadt zuråBCck, und Du erhåA4lst"
- text[1][7][4] = "weder Items noch Geld zuråBCck."
- text[1][7][5] = " "
- text[1][7][6] = "Ausnahmen werden fåBCr Bewohner gemacht welche schon fåBCr"
- text[1][7][7] = "låA4ngere Zeit in der Stadt aktiv waren - deren Maschinen"
- text[1][7][8] = "und ME Storages werden abgebaut und im Stadtlager"
- text[1][7][9] = "eingelagert; nur der Rohbau des Hauses bleibt stehen."
- text[1][8][1] = "Solltest Du vorher wissen dass Du fåBCr mehr als 14 Tage"
- text[1][8][2] = "nicht online kommen kannst (Urlaub, Schule/Beruf, "
- text[1][8][3] = "Technische Probleme, Unfall etc.) gib bitte jemanden aus"
- text[1][8][4] = "dem Stadtteam persåB6nlich Bescheid (Eine Mail reicht NICHT"
- text[1][8][5] = "aus!). Gebt bitte an wann ihr wiederkommt und eine kurze"
- text[1][8][6] = "BegråBCndung. Unrealistische Angaben ('Ich komme in zwei "
- text[1][8][7] = "Jahren wieder') werden abgelehnt."
- text[1][8][8] = " "
- text[1][8][9] = "Achtung: Wir achten NICHT auf Warns, bei låA4ngeren Temp-"
- text[1][8][10] = "Bans schreibt dies ins Forum (Da 21 Tage > 14 Tage)."
- --English
- text[2][1][1] = "You found your way inside here - the rules of Fontania." --text[language][page][line]
- text[2][1][2] = "This hopefully implies that you aren't just here because"
- text[2][1][3] = "somebody told you, but because you want to play active"
- text[2][1][4] = "and not break the rules, or just plant 3 rubber trees"
- text[2][1][5] = "and then disappear for ever, like all the others..."
- text[2][1][6] = " "
- text[2][1][7] = "Here you can find all the information you need to know:"
- text[2][1][8] = "from general concerns about the city, its rules, buying"
- text[2][1][9] = "and selling plots, as well es the city staff. This room"
- text[2][1][10] = "will - hopefully - be able to answer all of your"
- text[2][1][11] = "questions."
- text[2][2][1] = "Should there still be questions remaining after this short"
- text[2][2][2] = "tour, don't fear asking the city staff for help. We're"
- text[2][2][3] = "(mostly) able to give advice in any circumstances."
- text[2][2][4] = " "
- text[2][2][5] = "On the next pages of this screen you will find overall"
- text[2][2][6] = "information of the city, while the other screens are"
- text[2][2][7] = "color-coded by their topic:"
- text[2][3][1] = "Mayor:"
- text[2][3][2] = " "
- text[2][3][3] = " "
- text[2][3][4] = "Co-Mayor:"
- text[2][3][5] = " "
- text[2][3][6] = " "
- text[2][3][7] = " "
- text[2][3][8] = " "
- text[2][3][9] = "Helper:"
- text[2][4][1] = "Exceptions to the rules are always possible, but please"
- text[2][4][2] = "discuss these with a staff member first!"
- text[2][4][3] = " "
- text[2][4][4] = "When breaking rules possible actions are: loss of special"
- text[2][4][5] = "permissions, no more power provided by the city, or in"
- text[2][4][6] = "particularly hard cases a kick out of the city. However we"
- text[2][4][7] = "are usually giving hints before taking action."
- text[2][4][8] = " "
- text[2][4][9] = "The server rules are obviously still applying here!"
- text[2][4][10] = " "
- text[2][4][11] = "Everything city-related should be discussed here -> /tc"
- text[2][5][1] = "Every resident of the city, plot-owner or not, has to pay"
- text[2][5][2] = "taxes at 12:00 CET. This happens automatically."
- text[2][5][3] = " "
- text[2][5][4] = "The amount of paid tax depends on your current balance,"
- text[2][5][5] = "always 1% of that will get collected."
- text[2][5][6] = " "
- text[2][5][7] = "WHen owning more that 20.000$ you can become VIP of the"
- text[2][5][8] = "city, which relieves you of paying taxes and displays you"
- text[2][5][9] = "as VIP at /t"
- text[2][5][10] = " "
- text[2][5][11] = "You can donate money at any time with /t deposit [amount]"
- text[2][6][1] = "If the amount of tax you pay isn't above 0.01$ you will"
- text[2][6][2] = "get kicked from the city automatically, which results"
- text[2][6][3] = "in loss of your plot."
- text[2][6][4] = " "
- text[2][6][5] = "Special advice:"
- text[2][6][6] = "-> Because the Towny-Plugin does not acknowledge money"
- text[2][6][7] = " less than units of 0.01$ you will always need more than"
- text[2][6][8] = " 1$ to be able to pay your tax!"
- text[2][6][9] = " "
- text[2][6][10] = "-> The taxes get collected even if you are not online!"
- text[2][7][1] = "If you are not online for more than 4 Weeks"
- text[2][7][2] = "(/seen is our measurement) you will get kicked from the"
- text[2][7][3] = "city and your plot gets cleared, without you getting items"
- text[2][7][4] = "or money back."
- text[2][7][5] = " "
- text[2][7][6] = "If you have been active in the city for a reasonable time"
- text[2][7][7] = "your stuff won't get cleared, but instead taken into the"
- text[2][7][8] = "city storage, waiting for the user to come back. All"
- text[2][7][9] = "devices will be deactivated, but the blocks will remain."
- text[2][8][1] = "If you know in advance that you will be offline for more"
- text[2][8][2] = "than 4 Weeks (vacation, school/job, technical issues,"
- text[2][8][3] = "recovery from health issues) please write to a staff member"
- text[2][8][4] = "of the city when he is online. (/mail does NOT count!)"
- text[2][8][5] = "Please provide the period when you are inactive as well as"
- text[2][8][6] = "a short reason why. Unrealistic statements ('I'll be back"
- text[2][8][7] = "in 2 years') will get denied."
- text[2][8][8] = " "
- text[2][8][9] = "Attention: We don't keep track of the ban-management; if"
- text[2][8][10] = "you get temp-banned for 21 days this exceeds the 14 days."
- --Highlights
- highlight = {}
- --setHighlight(id, sprache, seite, "Text", xpos, ypos, "backcolor", "textcolor")
- --Deutsch
- setHighlight(1, 1, 2, " Allgemeine Regeln ", 4, 12, "red", "black")
- setHighlight(2, 1, 2, " GrundståBCcke ", 4, 14, "yellow", "black")
- setHighlight(3, 1, 2, " Leistungen der Stadt ", 34, 12, "green", "black")
- setHighlight(4, 1, 2, " Befehle ", 34, 14, "lightblue", "black")
- setHighlight(5, 1, 3, "[ ]", 15, 4, "black", "gray")
- setHighlight(6, 1, 3, "Supporter", 16, 4, "black", "lime")
- setHighlight(7, 1, 3, "MagmaLP", 27, 4, "black", "yellow")
- setHighlight(8, 1, 3, "[ ]", 15, 7, "black", "gray")
- setHighlight(9, 1, 3, "Developer", 16, 7, "black", "blue")
- setHighlight(10, 1, 3, "_N1KL4S_", 27, 7, "black", "lightgray")
- setHighlight(11, 1, 3, "[ ]", 15, 9, "black", "gray")
- setHighlight(12, 1, 3, "Stammi", 16, 9, "black", "cyan")
- setHighlight(13, 1, 3, "Kikkeksler", 24, 9, "black", "lightgray")
- setHighlight(14, 1, 3, "[ ]", 37, 7, "black", "gray")
- setHighlight(15, 1, 3, "Supporter", 38, 7, "black", "lime")
- setHighlight(16, 1, 3, "Justin8303", 49, 7, "black", "yellow")
- setHighlight(17, 1, 3, "[ ]", 37, 9, "black", "gray")
- setHighlight(18, 1, 3, "Stammi", 38, 9, "black", "cyan")
- setHighlight(19, 1, 3, "Rene200", 46, 9, "black", "lightgray")
- -- setHighlight(20, 1, 3, "[ ]", 15, 14, "black", "gray")
- -- setHighlight(21, 1, 3, "Stammi", 16, 14, "black", "cyan")
- -- setHighlight(22, 1, 3, "4Real_", 24, 14, "black", "lightgray")
- setHighlight(23, 1, 3, "[ ]", 15, 12, "black", "gray")
- setHighlight(24, 1, 3, "Gold", 16, 12, "black", "yellow")
- setHighlight(25, 1, 3, "Gnomers", 22, 12, "black", "blue")
- setHighlight(26, 1, 3, "[ ]", 37, 12, "black", "gray")
- setHighlight(27, 1, 3, "Stammi", 38, 12, "black", "cyan")
- setHighlight(28, 1, 3, "Qivex", 46, 12, "black", "lightgray")
- -- setHighlight(29, 1, 3, "[ ]", 37, 14, "black", "gray")
- -- setHighlight(30, 1, 3, "Stammi", 38, 14, "black", "cyan")
- -- setHighlight(31, 1, 3, "TT_Finn12", 46, 14, "black", "lightgray")
- --English
- setHighlight(32, 2, 2, " Rules ", 4, 12, "red", "black")
- setHighlight(33, 2, 2, " Plots ", 4, 14, "yellow", "black")
- setHighlight(34, 2, 2, " Advantages ", 34, 12, "green", "black")
- setHighlight(35, 2, 2, " Commands ", 34, 14, "lightblue", "black")
- setHighlight(36, 2, 3, "[ ]", 15, 4, "black", "gray")
- setHighlight(37, 2, 3, "Supporter", 16, 4, "black", "lime")
- setHighlight(38, 2, 3, "MagmaLP", 27, 4, "black", "yellow")
- setHighlight(39, 2, 3, "[ ]", 15, 7, "black", "gray")
- setHighlight(40, 2, 3, "Developer", 16, 7, "black", "blue")
- setHighlight(41, 2, 3, "_N1KL4S_", 27, 7, "black", "lightgray")
- setHighlight(42, 2, 3, "[ ]", 15, 9, "black", "gray")
- setHighlight(43, 2, 3, "Stammi", 16, 9, "black", "cyan")
- setHighlight(44, 2, 3, "Kikkeksler", 24, 9, "black", "lightgray")
- setHighlight(45, 2, 3, "[ ]", 37, 7, "black", "gray")
- setHighlight(46, 2, 3, "Supporter", 38, 7, "black", "lime")
- setHighlight(47, 2, 3, "Justin8303", 49, 7, "black", "yellow")
- setHighlight(48, 2, 3, "[ ]", 37, 9, "black", "gray")
- setHighlight(49, 2, 3, "Stammi", 38, 9, "black", "cyan")
- setHighlight(50, 2, 3, "Rene200", 46, 9, "black", "lightgray")
- -- setHighlight(51, 2, 3, "[ ]", 15, 14, "black", "gray")
- -- setHighlight(52, 2, 3, "Stammi", 16, 14, "black", "cyan")
- -- setHighlight(53, 2, 3, "4Real_", 24, 14, "black", "lightgray")
- setHighlight(54, 2, 3, "[ ]", 15, 12, "black", "gray")
- setHighlight(55, 2, 3, "Gold", 16, 12, "black", "yellow")
- setHighlight(56, 2, 3, "Gnomers", 22, 12, "black", "blue")
- setHighlight(57, 2, 3, "[ ]", 37, 12, "black", "gray")
- setHighlight(58, 2, 3, "Stammi", 38, 12, "black", "cyan")
- setHighlight(59, 2, 3, "Qivex", 46, 12, "black", "lightgray")
- -- setHighlight(60, 2, 3, "[ ]", 37, 14, "black", "gray")
- -- setHighlight(61, 2, 3, "Stammi", 38, 14, "black", "cyan")
- -- setHighlight(62, 2, 3, "TT_Finn12", 46, 14, "black", "lightgray")
- end
- function setHighlight(id, sprache, seite, text, xpos, ypos, backColor, textColor)
- highlight[id] = {}
- highlight[id]["lang"] = sprache
- highlight[id]["page"] = seite
- highlight[id]["text"] = text
- highlight[id]["x"] = xpos
- highlight[id]["y"] = ypos
- highlight[id]["backColor"] = backColor
- highlight[id]["textColor"] = textColor
- end
- textZuweisen()
- screen()
- while true do
- main()
- end
Add Comment
Please, Sign In to add comment