Commit 11046a5e authored by Deucе's avatar Deucе 👌🏾
Browse files

Fix chooseplayer() function

Previously, it did a case sensitive match against names that started
with what you typed including LORD codes.

Now it strips codes from both and does a case-insentive substring
match.
parent 9d6b6c2f
...@@ -1491,19 +1491,21 @@ function chooseplayer() ...@@ -1491,19 +1491,21 @@ function chooseplayer()
{ {
var i; var i;
var pl; var pl;
var pn; var needle;
var haystack;
var ch; var ch;
lln('`r0`2 Who would you like to send a message to?'); lln('`r0`2 Who would you like to send a message to?');
sln(''); sln('');
lln(' `2(`0full or `%PARTIAL`0 name`2).') lln(' `2(`0full or `%PARTIAL`0 name`2).')
lw(' `2NAME `8: `%'); lw(' `2NAME `8: `%');
pn = superclean(dk.console.getstr({len:26})); needle = superclean(dk.console.getstr({len:26})).toLowerCase();
sln(''); sln('');
for (i = 0; i < pfile.length; i++) { for (i = 0; i < pfile.length; i++) {
pl = pfile.get(i); pl = pfile.get(i);
if (pl.name.indexOf(pn) !== 0) { haystack = superclean(pl.name).toLowerCase();
if (haystack.indexOf(needle) !== -1) {
lw('\r'); lw('\r');
dk.console.cleareol(); dk.console.cleareol();
lw(' `2You mean `0'+pl.name+'`2? [`0Y`2] `8: '); lw(' `2You mean `0'+pl.name+'`2? [`0Y`2] `8: ');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment