basic navigation, add unlimited string in input

This commit is contained in:
silvernode 2018-03-18 05:24:17 -07:00
parent ab11ccccd1
commit 59a655e4c7
3 changed files with 79 additions and 23 deletions

View File

@ -1,4 +1,4 @@
function input(prompt::AbstractString="")
function input(prompt::AbstractString="",x...)
print(prompt)
return chomp(readline())
end

7
lib/s1Stations.jl Normal file
View File

@ -0,0 +1,7 @@
include("../lib/io.jl")
global function mirStation()
println("You havearrived in Mir")
return
end

View File

@ -1,43 +1,92 @@
#!/usr/bin/julia
using TerminalMenus
include("../lib/io.jl")
include("../lib/s1Stations.jl")
function sectors()
local sector1 = ["Moon Plaza", "Hoover", "Mir", "Aloomis", "Caldari"]
local defMessage = "You have not moved"
return sector1
end
function stations(stationName)
function sec1Stations(stationName)
if stationName == "Mir"
println("You arrive at Mir")
#println("You arrive at ", stationName)
mirStation()
elseif stationName == "Hoover"
println("You have arrived at Hoover")
println("You have arrived at ", stationName)
elseif stationName == "Aloomis"
println("You have arrived in Aloonis")
println("You have arrived in ", stationName)
elseif stationName == "Caldari"
println("You have arrived in Caldari")
println("You have arrived in ", stationName)
elseif stationName == "Moon Plaza"
println("You have arrived at Moon Plaza")
println("You have arrived at ", stationName)
end
return stationName
end
function sec2Stations(stationName)
if stationName == "Eejypt"
println("You have arrived in ", stationName)
elseif stationName == "Eden"
println("You have arrived in ", stationName)
end
end
function sectors(number)
local sector1 = ["Moon Plaza", "Hoover", "Mir", "Aloomis", "Caldari"]
local sector2 = ["Eejypt", "Eden",]
if number == "1"
sec1StatMenu = RadioMenu(sector1, pagesize=10)
local choice = request("Warp to Station: ", sec1StatMenu)
if choice != -1
sec1Stations(sector1[choice])
else
println("Cancelled")
end
elseif number == "2"
sec2StatMenu = RadioMenu(sector2, pagesize=10)
local choice2 = request("Warp to station: ", sec2StatMenu)
if choice2 != -1
sec2Stations(sector2[choice2])
else
println("Cancelled")
end
else
println("Sector ", number, " does not exist!")
end
end
while true
println("1 : Sector 1")
println("2 : Sector 2")
println("q : Quit")
choice = input("Please choose a sector: ")
sector = sectors()
menu = RadioMenu(sector, pagesize=10)
println("You are in sector 1")
choice = request("Warp to Station: ", menu)
if choice != -1
stations(sector[choice])
else
println("Cancelled")
end
if choice == "q"
exit(0)
else
sectors(choice)
end
end