mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-05 13:10:28 -04:00
Added the ability to call #goto with location number. Resolves #30
This commit is contained in:
parent
112b72d4c8
commit
1de7948af9
2 changed files with 14 additions and 3 deletions
13
Input.js
13
Input.js
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue