Delayed Verb Appearance [Solved]

In the following test code
http://textadventures.co.uk/games/view/wvjqmlnedu6g_brvapmb6a/test-code
there is a mirror object which when looked at, provides a 'take' verb allowing it to be picked up. When downloaded, the 'take' verb appears immediately after examining the mirror but not when executed online?

Any suggestions for a fix/workaround?


I can't download the game. But it just worked online. I clicked on the mirror and there was only the 'Look at' verb listed. I looked at it and got the description (which I haven't read). When I looked at it again the take verb was there.

I tested to take the mirror before looking at it and it said (something like): ''You can't take it.''

Again, only tested online. I couldn't find the file or download link.


Thanks for looking at this Curt. I should have made clear that 'take' does indeed appear in the hyperlink but not when 'mirror' is selected in the 'places and objects' window. The download is on the RHS if you scroll down.


I see... some of the advanced users may have a fix for the pane issue.

I would workaround by printing showing a menu:

> look at mirror
Just a small mirror but it looks useful. Take it?

1. Yes
2. No


It seems like JS.updateList isn't being called. I'm not sure why not, but I suspect it could be related to the changes made to turnscripts in Quest 5.8.

It should be possible to fix this in Javascript; the displayverbs (or inventoryverbs) of every object is passed from the Quest backend to the browser frontend twice every turn. The function updateList changes the verb buttons for the sidebar, while updateObjectLinks handles the menu for text in the body. So, if Quest is failing to call updateList (which I'm sure used to be called every turn, but now doesn't seem to be), we could correct the verb buttons using the list passed to updateObjectLinks.

Off the top of my head after 10 mins skim-reading playercore.js (not tested)…

updateObjectLinks = function(data) {
    $(".elementmenu").each(function (index, e) {
        var $e = $(e);
        var verbs = data[$e.data("elementid")];
        if (verbs) {
            $e.removeClass("disabled");
            $e.data("verbs", verbs);
            // also set attribute so verbs are persisted to savegame
            $e.attr("data-verbs", verbs);
        } else {
            $e.addClass("disabled");
        }
    });

    // Added this bit to update the sidebar verbs too:
    var selectedItem = $("#lstInventory .ui-selected");
    $.each(inventoryVerbs, function (index, object) {
        var newverbs = data[object["ElementId"]];
        if (newverbs) {
            object["Verbs"] = newverbs.split("/");
            // If this object is currently selected, update the displayed verb buttons
            if (selectedItem.length && object["ElementId"] == selectedItem.data("elementid")) {
                updateVerbButtons(selectedItem, inventoryVerbs, "cmdInventory");
            }
        }
    });

    // And repeat for the other pane:
    selectedItem = $("#lstPlacesObjects .ui-selected");
    $.each(placesObjectsVerbs, function (index, object) {
        var newverbs = data[object["ElementId"]];
        if (newverbs) {
            object["Verbs"] = newverbs.split("/");
            // If this object is currently selected, update the displayed verb buttons
            if (selectedItem.length && object["ElementId"] == selectedItem.data("elementid")) {
                updateVerbButtons(selectedItem, placesObjectsVerbs, "cmdPlacesObjects");
            }
        }
    });
};

or minified ready to paste into your UI initialisation script:

JS.eval("$(function () {updateObjectLinks=function(n){$('.elementmenu').each(function(e,t){var s=$(t),a=n[s.data('elementid')];a?(s.removeClass('disabled'),s.data('verbs',a),s.attr('data-verbs',a)):s.addClass('disabled')});var a=$('#lstInventory .ui-selected');$.each(inventoryVerbs,function(e,t){var s=n[t.ElementId];s&&(t.Verbs=s.split('/'),a.length&&t.ElementId==a.data('elementid')&&updateVerbButtons(a,inventoryVerbs,'cmdInventory'))}),a=$('#lstPlacesObjects .ui-selected'),$.each(placesObjectsVerbs,function(e,t){var s=n[t.ElementId];s&&(t.Verbs=s.split('/'),a.length&&t.ElementId==a.data('elementid')&&updateVerbButtons(a,placesObjectsVerbs,'cmdPlacesObjects'))})};});")

Again mrangel, humble thanks for the rapid response and your ability to deal with these nitty-gritty problems. It is so satisfying to wake up to a solution!

The proposed fix certainly handles the test code posted:
http://textadventures.co.uk/games/view/wvjqmlnedu6g_brvapmb6a/test-code

and also works in the game where I first noticed the problem. I'll add 'solved' to the post when I've had a chance to play the game through in full to make sure there are no side effects.


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

Support

Forums