Replies: 1 comment
|
UPDATE I am not at all sure this is a good idea, but I modified matchItem(str, cmdParams) {
/* MODIFIED TO CATCH ALL */
parser.currentCommand = this
parser.currentCommand.all = false;
if (str == 'all'){
parser.currentCommand.all = true
}
/* END OF MOD*/
let score = 0;
this.tmp.objectTexts.push(str)
if (cmdParams.special) {Then I modified function printOrRun(char, item, attname, options) {
if (options === undefined) options = {}
if (!options.char) options.char = char
if (!options.item) options.item = item
if (typeof item[attname] === "string") {
// The attribute is a string
let s = item[attname]
/* MODIFIED HERE TO CHECK FOR ALL */
if (parser.currentCommand.all){
let stringPre = sentenceCase(lang.getName(item,{article:DEFINITE,noLink:true})) + ": "
s = stringPre + s
}
/* END OF MOD TO CHECK FOR ALL */
if (item[attname + 'Addendum']) s += item[attname + 'Addendum'](char)
msg(s, options);
return true;
}
else if (typeof item[attname] === "function"){
// The attribute is a function
const res = item[attname](options);
return res;
}
else {
const s = "Unsupported type for printOrRun (" + attname + " is a " + (typeof item[attname]) + ")."
errormsg(s)
throw new Error(s)
}
}Now it behaves like I want: Did I break something elsewhere that I haven't noticed yet? Probably! So don't try this at home! 😇 Play the game: https://kvongit.github.io/Koww_QuestJS/play.html The code: https://github.com/KVonGit/Koww_QuestJS |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
When entering TAKE ALL, I think it should be like:
I found the code that prints an object's
takeMsg, where I could modify things to handle this, but I can't find the code that prints an object'stakeattribute when it can't actually be taken.All reactions