Closed KVonGit closed 3 years ago
If you click and select Examine, then the link disappears. Do you know why? Is this deliberate?
If you click and select Examine, then the link disappears. Do you know why? Is this deliberate?
That is not deliberate.
Also, that doesn't happen in my example game, but I admit that it is probably coded from QuestJS version 0.5 files. Maybe version 0.6.
I'll look at it real quick, and I shall return.
PS
I've been writing something in Quest 5 for a month or two, and I am now rusty when it comes to QuestJS code (I guess).
I didn't really need to add a text-processor function, as this code works without adding anything:
. . .
talkto:"{random:\"I {random:like beer:can light any {nm:purple_lighter} on the first attempt},\"\
says Xan{random:, with a nod at the end for emphasis:}:XanMag nods, whilst not listening at all}.",
. . .
I just can't replace the item's name with anything I want with nm
(unless I'm missing something in the docs).
At first, I forgot about nm
and nv
. Hence, the creation of this issue.
EDIT
I don't think any new code needs to be added. I forgot all about nm
and nv
, and those serve the purpose.
The rest of this is for completion's sake / archival purposes:
If you click and select Examine, then the link disappears. Do you know why? Is this deliberate?
I downloaded QuestJS-v0.7, added the text processor function, added an item, and couldn't recreate this. My link doesn't disappear.
After testing that, I realized I had an error (shouldn't add the id if the author doesn't provide one). Fixed that:
tp.text_processors.item = function(data,params) {
let item = data[0];
let id = data[1];
return getItemLink(w[item], id);
}
...but yeah.
I downloaded the current version: https://github.com/ThePix/QuestJS/blob/master/QuestJS-0.7.zip
All I added was the above bit of code and this bit of code:
createRoom("lounge", {
desc:"The lounge is boring, the author really needs to put stuff in it.<br/><br/>There is a {nm:purple_lighter} here.<br/><br/>Item: {item:purple_lighter:lighter}",
})
createItem("purple_lighter", TAKEABLE(), {
loc:"lounge",
examine:"An ordinary {item:purple_lighter}.",
})
Then, I added the included item_links library (I did not modify the "item_links.js" file at all):
libraries:["_saveload", "_text", "_io", "_command", "_defaults", "_templates", "_world", "_npc", "_parser", "_commands", "item_links"], // util already loaded
...and I can't recreate the issue.
Do you want to close it then?
This is what I've come up with. Feel free to improve or completely modify:
EXAMPLE