changing the underline links to bold text

chrisw70
Does anyone know if there's a way to change the default underline links to appear in bold instead; in a way that could be set up once when the game starts?

jaynabonne
Add this function into your game:

  <function name="GetCurrentLinkTextFormat" type="string">
return (GetCurrentTextFormat(GetLinkTextColour()) + "font-weight:bold;")
</function>

This replaces the built-in GetCurrentLinkTextFormat, to add in an additional "font-weight:bold" CSS style for links.

george
Jay, where are you finding these functions? I didn't see them in the function list on the docs site.

chrisw70
Thanks again, Jay!

chrisw70
Is there a certain place to put it in the code, it's making the listed exits in bold/underline...but it's not working on game objects I create, which still show up as in default.

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Prototype Demo">
<inherit name="theme_novella" />
<gameid>c59f435c-2bb0-464c-9d22-936608a5392e</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<showpanes type="boolean">false</showpanes>
<attr name="feature_pictureframe" type="boolean">false</attr>
<attr name="autodescription_youcansee" type="int">0</attr>
<attr name="autodescription_youcango" type="int">0</attr>
<attr name="autodescription_youarein_useprefix" type="boolean">false</attr>
<showtitle type="boolean">false</showtitle>
<setcustomwidth />
<customwidth type="int">720</customwidth>
<setbackgroundopacity />
<backgroundimage type="string"></backgroundimage>
<showlocation type="boolean">false</showlocation>
<setcustompadding type="boolean">false</setcustompadding>
<showborder type="boolean">false</showborder>
<defaultlinkforeground>Black</defaultlinkforeground>
<echocommand type="boolean">false</echocommand>
<command_newline />
<gridmap type="boolean">false</gridmap>
<defaultforeground>Black</defaultforeground>
<menufont>Georgia, serif</menufont>
<menubackground>Black</menubackground>
<menuforeground>White</menuforeground>
<underlinehyperlinks />
</game>
<object name="Graveyard">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<description>An old {object:tombstone} is hidden behind a bunch of dry grass.</description>
<beforeenter type="script">
ClearScreen
picture ("room_01.gif")
</beforeenter>
<exit alias="down" to="Crypt">
<inherit name="downdirection" />
</exit>
<object name="tombstone">
<inherit name="editor_object" />
</object>
</object>
<object name="Crypt">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<description>You're standing in the dusty vault of the Drake families hoary crypt. A stone {object:sarcophagus} dominates the center of th floor, and a stairway leading {command:up} returns to the surface...</description>
<beforeenter type="script">
ClearScreen
picture ("room_default.jpg")
</beforeenter>
<exit alias="up" to="Graveyard">
<inherit name="updirection" />
</exit>
<object name="sarcophagus">
<inherit name="editor_object" />
<useindividualverblist />
<examinethestrangesigils type="string"></examinethestrangesigils>
<attempttoopenthelid type="string"></attempttoopenthelid>
<usedefaultprefix />
</object>
</object>
<verb>
<property>whatisawhatsit</property>
<pattern>whats a whatsit</pattern>
<defaultexpression>"You can't what is a whatsit " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>examinethestrangesigils</property>
<pattern>examine the strange sigils</pattern>
<defaultexpression>"You can't examine the strange sigils " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>attempttoopenthelid</property>
<pattern>attempt to open the lid</pattern>
<defaultexpression>"You can't attempt to open the lid " + object.article + "."</defaultexpression>
</verb>
<function name="GetCurrentLinkTextFormat" type="string">
return (GetCurrentTextFormat(GetLinkTextColour()) + "font-weight:bold;")
</function>
</asl>

jaynabonne
george, I do searches through the core source to see how it all works... :)

jaynabonne
Unfortunately, objects don't use the same code. Add this function override as well to your game:

  <function name="ProcessTextCommand_Object" type="string" parameters="section, data">
<![CDATA[
objectname = Mid(section, 8)
text = ""
colon = Instr(objectname, ":")
if (colon > 0) {
text = Mid(objectname, colon + 1)
objectname = Left(objectname, colon - 1)
}
object = GetObject(objectname)
if (object = null) {
return ("{" + ProcessTextSection(section, data) + "}")
}
else {
if (LengthOf(text) = 0) {
text = SafeXML(GetDisplayAlias(object))
}
if (game.enablehyperlinks) {
linkid = ProcessTextCommand_GetNextLinkId()
colour = ""
if (HasString(object, "linkcolour") and GetUIOption("UseGameColours") = "true") {
colour = object.linkcolour
}
else {
colour = GetLinkTextColour()
}
style = GetCurrentTextFormat(colour) + "font-weight:bold;"
return ("<a id=\"" + linkid + "\" style=\"" + style + "\" class=\"cmdlink elementmenu\" data-elementid=\"" + object.name + "\">" + text + "</a>")
}
else {
return (text)
}
}
]]>
</function>

(I hate having to replace a large function like this for a single line change, but what can you do?)

chrisw70
Thanks again for this, it's all really aesthetics, but for me personally having objects in bold is easier on the eyes and I think they stand out more from the text and look less like a wiki web-link.

jaynabonne
No problem. I'm up for aesthetics myself. The details do make a difference. :)

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

Support

Forums