Quest 6:item Links Library (in progress)

This is far from perfect.

I'm not even sure that Pixie doesn't already have something better in the works.


image


image


The actual, good, working code is here


TODO

Check whether situation requires hereVerbs or heldVerbs.

(I'm currently only using this with NPCs.)


EDIT

The actual, good, working code is here


I'm not even sure that Pixie doesn't already have something better in the works.

I do not.


EDIT

The actual, good, working code is here


OLD INFO REMOVED

The actual, good, working code is here


POST REMOVED DUE TO OLD CODE


OLD CODE REMOVED.

NOTHING TO SEE HERE.


EXAMPLE GAME

http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/index.html


Looks good, but...

If you do EXAMINE TV it asks you which one. At this point all the text in the side panes disappears. When you make a selection, the item texts come back, but the compass remains blank. I have just checked my own games, and this does not happen for me.


Ha.

One TV is named "TV". The other is named something weird with the alias "TV", just to see if crazy things happened.

I guess that was a good idea, in a weird way.

I've always got the console open in browser, and it nearly takes up a third of the right of my screen, which makes my screen too narrow for the panes. I didn't even think to watch them.


PS

I've also done something that keeps the game from asking if I'm sure I want to leave the page. And that was happening (or technically not happening) before I added any object link code. Have you ever run into that?


I've always got the console open in browser, and it nearly takes up a third of the right of my screen, which makes my screen too narrow for the panes. I didn't even think to watch them.

How narrow is you screen? But yes, you need to watch the side panes when messing with this stuff. Did the compass go blank for you?

I've also done something that keeps the game from asking if I'm sure I want to leave the page.

If you set the mode to "dev", that will stop it. You tend to reload so often during development it is more annoying than helpful.


How narrow is you screen?

Heck, I don't know. Hold on . . .

screen.width = 1366

That is all moot as of this moment, because I just docked the console to the bottom of the window. (I can think. I just do it slowly. Hehehe.)


Did the compass go blank for you?

Affirmative.

Trying to pinpoint why right now.

If you set the mode to "dev", that will stop it. You tend to reload so often during development it is more annoying than helpful.

  1. That is a good idea.

  2. I'm glad I didn't mess that part up somehow.


Something is changing the style color of td in the panes to black whenever showMenu is called. The background color of my panes is black. So, when the color changes to rgb(0,0,0) when showMenu is called, it looks like my buttons disappear.

Still researching.


Okay...

Whenever the disambiguation menu pops up, my panes' color switches to io.textColour.

...and it is added inline, not via CSS.

I am still searching for the code that does this.

I found a line of code that sets io.textColour:
https://github.com/ThePix/QuestJS/blob/8939148f7c2c3e63665246dc263493b724845cf2/lib/_io.js#L1186


In theory, io.textColour should be the colour of the text. For some reason it is set to black a the start of the game. How have you set the colours there? It should be done in style.css. If you have done it using JavaScript maybe you did it after io.textColour is set. A simple fix would be to set io.textColour at that point (but in the CSS would be better).


Hurray! I found it!

https://github.com/ThePix/QuestJS/blob/9c2a3c917e4ea12f06664e35d41bfdb2f4a59935/lib/_io.js#L884

io.enable = function() {
  if (!io.inputIsDisabled) return
  io.inputIsDisabled = false;
  $('#input').show();
  $('.compass-button').css('color', io.textColour);
  $('.item').css('color', io.textColour);
  $('.item-action').css('color', io.textColour);
};

And this changes the color beforehand:


io.disable = function(stillAllowText) {
  if (io.inputIsDisabled) return
  io.inputIsDisabled = true;
  if (!stillAllowText) $('#input').hide();
  $('.compass-button').css('color', '#808080');
  $('.item').css('color', '#808080');
  $('.item-action').css('color', '#808080');
};

Resetting io.textColour during disable seems to be a quick fix. I used '.pane-div' instead of '.side-panes', though, because there is no color attribute on '.side-panes' in the CSS file.

MODIFIED io.enable function

		io.disable = function(stillAllowText) {
		  if (io.inputIsDisabled) return
		  io.inputIsDisabled = true;
		  io.textColour = $(".pane-div").css("color") //KV added this line
		  if (!stillAllowText) $('#input').hide();
		  $('.compass-button').css('color', '#808080');
		  $('.item').css('color', '#808080');
		  $('.item-action').css('color', '#808080');
		};	

PS

I didn't refresh my page to see your post. It popped up after I sent my last post.

...but yeah, I guess it would be easier to add 'color' to '.side-panes' in the CSS.

https://github.com/ThePix/QuestJS/blob/master/game/style.css#L60


PPS

Adding the setting to the CSS doesn't seem to fix it, but setting io.textColour in settings.setup does fix it.


EDIT

This is because of the way I add my CSS sheet. I do it in settings.setup.


That is strange. It does not happen for me.

I have looked at the CSS a bit, in part because I noticed dark mode has some omission and in part because Dakin is working on this too. It is possible the latest update will affect this. Hopefully not in a bad way.


We can add "color" in CSS class ".side-panes". I'll add to "style.css". By default, it will be Black. :)


My game loads my CSS sheet from settings.setup. So, I have to set io.textColour.

I don't like to fool with the original CSS sheet, in case things are added or changed in new versions of QuestJS. I just add my own with the changes I want applied.


The code is here


Maybe modify the DEFAULT_ROOM in "_template.js" like myself when I'm creating function. Maybe The Pixie will add your work.

I propose to rename the "objectLinksLib.js" to "_items.js".


@Dakin

Hello!

All good ideas. I'm not trying to be negative at all, but . . .


Maybe modify the DEFAULT_ROOM in "_template.js"

I try to avoid modifying anything in the "lib" folder. If I want to change something, I change it in my added code.

This way, when QuestJS is updated, I (usually) don't have to worry about it.


I propose to rename the "objectLinksLib.js" to "_items.js".

Feel free to name it whatever you like. It won't hurt my feelings any.

Me? I've already got an "_items.js" file in my game's directory. Plus, I like it when the file name tells me what it actually is.


When I click on the link Ralph the menu is displayed. However, with the commands 'Look At' and 'Talk To' it makes line breaks between the words. It would look better if a command was on one line.

@Pixie: I just saw that in README.md a link is not working:
"There is a tutorial on how to play parser games here".


with the commands 'Look At' and 'Talk To' it makes line breaks between the words. It would look better if a command was on one line.

I noticed that on my mobile device. Perhaps an   will do the trick. I'll try that and return with the information.


Thanks for pointing that out, Pertex!

Modified line 212:

				o = capFirst(o).replace(/ /g, ' ')

EDIT

I added white-space:nowrap to the style of the verb dropdown element.

I updated the code posted here. I'll upload the updated game after I've ironed out a few other wrinkles.


You MUST insert this modified code in the code BEFORE any rooms are coded.

As long as this file is loaded first, that should be fine.

settings.files.unshift('objectLinksLib')

However, I did run into a problem. It shows the verbs, but on the same line as the item. Is there some CSS I need maybe?


Whoops.

CSS


.droplink{
	color:blue;
}
.droplink:not(.disabled) {
    /*background-color: #3498DB;
    color: blue;
    padding: 16px;
    font-size: 16px;
    border: none;*/
    cursor: pointer;
}

.droplink:hover:not(.disabled), .droplink:focus:not(.disabled), .exit-link:hover:not(.disabled) {
    color: blue;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    overflow: auto;
	border: 1px solid black;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-content span {
    color: black;
    padding: 6px;
    text-decoration: none;
    display: block;
}

.dropdown a:hover {background-color: #ddd}

.show {display:block;}


Cool. I have added it as an optional library that can be added:

settings.libraries.push('item_links')

Cool. I have added it as an optional library that can be added

Groovy!

The funny thing is, I won't even use them in the majority of my games. (Well, I'm toying with the notion of enabling them if the screen width "says" the game is being played on mobile. That way, mobile players would have the handy links. Still just toying with this notion, though.)

Anyway, the hardcore Quest crowd will probably feel at home with the object links. That was the goal.


Unfortunately, when you look at the inventory, the objects are still without links. I have not tested it, but what happens with objects in containers?


I was making sure the "core" of it worked before fooling with anything besides the room description template. I'm pretty sure it will be relatively easy to apply it across the board (said the fool (meaning me)).

I was working on code to restore the YouTube player to its saved state when loading a save all last night. After I find the bit of that I most definitely overlooked, I'll get back on the object links.


I was making sure the "core" of it worked before fooling with anything besides the room description template.

Ya' know: It would have been nice if I'd thought to tell Pixie that after being informed this had been added to Quest.

I feel appropriately guilty.


I'm pretty sure it will be relatively easy to apply it across the board (said the fool (meaning me)).

Yeah . . .

I need to make some adjustments. Come to find out, I coded the verb switching thing to only check items printed in room descriptions. (I remember having a reason; I just don't recall said reason.) Anyway, new code coming soon.


Unfortunately, when you look at the inventory, the objects are still without links. I have not tested it, but what happens with objects in containers?

This tracks what I'm doing with this:

https://github.com/KVonGit/Quest6Game1/issues/1

I think surfaces are all I have left to mess with.


The test game has been updated.

http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/page.html


There are still action-reporting messages that won't print a link, but hopefully not very many.


Wonderful. Is it intentional that all links are removed when you run a look, except for the last output?


Is it intentional that all links are removed when you run a look, except for the last output?

Sort of.

I can't allow any duplicate links at the moment. Else, the dropdown appears above the first one that printed.

I have that on the TODO list:

https://github.com/KVonGit/Quest6Game1/issues/10


I've got it iterating through items in containers and items held by NPCs, too.

Recent gameplay:

The cellar is small, dimly lit, and dingy. It sure is nice of XanMag to let you and Ralph stay here, though!

You can see Ralph, a light switch, a table (on which you see: a box (containing: a doohickey)), and a TV here.

You can go up.

> get doo

You take the doohickey.

> l

The cellar is small, dimly lit, and dingy.

You can see Ralph, a light switch, a table (on which you see: a box), and a TV here.

You can go up.

> get box

You take the box.

> l

The cellar is small, dimly lit, and dingy.

You can see Ralph, a light switch, a table, and a TV here.

You can go up.

> put mask in box

Done.

> give box to rp

Done.

> l

The cellar is small, dimly lit, and dingy.

You can see Ralph (carrying: a box (containing: a mask)), a light switch, a table, and a TV here.

You can go up.

> rp, close box

Ralph closes the box.

> l

The cellar is small, dimly lit, and dingy.

You can see Ralph (carrying: a box), a light switch, a table, and a TV here.

You can go up.


Now, I'm working on making that work when examining containers and NPCs. (Currently, it only prints whatever is in the examine property, sans checking for items contained/carried.)


I can't allow any duplicate links at the moment.

I think that is a perfectly reasonable way of doing it. If that is easiest, I would suggest leaving it like that.


Version 0.24

GAME
http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/page.html

CODE ON GitHub

https://github.com/KVonGit/Item-Links-Library/blob/main/item_links.js


I don't think it's a duplication problem. When you first display the inventory, all the objects in the inventory are displayed as links. If you call 'look' afterwards, all links of the inventory are removed (as well as the links of the first 'look'). The links of the first look are unimportant, but it would be nice if all other links would remain.
This would be important for games that are only played with the mouse.


This would be important for games that are only played with the mouse.

Yes, sir. That is the player I'm keeping in mind during this endeavor (or trying to): the clicker.

When you first display the inventory, all the objects in the inventory are displayed as links. If you call 'look' afterwards, all links of the inventory are removed

I just rewrote most of the code, hopefully in a way that lets me address this easily. I have a class set on links which are to be disabled every time a room description prints. The rest of the links are only supposed to get disabled when a duplicate is printed. I may just add an extra class for inventory text.

You are super awesome for taking the time to help with this, Pertex!

...and I seriously want you to try to break it. And don't hold back on me. I can take it.

(I haven't tried using UNDO at all yet.)


You are super awesome for taking the time to help with this, Pertex!

And you are super awesome for doing this work!

...and I seriously want you to try to break it. And don't hold back on me. I can take it.

I haven't had time to dig deeper into QuestJS, but now I'll try to at least be of some help with testing. And I will report all the unpleasantness quite nicely


I will report all the unpleasantness quite nicely

Brutal honesty. (That's my policy.)

Anyway, I'm thinking I should add a check on each link's object to see if it is in scope. Then, just have two checks to find links that need to be disabled:

  1. Not in scope
  2. Duplicate link prints in new text.

After I give my eyes and my logic circuits a brief rest, I'll see if I can swing that.

I just now made nm in the text processor return a link if the settings are enabling links. That should cover the majority of things I hadn't covered (after I adjust nms).


I just uploaded version 0.25.

GAME
http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/page.html

CODE ON GitHub

https://github.com/KVonGit/Item-Links-Library/blob/main/item_links.js


Now, it checks for the scope instead of if it was printed by a room description. (I'm learning, albeit slowly.)

I'm scared to try using UNDO. (Maybe after supper.) (UPDATE: It worked!)


Looks great! Why does the game insult me when I examine the table? :-)


Ha! Whoops! Did I leave that in there? That was really a note to myself to make Quest list the contents of the table.

Fixed in v0.28, which I just uploaded. Note the change log:

"0.28: Fixed TV insulting Pertex."

The restriction on duplicate links seems a little odd.

I did a fair bit of messing around with the object links in previous Quest, working around the weaknesses of the system to make it do odd things, and it's starting to sound like this will be more of a headache to work with.

One thing I want to ask (I'm not going to dive head-first into the code when I'm behind schedule on Actual Work Stuff™): Is there a relation between the items visible in the sidebar, and the items which have menus? It seems to me there should be. One of the things that bugged me in Quest 5.7/5.8 was that essentially the same data (scope and verb lists) is passed to the JS frontend twice, making it harder to mess around with.
I would think a more logical system would be "when removing an object from the sidebar, also disable any object link(s) to it", and "when clicking on an object link, get its current verbs list in the same way the sidebar does".


The restriction on duplicate links seems a little odd.

I plan to look into that today. I'm fairly certain there's one little thing I can change in my code to assign each link its own dropdown menu. The onclick is targeting ... Man, I can't recall without looking. I've been messing with so much code recently, I can barely see straight. I'm pretty sure onclick targets the element with the id that matches the obj attribute of the dropdown element. I can probably just make it target the parent's parent (parent?) to fix the duplicate thing.

It throws me off when a dupe pops up and disables the previous one, and I know to expect that behaviour.


it's starting to sound like this will be more of a headache to work with.

I think there are two things making it seem this way:

  1. I only speak JS on an elementary level.
  2. I don't fully grasp how Quest 6 handles quite a few processes.

I would think a more logical system would be "when removing an object from the sidebar, also disable any object link(s) to it", and "when clicking on an object link, get its current verbs list in the same way the sidebar does".

I just made the links get their verbs the same way the sidebar does last night. (It's got it's own script, though.)

Using the same script to handle the object links is a great idea. This is currently an included-but-optional library, though. So, I'd hate to make either thing dependent on the other.

What am I thinking? My library can just modify the script that handles the side pane to do the link stuff, too. (Duh!)


I'm off to try to kick the dropdown menus' butts!


Alrighty . . .

Someone try to break this, please:

http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/page.html


I honestly can't wait to hear what I've overlooked.


So except for one little thing that we don't need to pay attention to, it seems to be working. But something else caught my eye:

The cellar is small, dimly lit, and dingy. It sure is nice of XanMag to let you and Ralph stay here, though!

You can see Ralph, a light switch, a table (on which you see a Grue Bot 5000 and a box (containing a doohickey)), and a TV here.

You can go up.

> take all

Light switch: You can't take it.

Table: You can't take it.

Box: Taken.

Doohickey: Taken.

TV: You can't take it.

Why were Ralph and the Grue Bot 5000 not taken, that is, not even attempted to be taken?

Another issue:

You can see Ralph, a light switch, a table (on which you see a Grue Bot 5000 and a box (containing a doohickey)), and a TV here.

You can go up.

> take box

Taken.

> i

You are carrying a box, a cigarette, a mask, and a purple lighter.

In the inventory it does not show the contents of containers

If I remember correctly, you display the version notes and help in iframes? That's only in your test game, but not in QuestJS in general, right?


Why were Ralph and the Grue Bot 5000 not taken, that is, not even attempted to be taken?

Hmm... It must completely ignore NPCs. It would make sense to print a response for them, too, I think.


In the inventory it does not show the contents of containers

Curses! That should be easy to fix.


If I remember correctly, you display the version notes and help in iframes? That's only in your test game, but not in QuestJS in general, right?

Correct.

Well, I put the help text that already existed into an iframe. (I hate it when lots of text prints and it scrolls down past it all to the end.) And I added all the version note stuff to the code.


So except for one little thing that we don't need to pay attention to

Ooh! A mystery?!? What is it? (Tell me in a DM if it's inappropriate for the forum.)

(I don't really want you to tell me if you'd rather not, by the way. Stay in your comfort zone, if applicable.)


Hmm... It must completely ignore NPCs.

I think that may be just how Quest 6 handles it. Does it need a response? Do players expect GET ALL to include NPCs?


Does it need a response? Do players expect GET ALL to include NPCs?

I usually mark my NPCs as not included in GET ALL, but they usually have a funny response if you try to take them individually.

Now I'm wondering if that might be off-putting to some players. I don't know... It seems logical to exclude things (or people) that someone wouldn't normally try to take, but it also seems logical to list every item listed in the description when attempting to TAKE ALL.

Logic ...

Circuits ...

Overloading ...


Well, you can take the Grue Bot 5000 in my game. So, excluding it from GET ALL seems confusing, but I can most assuredly just change one setting to include it, I bet.

That grue bot is gonna be making me do all sorts of coding. It is an NPC, a container, a surface, and you can take it. I plan to try to code things so Quest can differentiate what items are in it, on it, and being held by it. (This may already be how it works. I haven't tested it yet.)


Well, I put the help text that already existed into an iframe. (I hate it when lots of text prints and it scrolls down past it all to the end.) And I added all the version note stuff to the code.

OK, then it does not matter. If you first output the help, then the release notes, the same text is displayed in both IFrames.

Ooh! A mystery?!? What is it? (Tell me in a DM if it's inappropriate for the forum.)

:-))))) No, no mystery. If you leave the room, the links will be removed. When you re-enter the room, the links are not restored. But this is absolutely insignificant to put more time into it.


If you first output the help, then the release notes, the same text is displayed in both IFrames.

Ah! I never would have thought to test that!

Thank you!


When you re-enter the room, the links are not restored.

You mean the old links in the previously printed room description; right? (This makes me wonder how this works in Quest 5. I've never even paid any attention to that.)


I've said it before, and I'll say it again: Pertex is [EXPLETIVE DELETED] awesome!


I can most assuredly just change one setting to include it, I bet.

I only had to set w.Grue_Bot_5000.excludeFromAll to false.


Alrighty . . .

I just uploaded version 0.39.

http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/page.html


I think I covered everything Pertex pointed out.

Whoever finds bugs now gets 1,000,000 imaginary Quest points for each bug! (Pertex gets double points due to his accumulated input up until now.)


You mean the old links in the previously printed room description; right? (This makes me wonder how this works in Quest 5. I've never even paid any attention to that.)

They don't reactivate. But they're disabled when they go out of scope, rather than when you leave the room (so if you pick an object up, its link in the previous room's description is still active).
Changing it to reactivate links when the object comes back into scope would be a 1-line change to the javascript, if anyone wanted it that way.


They don't reactivate. But they're disabled when they go out of scope, rather than when you leave the room (so if you pick an object up, its link in the previous room's description is still active).
Changing it to reactivate links when the object comes back into scope would be a 1-line change to the javascript, if anyone wanted it that way.

I just changed it. I looked at a Quest 5 game, and the links are active when an object is in scope, and disabled otherwise (as you just described). Now, my links behave the same way.

I also made a few other minor adjustments.

Version 0.40 of the test game is now uploaded.

http://media.textadventures.co.uk/games/R-PODbpzSk_rxIcdAq1RQA/page.html


(I might be done with the item links stuff, unless someone finds whatever I'm probably overlooking.)


Do I get the points?
Give beer to Ralph and Ralph is holding nothing

The Kitchen
A small kitchen.
You can see Ralph (holding a beer; nothing) and a refrigerator here.
You can go down or east.

Oh! You definitely get the points!

I'll fix that this evening.


Until I return, a link to the Item Links documentation (for your perusal (and advice)):

http://media.textadventures.co.uk/games/xWsX6D9IyU6fRwyprp7HDA/index.html


Is there no way to integrate the library with QuestJS?


It already is, in version 0.4. Here is how to activate it:
https://github.com/ThePix/QuestJS/wiki/Hyperlinks


Just for the record's sake:

This is on Ralph:

  nameModifierFunction: (list) => {
	  if (w.Ralph.getContents().length>0){
		  list.push(getAllChildrenLinks(w.Ralph, {article:INDEFINITE}));
		  console.log("list:", list);
		 }
  },

It looks like I need to check that list before adding a duplicate to it.

image


The good news is that it isn't something in the Item Links library. (Pixie probably just let out a sigh of relief.)


Now, I don't know if this is what is supposed to be done, but this fixed it:

  nameModifierFunction: (list) => {
	  if (w.Ralph.getContents().length>0){
		  list = [];
		  let s = getAllChildrenLinks(w.Ralph, {article:INDEFINITE});
		  list.push(s);
		  //console.log("list:", list);
	  }
  },

image



@XanMag

Give Pertex 2,000,000 imaginary points!


Now, I don't know if this is what is supposed to be done, but this fixed it:

I would think that function should do nothing. The line link = [] changes the local variable link to refer to a new array, no longer pointing to the list that was passed to the function.


I would think that function should do nothing.

Yeah . . . It does the trick, though. list exists before that code runs (I found out via console.log(list) in every other line of the code). The way it was coded, it ended up being an array with two duplicate entries. Hence, the extra link for the mask. So, I "empty" the list array before pushing to it.

I have no clue why or how this works. (I wish I did.)


I will note that this function fixes the bug in the same way:

  nameModifierFunction: (list) => {
    /* do nothing */
  },

Yeah . . . It does the trick, though.

I'm pretty sure I was right there.

I tried the test game, which shows the bug.

It seems there are two functions adding things to that list.

  • Both do nothing if he isn't holding any items.
  • w.Ralph.nameModifierFunctions[0] adds the "a doohickey" link if he has it
  • w.Ralph.nameModifierFunction adds the string "nothing" if ralph is holding any items (because in the last link I can see to the game, you have this inside the function; if you fix that, it just adds a second copy of the doohickey)

So, I "empty" the list array before pushing to it.

You changed your nameModifyFunction so that it only modifies a local variable which is then discarded when it ends; the bug is fixed because that function now has no effect, leaving the list that was already correct.

Unless I'm very confused here


the bug is fixed because that function now has no effect, leaving the list that was already correct.

Oh. But . . .

First off: yes. You are 100% correct.

Also, I forgot to mention the first problem. I was using this, so it was printing the added "; nothing".

After I changed this to w.Ralph, I noticed it added a duplicate mask to his modifier.

(because in the last link I can see to the game, you have this inside the function; if you fix that, it just adds a second copy of the doohickey)

Precisely.

So, now that we've established how confused I was from the beginning (hehehe, and still am), I must say that I don't know how list gets that modifier on it in the first place if that function's existence is what causes the duplicate issue.

I'm not saying that isn't the case. I'm just confused as to how the name modifier works.


it only modifies a local variable which is then discarded when it ends

Snap! I would have to at least return list to change the list which exists outside of that function; wouldn't I? I'm a goof-ball.


I would think that function should do nothing.

I misinterpreted that. I see now, though.

...but I still don't know how nameModifierFunction works.

I thought nameModifierFunctionhad to push the function to nameModifierFunctions before anything would work.

You know what? I've probably got some other code doing this, too, or something. It's probably nothing to do with nameModifierFunction. I'll go comb through it and see if I can learn a little something.


...but I still don't know how nameModifierFunction works.

As far as I can see, util.getNameModifiers first loops over the item's nameModifierFunctions array, running all of those functions, and then it finally runs the script in nameModifierFunction.

The array seems to be populated automatically by various types, such as npc, surface, openable, etc.
Ralph has a function there to list what he's carrying and/or wearing, because he is an NPC.

So I would assume that the singular nameModifierFunction is intended to be used if you want a specific object to override the modifiers added by its type(s).


Snap! I would have to at least return list to change the list which exists outside of that function; wouldn't I?

No; you'd need to modify the Array that list points to, without changing list to point to a different Array.

If you want to clear the list for some reason, you'd have to use:

while (list.length) { list.pop() }

or something similar.


Ralph has a function there to list what he's carrying and/or wearing, because he is an NPC.

I found the similar function for containers, but I didn't see one for NPCs. It seems that I didn't look hard enough.

I'll be honest: 80% of my original code was reinventing wheels. I got rid of most of the excess once I discovered the existing functions that did the same thing. There's probably still some code in my library that could be done away with.


If you want to clear the list for some reason, you'd have to use:
while (list.length) { list.pop() }

I see. That way, I'm not redefining list within the block. I'd actually be altering the actual list.

Learning: it's a process. I do very much appreciate all the help!


To be clear, mrangel, I wasn't saying you weren't right. I was just saying that the change I made to the code seemed to solve the issue, and that I didn't understand what was happening.

I understand now, though, thanks to you, sir.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums