Added the ability to call #goto with location number. Resolves #30

This commit is contained in:
raeleus 2024-10-03 23:30:14 -07:00
parent 112b72d4c8
commit 1de7948af9
2 changed files with 14 additions and 3 deletions

View file

@ -1355,7 +1355,18 @@ function doGoToLocation(command) {
return "\n[Error: Not enough parameters. See #help]\n"
}
if (arg1 == null && locationName != null) {
if (!isNaN(arg0) && arg1 == null && locationName == null) {
arg0 = parseInt(arg0) - 1
if (arg0 < 0 || arg0 >= state.locations.length) {
state.show = none
return "\n[Error: Incorrect location number. See #help]\n"
}
location = state.locations[arg0]
arg0 = null
arg1 = null
} else if (arg1 == null && locationName != null) {
var index = state.locations.findIndex(x => x.name.toLowerCase() == locationName.toLowerCase())
if (index != -1) {
location = state.locations[index]