Stackable transparent images + preloading stuff.

I'm curious about 2 things.

1. Stacking pictures


Using SetFloatingImage (), is it possible to stack pictures?

I have a map which the player can show/hide by typing map. I wonder if it's possible to add a transparent PNG on top of it containing only a marker so that the player can keep track of his/her whereabout?

And since this would involve a whole lot of pictures (one transparent picture / room) I wonder...

2. Preloading


... if it's possible to preload all said pictures at the start of the game to prevent annoying delays when showing the map (especially if the player decide to have the map open while switching rooms)?


You can certainly stack images. I have experimented with that for a different approach to maps. See "One Image On Top of Another" here:
http://docs.textadventures.co.uk/quest/images.html


I think having that many transparent images would be a little inefficient. Maybe better to have a single (small) image of the "you are here" dot, and give each room a parameter specifying the coordinates (in pixels from the corner of the map image) where the marker should be placed.


Thanks Pix & mra!

@pix
I would like to, if possible, avoid using css for this. I've changed the UI a lot and I'm afraid I'll break it. Hence my original question if it's stackable using SetFloatingImage ()?

@mra
I was thinking along those lines at first too. And it's, just like you're saying, the most efficient way to do it. The thing is.. I don't know how to. =)


Hmm ... some javascript:

function movePlayerPointer(x, y, url) {
  var map = $("#gameMap");
  var pointer = $("#gameMapPointer");
  if (url) {
    map.attr("src", url);
  }
  if (pointer.length = 0) {
    pointer = $("<img>", {id: "gameMapPointer", src: you_are_here}).insertAfter(map).hide();
  }
  var target_coords = map.offset();
  target_coords["left"] += x;
  target_coords["top"] += y;
  if (pointer.is(":hidden") && !pointer.parent().is(":hidden")) {
    pointer.css("position", map.css("position"));
    pointer.show();
    pointer.offset(target_coords);
  } else {
    pointer.animate(target_coords, 300);
  }
}

(Assuming that you already have an image whose id is "gameMap". You might have to change that depending on how you're loading the map image in the first place)
In this example I've used a JS variable for the "you are here" pointer. You'd want to put something like JS.eval("you_are_here = '"+GetFileURL("YouAreHere.png")+"';") in your UI initialisation script; or replace the variable you_are_here with a string URI if the file is hosted externally.

The function should be able to be called with JS.movePlayerPointer(room.xcoord, room.ycoord, room.mapimage) (or whatever the attributes are called); probably in a roomenter script or similar.

I added the optional 3rd parameter in case you have different map images (for different floors of the dungeon or whatever). That way, it will replace the map with the right one as well as moving the pointer.
The code is a little more complex than it needs to be, in the hope that it would not be broken by any odd CSS in your game. (It forces the pointer to have the same positioning model and parent as the map image itself)

Just off the top of my head, so a rough approximation, but maybe you can start with something like this.


Thank you MrA! I have it all set up except for this line right here...
JS.movePlayerPointer(room.xcoord, room.ycoord, room.mapimage)

I'm not entirely sure what to do. Should I give each room 2 attributes? (xcoordand ycoord)?
If so, I guess it should be an Int attribute where the number stated is the number of pixels?


That was the idea :)
I figured you probably know Quest code well enough to figure out what to do with it. The function just takes 3 arguments; an X, a Y, and the map URL. If you omit the last one, it should leave the current image in the map.

I'm assuming that you already have a <img id="gameMap" src="whatever your URI is" /> somewhere onscreen, however you're choosing to display it. If the ID is different, just change it in the first line.

(Note: I have no idea if this will work if the map is sticky. I'd hope so, but don't count on it)

(Note2: The X coordinate is the distance between the left edge of the map image and the left edge of the pointer image; so when picking the coordinates it might be necessary to allow for the width of the pointer. Same for Y.)

(Note3: If you want to hide the map, it's best to put it inside a div and then hide that, so the pointer is hidden too. When it becomes visible again, the pointer might end up positioned relative to the containing div rather than the map, because offset() returns nothing for hidden elements, but it'll go back to the right place as soon as it's moved)


I figured you probably know Quest code well enough to figure out what to do with it


You obviously think way too highly of me! =)

The current set up is this:

I have a commando called map. When the player enters it this happens:

JS.SetFloatingImage ("http://www.rockstrom.com/tgs/act2/mapnml.png")

, unless it's already out, if so, this happens:
JS.eval ("$('#gameMap').remove();")

And the script :

SetFloatingImage = function (image) {
  var pane = $("#gameMap");

 
  if (!pane.length) {
    pane = $("<img>", {id: "gameMap"}).appendTo("#divOutput").css({position: "fixed", right: 20, top: 50});
  }
  pane.attr("src", image);
};

I added the 'coordinates' (room attributes xcoordand ycoord but wasn't able to get it to work.
The map pops up but not the little "you are here-image".
I'll try again tomorrow, a bit too tired atm.

Thanks for everything!

Edit: I got the java script from K.V.... I added it but can't say I understand it.


K.V.

I don't remember this, and it doesn't look like my dialect:

SetFloatingImage = function (image) {
  var pane = $("#gameMap");

 
  if (!pane.length) {
    pane = $("<img>", {id: "gameMap"}).appendTo("#divOutput").css({position: "fixed", right: 20, top: 50});
  }
  pane.attr("src", image);
};


I probably would have written that more like this:

pane = $("<img id='gameMap'/>).appendTo('#divOutput').css({position: 'fixed', right: 20, top: 50});

...but that is changing what pane is pointing to...

First it's the element with the id "gameMap", then it....

What is that code doing?

The gameMap element should always have a length, even if it is 0. (I think.)


Try this (untested; don't lose your current code!):

SetFloatingImage = function (image) {
  $('#gameMap').remove();
  var  pane = $('<img id=\'gameMap\' src=\''+image+'\' />');
  pane.appendTo('#divOutput');
  pane.css({position: 'fixed', right: 20, top: 50});
}; 
I HATE WHEN IT SAYS I CAN'T POST STUFF!!!

There could be errors in my code. I've been in a panic all day, mostly posting untested stuff, trying to escape anxiety over other things (no sales this month; only a week left to edit an entire novel; toothache; and heard that my grandma died this morning) so might be a little sloppy.

Are there any errors on the javascript console? Or do you have an online version of the game so I can try poking it with a debugger?


K.V.

This works for me:

(in "User Interface Initialisation"):

JS.eval ("setFloatingImage = function (image) {  $('#gameMap').remove();  var  pane = $(\"<img id='gameMap' src='\"+image+\"' />\");  pane.appendTo('#divOutput');  pane.css({position: 'fixed', right: 20, top: 50});};")

Example game:


<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Help Cheese">
    <gameid>964dd7f0-f72a-4f7b-969d-d8054a75d95b</gameid>
    <version>1.0</version>
    <firstpublished>2018</firstpublished>
    <cover>back.png</cover>
    <feature_advancedscripts />
    <inituserinterface type="script"><![CDATA[
      JS.eval ("setFloatingImage = function (image) {  $('#gameMap').remove();  var  pane = $(\"<img id='gameMap' src='\"+image+\"' />\");  pane.appendTo('#divOutput');  pane.css({position: 'fixed', right: 20, top: 50});};")
    ]]></inituserinterface>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.setFloatingImage (GetFileURL("back.png"))
    </beforeenter>
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="second room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="second room">
    <inherit name="editor_room" />
    <beforeenter type="script">
      JS.setFloatingImage (GetFileURL("back2.png"))
    </beforeenter>
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <javascript src="javascript.js" />
</asl>

I don't remember this, and it doesn't look like my dialect:

It looks like 'standard' jQuery code; following the style guides in the manuals. I don't see any errors in it.

Answering what looks like some confusion

...but that is changing what pane is pointing to...
First it's the element with the id "gameMap", then it....

First it does var pane = $("#gameMap");, which creates a selector object (essentially a list with some extra functions) containing all elements with the id "gameMap". If that list has length 0 (the image doesn't already exist) it creates it, and assigns pane to be a selector containing the newly created image element. So either way, pane is now an element with that ID, which the code can then set the 'src' attribute of.

The gameMap element should always have a length, even if it is 0. (I think.)

$("#someId") gives a selector object, not actually an element. Because id's are supposed to be unique, in this case the selector probably gives a list with 0 or 1 elements. if (!pane.length) { <- remember that in javascript, 0 counts as false. And ! is the "not" operator. So that if statement executes if the length is zero; if there is no element with the specified ID.

That code should do exactly the same as the version you have; except that when the element already exists, it doesn't delete and recreate it.


K.V.

It looks like 'standard' jQuery code; following the style guides in the manuals. I don't see any errors in it.

Exactly!

That is proof that I didn't do it!

Bwahahahaha!

It's funny to me, but it is true.

I do it like this:

$('<img id=\'gameMap\' src=\''+image+ '\' />')

...not like this:

$("<img>", {id: "gameMap"})


I don't know the fundamentals. I just use things that I've picked up here and there which work during testing.


Sorry guys, my mistake. Seems I got the code from you MrA :)

On my way to work now so I can’t test anything. I’ll try your stuff later. Thanks both of you!

(I hear you MrA. Very sorry to hear about your grandmother. Hang in there!)


(I could PM; but I'll post here in case someone else finds this post in a search and has the same problems with my code)

OK, 2 dumb errors in my code I spotted so far.

First, I missed function at the beginning. Second, I had = instead of ==.
A few more tweaks, to make it work dynamically.

Changed:

movePlayerPointer = function(x, y, url) {
  var map = $("#gameMap");
  if (map.length && map.is(":visible")) {
    if (url) {
      map.attr("src", url);
    }
    var pointer = $("#gameMapPointer");
    if (pointer.length == 0) {
      pointer = $("<img>", {id: "gameMapPointer", src: "http://www.rockstrom.com/tgs/act2/urh.png"}).insertAfter(map).hide();
    }
    var target_coords = map.offset();
    target_coords["left"] += x;
    target_coords["top"] += y;
    if (pointer.is(":hidden")) {
      pointer.css("position", map.css("position"));
      pointer.show();
      pointer.offset(target_coords);
    } else {
      pointer.animate(target_coords, 250);
    }
  } else {
    // map is hidden
    mapPointerArgs = [...arguments];
  }
};

hideGameMap = function() {
  $("#gameMap,#gameMapPointer").hide();
};
showGameMap = function() {
  if ($("#gameMap").length) {
    $("#gameMap").show();
  } else {
    SetFloatingImage ("http://default.url.here/map.png");
  }
  if (mapPointerArgs) {
    movePlayerPointer.apply(null, mapPointerArgs);
  }
};

I loaded your game and entered this function in the Javascript console, and it seems to work.

Couple of other things:
The suggestion to use GetFileURL in your UI initialisation script was just for handling the address of files included in your published game. If the image is hosted externally, you can just put the URL in the script (like I did above).

The example I gave for how to call this function wasn't supposed to be real code; just an example. (room should be replaced with the appropriate room).

If there's only a few rooms, then you could just put in the room enter script for each something like:
movePlayerPointer(120, 210, "http://www.rockstrom.com/tgs/act2/mapnml.png")
with the right numbers for the coordinates

Or if many rooms have a map, you could put in your roomenter script (the one on the game object, that runs whenever you enter a room):

room = game.pov.parent
if (HasInt(room, "xcoord") and HasInt(room, "ycoord")) {
  if (HasString (room, "mapimage")) {
    if (IsRegexMatch("^(\w+:|//)", room.mapimage)) {
      JS.movePlayerPointer (room.xcoord, room.ycoord, room.mapimage)
    }
    else {
      JS.movePlayerPointer (room.xcoord, room.ycoord, GetFileURL(room.mapimage))
    }
  }
  else {
    JS.movePlayerPointer (room.xcoord, room.ycoord)
  }
}

Which will move the pointer to the right position for any room with xcoord and ycoord (and change the map to the right one if the room also has a "mapimage" attribute containing a URL)

I've also added functions you can call as JS.showGameMap() and JS.hideGameMap() - these should make the pointer appear in the right place if you move around before using it; but I haven't fully tested them.


K.V.

No need to apologize, Cheese. I was just putting the facts out there. (You never know when the facts might save the day!)


I just now saw the Invisiclues... (I was reading those posts on my phone, and I didn't even recognize the pattern that way.

[My condolences, mrangel.]


(now you've got me thinking… rather than storing the arguments in a global variable so that the map can be displayed correctly, would it be better to put them as attributes on an invisible element in the output? That way, when reloading a saved game, the script would be able to redraw the map correctly. Maybe even stick a <script id="mapScript" mapDisplayed="1" xcoord="99" ycoord="104" mapimage="http://some_url">var data = $("#mapScript"); if (data.attr("mapDisplayed")) { movePlayerPointer( data.attr("xcoord"), data.attr("ycoord"), data.attr("mapimage")); }</script> in the output div and modify its attributes each time movePlayerPointer is called. That way, the map should appear in the same state it was in before when you load a saved game.

(what's the order of execution for loading javascripts included in the Quest file, restoring the saved output, and running UI initialisation scripts? I don't remember)


That looks amazing MRA!
I’m putting my daughter to bed now but I’ll give it a run after. Thank you so much!!!


K.V.

what's the order of execution for loading javascripts included in the Quest file, restoring the saved output, and running UI initialisation scripts?

This is the order in which things fire in the desktop player:

1: LOADING PLAYERCORE.JS

2: LOADING DESKTOPPLAYER.JS

3: javascript.js function

4: User interface initialisation.

5: Start script.

6: script ELEMENT IN divOutput

7: library_object initialisation

8: library_object js string attribute

9: in-game_object initialisation

10: in-game_object js string attribute

11: before entering room first time

12: before entering room

13: after entering room first time

14: after entering room


...and this is loading a saved game:

1: LOADING PLAYERCORE.JS

2: LOADING DESKTOPPLAYER.JS

3: javascript.js function

4: User interface initialisation.

5: script ELEMENT IN divOutput


Hmm, can't quite get that marker to show up. I'm confuzzled.
Either way; thanks a lot for all the help mrA!
(from here on out it's just me and my inabilities :))
((I shall try to make it work!))


I posted, then edited to make it more stable… just my luck if I added another error.
If you want republish the game, I could try debugging.


It's republished!
(type, "open plate", then "u" to go up to no man's land. I moved the game.pov so you don't have to look at the intro again)

((Oh, only the first two rooms in NML have coordinates. The one you end up in when leaving the hole, and the one directly north of that one))


In the "map" command, you have JS.JS.showGameMap() and JS.JS.hideGameMap(). The repeated JS is the only issue I can see in a quick scan. I guess you're editing in GUI mode :)

(sorry I'm having to throw suggestions back and forth; I don't have the desktop version of Quest, and the web version means I can't actually edit a game file to test it. So if there's still an error, let me know and I'll see if I can track it down)


K.V.

If you guys need help, I can open the game in the desktop editor and apply mrangel's suggested fixes. Just say the word.


oh, and the coordinates for those two rooms should probably be closer to [270,275] and [270,245]

If you're playing around to find the right place, you can enter "javascript:movePlayerPointer(270,275)" or similar in the address bar to move the pointer around while you're playing the game :p

I'm finding that if I use the javascript console to enable the map, the pointer appears in the right place for the last room with coords I was in; but if I move between the two rooms while it's open, the pointer is hidden again, and I have no idea why.


Oh. facepalm

ClearScreen removes the pointer.
In the SetFloatingImage script, you might want to change appendTo( to insertAfter( … but that would result in your map not appearing when you load a saved game.

Or, immediately after clearing the screen, you could add

if (GetBoolean(player, "mapout")) {
  JS.showGameMap()
}

(are you clearing the screen when entering a new room? In that case, you could put those lines at the start of the roomenter script ... not sure if that would cause the pointer to jerk or flicker, though)


Good morning!
I applied all the changes but I just won't see the "pointer img" (this-> ) over the main map.
I've removed everything and started over but.. that little blue dot obviously hates my guts!


Yep, I added more errors ):

EDIT: modified clearScreen function so it removes everything except the map

movePlayerPointer = function(x, y, url) {
  var map = $("#gameMap");
  if (map.length && map.is(":visible")) {
    if (url) {
      map.attr("src", url);
    }
    var pointer = $("#gameMapPointer");
    if (pointer.length == 0) {
      pointer = $("<img>", {id: "gameMapPointer", src: "http://www.rockstrom.com/tgs/act2/urh.png"}).insertAfter(map).hide();
    }
    var target_coords = map.offset();
    target_coords["left"] += x;
    target_coords["top"] += y;
    if (pointer.is(":hidden")) {
      pointer.css("position", map.css("position"));
      pointer.show();
      pointer.offset(target_coords);
    } else {
      pointer.animate(target_coords, 250);
    }
  } else {
    // map is hidden
    mapPointerArgs = [...arguments];
  }
};

hideGameMap = function() {
  $("#gameMap,#gameMapPointer").hide();
};
showGameMap = function() {
  if ($("#gameMap").length) {
    $("#gameMap").show();
  } else {
    SetFloatingImage ("http://www.rockstrom.com/tgs/act2/map.png");
  }
  if (window.mapPointerArgs) {
    movePlayerPointer.apply(null, mapPointerArgs);
  }
};

function clearScreen() {
  var map = $("#gameMap,#gameMapPointer").appendTo("body");
  $("#divOutput").css("min-height", 0);
  $("#divOutput").html("");
  createNewDiv("left");
  beginningOfCurrentTurnScrollPosition = 0;
  setTimeout(function () {
    $("html,body").scrollTop(0);
  }, 100);
  map.appendTo("#divOutput");
};

K.V.

Just so your game isn't lacking a feature in Quest 5.8, you might want to change that clearScreen() to this (which has mrangel's changes added to the recently modified function):

 function clearScreen() {
    var map = $("#gameMap,#gameMapPointer").appendTo("body");
    if (!saveClearedText) {
        $("#divOutput").css("min-height", 0);
        $("#divOutput").html("");
        createNewDiv("left");
        beginningOfCurrentTurnScrollPosition = 0;
        setTimeout(function () {
            $("html,body").scrollTop(0);
        }, 100);
    } else {
        $("#divOutput").append("<hr class='clearedAbove' />");
        if (!clearedOnce) {
            addText('<style>#divOutput > .clearedScreen { display: none; }</style>');
        }
        clearedOnce = true;
        $('#divOutput').children().addClass('clearedScreen');
        $('#divOutput').css('min-height', 0);
        createNewDiv('left');
        beginningOfCurrentTurnScrollPosition = 0;
        setTimeout(function () {
            $('html,body').scrollTop(0);
        }, 100);
    }
    map.appendTo("#divOutput");
}

@KV
Thanks, I hadn't seen that yet. But shouldn't most of that code be outside the 'if' block?
(Didn't we previously prevent #outputData from being cleared, in the same way I'm protecting the map?)


(Actually, I'm thinking there's quite a lot of situations where you might want some part of the output to survive a ClearScreen. Might be possible to put something in core, something like:

function clearScreen() {
    if (!saveClearedText) {
        $("#divOutput").children(":not(.donotclear)").remove();
    } else {
        $("#divOutput").append("<hr class='clearedAbove' />");
        if (!clearedOnce) {
            addText('<style>#divOutput > .clearedScreen { display: none; }</style>');
        }
        clearedOnce = true;
        $('#divOutput').children(":not(.donotclear)").addClass('clearedScreen');
    }
    $('#divOutput').css('min-height', 0);
    createNewDiv('left');
    beginningOfCurrentTurnScrollPosition = 0;
    setTimeout(function () {
        $('html,body').scrollTop(0);
    }, 100);
}

Then we could just do $("#gameMap,#gameMapPointer").addClass("donotclear"); or similar, and not have to modify clearScreen for each specific case.


K.V.

Sold!

Hey...

There's that pesky min-height again...

$('#divOutput').css('min-height', 0);

Can we do away with that here and in addText()? (I did in my most recent build. I see no problems, but you think of things I don't think of quite frequently.)


Pixie! You want this in a pull request?


Can we do away with that here and in addText()?

I've suggested that a few times; but still don't know why it's there at all.

I would suggest removing it from addText(), but leave it here and in HideOutputSection().

My reasoning: If a user has overridden addText, or created some function that sets min-height, they might rely on it being zeroed in clearScreen because that's the existing behaviour. If they haven't then it will always be set to zero (its default value), so explicitly zeroing it has no adverse effects.


Hey, got a lot on my plate atm. I've seen your updates but haven't had the time to actually try it out.
Either way: I appreciate all the help you've guys has supplied me with. I appreciate it like hell!!

Thanks!


@KV
I'm thinking that it might be nice to have a function in playercore like:

function addUIElement (id, html) {
  if ($("#"+id).show().length) {
    return false;
  }
  var element;
  if (!html.match(/^<.+>$/)) {
    element = $("<div>", {id: id}).html(html);
  } else {
    element = $(html);
    if (element.length > 1) {
      element = $("<div>", {id: id}).append(element);
    } else {
      element.attr("id", id);
    }
  }
  element.addClass("donotclear").css({position: "fixed"});
  return id;
}

Then anyone who's adding their own UI elements can use it rather than addText() for spitting out elements which are fixed position, and it sets "donotclear" automatically. Just makes it a little easier (assuming the function gets mentioned in the docs somewhere).

A user making their own UI stuff could do something like:

if (addUIElement('floatingImage', '<img src="loads_of_porn.png" />')) {
  // any initial code which doesn't need to be done if the element exists
} else {
  // modify the element's contents if it already exists
}

In that case, there should probably be positionUIElement and removeUIElement helper functions too.


Warning; huge digression

(And now that's got me thinking: can Quest code not get the return value from a JS function? I remember somebody saying something like that, and now I wonder why)

I'm thinking of something like:

CallJavascript("someFunction(foo)") {
  player.fooness = result
}

That shouldn't be hard to implement. I could do it in Quest code, but it's inelegant:

<function name="CallJavascript" parameters="script,callback">
  if (not HasAttribute(game, "javascriptcallbacks")) {
    game.javascriptcallbacks = NewScriptDictionary()
  }
  id = GetRandomLetter()
  while (DictionaryContains (game.javascriptcallbacks, id)) {
    id = id + GetRandomLetter()
  }
  dictionary add (game.javascriptcallbacks, id, callback)
  JS.eval ("ASLEvent('HandleJSFunctionReturn', id+"/"+eval('("+script+")'));")
</function>

<function name="HandleJSFunctionReturn" parameters="data">
  results = Split(data, "/")
  id = ListItem (results, 0)
  list remove (results, id)
  if (not DictionaryContains (game.javascriptcallbacks, id)) {
    error ("Unexpected JS callback: ("+data+").")
  }
  else {
    script = DictionaryItem (game.javascriptcallbacks, id)
    params = NewDictionary()
    dictionary add (params, "result", Join(results, "/"))
    invoke (script, params)
    dictionary remove (game.javascriptcallbacks, id)
  }
</function>

If this was done in C#, it should be possible to make it use the JS.someFunction("foo") { … syntax, which would be much better. And also, could use the existing JSON code so that the parameters and return value can be JSONed so you can pass and return lists and dictionaries more easily.


K.V.

EDITED

I like the function that elements.


That digression looks similar to this:

https://github.com/KVonGit/QuestStuff/wiki/AslSet--(Set-a-Quest-attribute-from-JS-without-firing-any-turn-scripts)

Should we keep the best from both?

...or does yours already cover everything mine does? (I don't have my eyes all the way open yet, and I haven't tested it. It looks good, though!)


That digression looks similar to this:

Not really. I think you're missing the point of what I was trying to do.

The point of the digression was "do something like JS.someFunction(), but the Quest script that calls it gets the return value". The example I gave was using it to set a Quest attribute, but that's just the simplest thing I could imagine using it for.

Another (silly) example:

CallJavascript ("window.innerWidth") {
  if (result > 2000) {
    msg ("James says: “Wow, what a huge screen you've got!”")
  }
}

Should we keep the best from both?

I think they're like opposite sides of a coin. One is allowing Quest code to access JS variables and functions; the other is allowing JS code to set Quest attributes.


K.V.

The point of the digression was "do something like JS.someFunction(), but the Quest script that calls it gets the return value".

I was trying to do that when I gave up and made ASLSet.

...but I've learned a little C# since then. I shall revisit this.


K.V.

Yeah, I still have no clue how to make JS talk to C#.


Ok, I've changed it again. And again. And again. xD
I'm probably making some stupid mistake but I just can't get the pointer to show up on the map.
I'm thinking about giving up... although that feels kind of sh***y when you guys has put in this much work to help me.


Holy snap Batman!
I checked the online version and get this:

The thing is, this is the first time I can even see the pointer (image). When trying it in desktop mode it just wont show (which makes it really difficult to find the right coordinates cause... you know... I can't see it =))

Now that I've seen it once... I might not give it up. (even though it's way below the actual map, hee hee)


Did you see the one where I suggested some coordinates?

If you want to experiment (online), you can type javascript:movePlayerPointer(270,270) into your browser's address bar to manually move the pointer. This works in Chrome, and I think other browsers too. (Those coords are near the room with the hole)


And don't worry about the amount of time we're spending on it... the last batch of posts have been looking into changes that we could make to the Quest core so that stuff like this is easier to do. (basically, a command like your SetFloatingImage, but modified so that it survives ClearScreen and save/load. Because that would be useful to a lot of game designers)


Oh yes, I've read everything in detail (although I can't understand most of it heehee). I've applied all the changes you've suggested and I still can't get it to work. Not at all while working on it in desktop mode. I can see the pointer when I play in online mode but once I switch rooms is disappear (animated, downwards on the screen... it's quite funny actually.)

I tried javascript:movePlayerPointer(270,270)in both firefox and chrome but must've made some mistake since it get stuck on a loading screen.

the last batch of posts have been looking into changes that we could make to the Quest core so that stuff like this is easier to do.

That is very cool. Then I don't have to feel so bad for stealing your time =)


K.V.

Cheese,

Send it to me. I'll see what I can find with it loaded in the desktop editor.


Will do K.V.! Thanks!
(check your mail in 5 minutes)


K.V.
 function clearScreen() {
    if (!saveClearedText) {
        $("#divOutput").children(":not(.donotclear)").remove();
    } else {
        $("#divOutput").append("<hr class='clearedAbove' />");
        if (!clearedOnce) {
            addText('<style>#divOutput > .clearedScreen { display: none; }</style>');
        }
        clearedOnce = true;
        $('#divOutput').children(":not(.donotclear)").addClass('clearedScreen');
    }
    $('#divOutput').css('min-height', 0);
    createNewDiv('left');
    beginningOfCurrentTurnScrollPosition = 0;
    setTimeout(function () {
        $('html,body').scrollTop(0);
    }, 100);
}
  <function name="msgNoClear" parameters="txt"><![CDATA[
    JS.eval ("$('#divOutput').append(\"<span class='donotclear'>"+txt+"</span>\");")
  ]]></function>
msgNoClear ("I DO NOT CLEAR")
ClearScreen
msg ("AFTER CLEARING")

image


K.V.

I just created a pull request to update clearScreen().


I did not, however, include msgNoClear. There are many ways to handle that, and it is easy to add to a game.

Plus, I feel bad because Pixie has merged like 100 commits to this build, and I'm pretty sure he'd rather not make any more changes.


Is that something I can utilize for the map system KV?
Or does it "only" work with text?


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

Support

Forums