Movable Compass

K.V.

The compass shall no longer get in my way.

http://textadventures.co.uk/games/view/6zbqlw5souownbtgimryha/compass-fun

image

UPDATED (made the compass 'window' smaller, just for jmne)

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Compass Fun">
    <gameid>1c3b8b57-8de2-4f10-a14f-4cfc2afc9186</gameid>
    <version>0.0.2</version>
    <firstpublished>2017</firstpublished>
    <commandpane />
    <feature_advancedscripts />
    <statusandcompassattop />
    <description>The compass will no longer get in my way.</description>
    <author>K.V.</author>
    <start type="script"><![CDATA[
      msg ("<div id='compassHolder' style='display:none;'></div>")
      JS.eval ("$('#compassLabel').appendTo($('#compassHolder')).css('display', 'none');$('#compassAccordion').insertAfter($('#compassLabel'));var ch = $('#compassHolder');ch.dialog({height: 200, width: 245,close: function(){ch.dialog('close');}});ch.dialog('option', 'title', 'Compass');ch.dialog('open');openCompass = function(){ch.dialog('open');};$('.ui-dialog').css('position', 'fixed');")
    ]]></start>
    <inituserinterface type="script">
      JS.setCommands ("SHOW COMPASS", "black")
    </inituserinterface>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="northern room">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="southern room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <command name="view_compass_command">
    <pattern>view compass;open compass;compass;show compass</pattern>
    <script>
      JS.openCompass ()
      game.notarealturn = true
    </script>
  </command>
  <object name="northern room">
    <inherit name="editor_room" />
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="southern room">
    <inherit name="editor_room" />
    <exit alias="north" to="room">
      <inherit name="northdirection" />
    </exit>
  </object>
</asl>

Yoda has spoken -- a JS master you are!


K.V.

Well, thank ya', thank ya' very much.

...but I just adapted some of Pixie's code from an old thread to make this work.

...and mrangel taught me an awful lot about JS, or I'd still be scared of it.

I think I learned a thing or ten about coding from you, as well, Dcoder.

And let's not forget DL, XM, HK, Jay, Alex, and everyone else in the Quest community!

Thanks, everyone!

Here's the code to do the same thing with the map:

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Map Window">
    <gameid>56728b4b-05c9-4250-8acd-509fa05b1aeb</gameid>
    <version>0.0.2</version>
    <firstpublished>2017</firstpublished>
    <gridmap />
    <feature_advancedscripts />
    <commandpane />
    <statusandcompassattop />
    <start type="script"><![CDATA[
      JS.eval ("$('#gamePanelSpacer').height(0);")
      msg ("<div id='mapHolder' style='display:none;'></div>")
      JS.eval ("$('#gridPanel').appendTo($('#mapHolder')).css('position', 'absolute');var mh = $('#mapHolder');mh.dialog({height: 400, width: 700,close: function(){mh.dialog('close');}});mh.dialog('option', 'title', 'Map');mh.dialog('open');$('.ui-dialog').css('position', 'fixed');openMap = function(){mh.dialog('open');};")
    ]]></start>
    <inituserinterface type="script">
      JS.setCommands ("SHOW MAP")
    </inituserinterface>
  </game>
  <command name="view_map_command">
    <pattern>view map;open map;map;show map</pattern>
    <script>
      JS.openMap ()
      game.notarealturn = true
    </script>
  </command>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="another room">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="southern room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="west" to="western room">
      <inherit name="westdirection" />
    </exit>
    <exit alias="east" to="eastern room">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="another room">
    <inherit name="editor_room" />
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="north" to="northern room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="northern room">
    <inherit name="editor_room" />
    <exit alias="south" to="another room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="southern room">
    <inherit name="editor_room" />
    <exit alias="north" to="room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="western room">
    <inherit name="editor_room" />
    <exit alias="east" to="room">
      <inherit name="eastdirection" />
    </exit>
    <exit alias="west" to="western balcony">
      <inherit name="westdirection" />
    </exit>
  </object>
  <object name="western balcony">
    <inherit name="editor_room" />
    <exit alias="east" to="western room">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="eastern room">
    <inherit name="editor_room" />
    <exit alias="west" to="room">
      <inherit name="westdirection" />
    </exit>
    <exit alias="east" to="eastern patio">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="eastern patio">
    <inherit name="editor_room" />
    <exit alias="west" to="eastern room">
      <inherit name="westdirection" />
    </exit>
    <exit alias="east" to="side yard">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="side yard">
    <inherit name="editor_room" />
    <exit alias="west" to="eastern patio">
      <inherit name="westdirection" />
    </exit>
  </object>
</asl>

K.V.

Hey...

I just now noticed that the dialog windows don't move down when the text scrolls.

(There's probably a trick that will fix that.)


EDIT

Yep... It wasn't really a trick, I just had to set the element's position to fixed.

I edited the code.


Did you make the compass bigger instead of smaller? What?


K.V.

Did you make the compass bigger instead of smaller? What?

Okay. I made it smaller. (PSA: You can resize that just like a normal window, too.)


KV the JS Master = KV the Jedi Scripting Master

(HK has his witty moments now and then! lol)


Dang...


K.V.

I'm just bumbling around...

You guys just wait until mrangel gets his laptop fixed, or until Pixie gets a break from work.

One of them is (or both of them are) likely to drop some tips on me concerning each of these scripts.


Keeping this thread alive


Noticed the map is not centered in the popup. This will make the player dot jump to the left in popup when moving player and have to keep sliding the map over in the popup.
Should the map be centered somehow on my end(sounded weird) or in the script?

Cheese and Rice... Do I have to do everything myself?
:p Nyuck nyuck


K.V.

What'chu talkin' 'bout, Willis?

This code is for the compass, not the map.

Do we need to make the map behave itself when inserted into a dialog box? (We can probably do that.)


You said:
'Here's the code to do the same thing with the map:

Details'

Look up Fred. ten posts up...


K.V.

Oh!

So I did!

I completely forgot about that (and some dummy hid it in a <details> element)!


I'll check it out.

I don't know which one of my personalities wrote that script, but one of us can surely fix it!


K.V.

Hrmm...

It isn't quite centered.

The yellow dot stays in the same place in my window. The map moves, and the yellow dot moves with it, but, after about 100 milliseconds, the yellow dot jumps right back in its place.

You know... I think that yellow dot should be in the center, Forgewright!

Does this look right?

WATCH THE SHORT EXAMPLE VIDEO

If so, try this:

<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <game name="Map Window">
    <gameid>56728b4b-05c9-4250-8acd-509fa05b1aeb</gameid>
    <version>0.0.3</version>
    <firstpublished>2017</firstpublished>
    <gridmap />
    <feature_advancedscripts />
    <commandpane />
    <statusandcompassattop />
    <start type="script"><![CDATA[
      JS.eval ("$('#gamePanelSpacer').height(0);")
      msg ("<div id='mapHolder' style='display:none;'></div>")
      JS.eval ("$('#gridPanel').appendTo($('#mapHolder')).css({'left':'63%','position':'absolute'});var mh = $('#mapHolder');mh.dialog({height: 400, width: 700,close: function(){mh.dialog('close');}});mh.dialog('option', 'title', 'Map');mh.dialog('open');$('.ui-dialog').css('position', 'fixed');openMap = function(){mh.dialog('open');};")
    ]]></start>
    <inituserinterface type="script">
      JS.setCommands ("SHOW MAP")
    </inituserinterface>
  </game>
  <command name="view_map_command">
    <pattern>view map;open map;map;show map</pattern>
    <script>
      JS.openMap ()
      game.notarealturn = true
    </script>
  </command>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
    <exit alias="north" to="another room">
      <inherit name="northdirection" />
    </exit>
    <exit alias="south" to="southern room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="west" to="western room">
      <inherit name="westdirection" />
    </exit>
    <exit alias="east" to="eastern room">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="another room">
    <inherit name="editor_room" />
    <exit alias="south" to="room">
      <inherit name="southdirection" />
    </exit>
    <exit alias="north" to="northern room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="northern room">
    <inherit name="editor_room" />
    <exit alias="south" to="another room">
      <inherit name="southdirection" />
    </exit>
  </object>
  <object name="southern room">
    <inherit name="editor_room" />
    <exit alias="north" to="room">
      <inherit name="northdirection" />
    </exit>
  </object>
  <object name="western room">
    <inherit name="editor_room" />
    <exit alias="east" to="room">
      <inherit name="eastdirection" />
    </exit>
    <exit alias="west" to="western balcony">
      <inherit name="westdirection" />
    </exit>
  </object>
  <object name="western balcony">
    <inherit name="editor_room" />
    <exit alias="east" to="western room">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="eastern room">
    <inherit name="editor_room" />
    <exit alias="west" to="room">
      <inherit name="westdirection" />
    </exit>
    <exit alias="east" to="eastern patio">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="eastern patio">
    <inherit name="editor_room" />
    <exit alias="west" to="eastern room">
      <inherit name="westdirection" />
    </exit>
    <exit alias="east" to="side yard">
      <inherit name="eastdirection" />
    </exit>
  </object>
  <object name="side yard">
    <inherit name="editor_room" />
    <exit alias="west" to="eastern patio">
      <inherit name="westdirection" />
    </exit>
  </object>
</asl>

We should all pitch in and buy Mr.Angel a new laptop and then go and finish Pixie's project for him :P

Anonynn.


K.V.

1. I think Angel got his PC back up and running, but he does sell books. I believe he'd have more time for Quest if we all bought some.

https://www.amazon.com/Angel-Wedge/e/B00N5Q5XIK/ref=dp_byline_cont_ebooks_1


2. I think we need at least one PhD to be qualified to do Pixie's day job.


3. Hey! What are you trying to say? I'm slacking?

(I'm kidding. It's not like I don't constantly tell you guys and gals that I really don't know what I'm doing. I knew nothing about HTML, CSS, or JS until last April, and I didn't discover Quest until last June..)


Looks good KV!


Heheh

I'm slacking for sure. I should be on this forum trying to help people too. I'm not sure what to study though to get better at this type of coding or a coding that compliments it. I would love to be able to share all the knowledge I've gained over the past two years.

Anonynn.


I'm not being too helpful lately, bouncing back and forth between too many projects and trying not to panic.
Got a couple of projects on the run at once. Including translating the VB bits of the Quest server into javascript (got it to parse the XML file and tokenise identifiers), playing around with the map system (I don't like it. It should be able to automatically stretch exits if they don't quite line up), and playing with my CharacterCreationLib.

I'll try to get back in the swing of offering advice when the panic over the latest book isn't turning my brain into a panic factory.


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

Support

Forums