bye to the by

I would like to either get rid of or change the word 'by', that is placed automatically in front of the author's name. It just looks a bit 'shabby' to just have it say 'by' when it could read or be edited to read "...another fine Interactive Fiction from the pen of..." or something to that effect in a nice text format.

-=Darchy=-


On the set up tab of the game object, untick the checkbox "Display title and author...". Then go to the scripts tab, and in the top one, have it print whatever you want. For instance:

PrintCentered(game.gamename)
PrintCentered("...another fine Interactive Fiction from the pen of..." + game.author)

You might want to mess with fonts and sizes and stuff too (setting them back to normal after).

SetFontSize (18)
PrintCentered(game.gamename)
SetFontSize (14)
PrintCentered("...another fine Interactive Fiction from the pen of..." + game.author)
SetFontSize (10)

Thanks The Pixie,

I must have had a bit of a 'doh!' moment lol - nice and simple just the way I like it - thanks!

-=Darchy=-


You can do this, too:

<template name="By">...another fine Interactive Fiction from the pen of</template>

NOTE: The text will be centered.


<!--Saved by Quest 5.7.6404.15496-->
<asl version="550">
  <include ref="English.aslx" />
  <include ref="Core.aslx" />
  <template name="By">from the mind of</template>
  <game name="Byline">
    <gameid>a4104412-103b-4ac7-914b-e03fc8ff2ba5</gameid>
    <version>1.0</version>
    <firstpublished>2017</firstpublished>
    <author>KV</author>
    <subtitle>An Interactive Myth</subtitle>
  </game>
  <object name="room">
    <inherit name="editor_room" />
    <object name="player">
      <inherit name="editor_object" />
      <inherit name="editor_player" />
    </object>
  </object>
</asl>

Pixie's way is much better. (I'm just bored this morning.)


Hehehe - Thanks K.V Now I have to look into templates :D


I didn't think that would work KV. I didn't realise the function 'StartGame' used the 'By' template.


Hopefully ALL text that appears in a game uses templates so it can be translated to another language. In the next version of Quest that will also be true of the editor (it is for much of it already).


I was just playing around with a game in Spanish.

It was pretty nifty.

Code View was mostly in English, but a lot of that displayed in Spanish in the GUI and the game.

I also modified one template in this example, nesting it in an element with a title that has the English translation. (I'm easily entertained today.)

<template name="UnrecognisedCommand"><![CDATA[<span title='I didn&#8217;t understand your command.' style='cursor:pointer;text-decoration:underline'>No entiendo tu orden.</span>]]></template>

http://textadventures.co.uk/forum/design/topic/kamy7xa3peai1looklanfq/verbs#a336964c-7ba0-4118-9bb8-e988cc66c1da


IMPORTANT NOTE:

If any other script calls the "By" template, like YOU CAN SEE A POKER BY THE FIREPLACE, it would say YOU CAN SEE A POKER from the mind of THE FIREPLACE.

I don't think Quest uses that template for anything of that nature, but it is a possibility and another reason why Pixie's method is superior. (Like I say, I'm just bored and playing around with stuff today.)


I don't think Quest uses that template for anything of that nature

I'm pretty sure it doesn't. In fact, I think there's at least a few places where there are different templates with the same word in, because they're used in different contexts and might not be the same word in all languages.


By the by...

Core/Core.aslx: PrintCentered ("<br/><span style=\"font-size:140%\">[By] " + game.author + "</span>")

That's the only thing I see when I search for it with grep. It looks like it's safe.


Getting really dangerous now:

It can be done with only this:

Start Script:

JS.eval ("$('#divOutput').html($('#divOutput').html().replace(/by "+game.author+"/g,'from the mind of "+game.author+"'));")

@ K.V

Looks like I opened a can of worms lol - I sort of get worried when I see JS.eval, as I don't trust my progrmming skills enough to poke around or fully understand it all. I tried to implement a vertical scroller with some old JS code from my now defunkt website for a credits scroller and I found I was really out of my depth at that point, but I shall have a 'snoot' at this later.


If you're doing that JS, you could also try…

  JS.eval ("$(':contains([By] "+game.author+"):not(:has(*))').text('from the mind of "+game.author+"')")

(Explanation: :contains(by Bob Smith) finds all nodes which contain the given text. :not(:has(*)) filters that list to nodes that don't contain other HTML elements, so we have found the innermost <span> element containing that text. This is possibly more efficient; as modifying HTML means that the browser has to parse it all again)


Going back a bit. I thought you had to specify the template being used. The 'StartGame' function doesn't seem to do that, as KV and mrangel are pointing out, the 'by' looks as though it is just part of the message to be printed. So not sure how it works.


Core.aslx specifies it:

 PrintCentered ("<br/><span style=\"font-size:140%\">[By] " + game.author + "</span>")

mrangel,

That code works perfectly.

Very nice!


Log in to post a reply.

Support

Forums