basic navigation, add unlimited string in input
This commit is contained in:
parent
ab11ccccd1
commit
59a655e4c7
@ -1,4 +1,4 @@
|
|||||||
function input(prompt::AbstractString="")
|
function input(prompt::AbstractString="",x...)
|
||||||
print(prompt)
|
print(prompt)
|
||||||
return chomp(readline())
|
return chomp(readline())
|
||||||
end
|
end
|
||||||
|
7
lib/s1Stations.jl
Normal file
7
lib/s1Stations.jl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
include("../lib/io.jl")
|
||||||
|
global function mirStation()
|
||||||
|
|
||||||
|
println("You havearrived in Mir")
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
@ -1,43 +1,92 @@
|
|||||||
#!/usr/bin/julia
|
#!/usr/bin/julia
|
||||||
using TerminalMenus
|
using TerminalMenus
|
||||||
include("../lib/io.jl")
|
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"
|
if stationName == "Mir"
|
||||||
println("You arrive at Mir")
|
#println("You arrive at ", stationName)
|
||||||
|
mirStation()
|
||||||
|
|
||||||
elseif stationName == "Hoover"
|
elseif stationName == "Hoover"
|
||||||
println("You have arrived at Hoover")
|
println("You have arrived at ", stationName)
|
||||||
|
|
||||||
elseif stationName == "Aloomis"
|
elseif stationName == "Aloomis"
|
||||||
println("You have arrived in Aloonis")
|
println("You have arrived in ", stationName)
|
||||||
|
|
||||||
elseif stationName == "Caldari"
|
elseif stationName == "Caldari"
|
||||||
println("You have arrived in Caldari")
|
println("You have arrived in ", stationName)
|
||||||
|
|
||||||
elseif stationName == "Moon Plaza"
|
elseif stationName == "Moon Plaza"
|
||||||
println("You have arrived at Moon Plaza")
|
println("You have arrived at ", stationName)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return stationName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
sector = sectors()
|
function sec2Stations(stationName)
|
||||||
|
if stationName == "Eejypt"
|
||||||
|
println("You have arrived in ", stationName)
|
||||||
|
|
||||||
menu = RadioMenu(sector, pagesize=10)
|
elseif stationName == "Eden"
|
||||||
|
println("You have arrived in ", stationName)
|
||||||
|
end
|
||||||
|
|
||||||
println("You are in sector 1")
|
end
|
||||||
choice = request("Warp to Station: ", menu)
|
|
||||||
|
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
|
if choice != -1
|
||||||
stations(sector[choice])
|
sec1Stations(sector1[choice])
|
||||||
|
|
||||||
else
|
else
|
||||||
println("Cancelled")
|
println("Cancelled")
|
||||||
end
|
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: ")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if choice == "q"
|
||||||
|
exit(0)
|
||||||
|
else
|
||||||
|
sectors(choice)
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user