Font question

Marzipan
I know (hope?) the answer to this must be really simple, but I can't figure it out. Maybe I'm just using the wrong html tags.

I'm trying to set it so that NPC dialogue is in different fonts or colors from the rest of the game text.

To be more specific, I want to be able to take a 'print message' script with a line like 'The Lady gives you a brief, contemptuous glance. "Do I hear the buzzing of an impudent fly?" and only change the look of the words she's actually speaking.

OurJud
Mmm, if you wanted this all on the same line, I think it could be tricky (or maybe not - what do I know?).

The only way I can think (although this would result in the line not being set out in the traditional way of literary text) would be to print 'The Lady gives you a brief, contemptuous glance.'

Then set another script immediately afterwards which would print "Do I hear the buzzing of an impudent fly?" in your desired font, using the change font script.

As I say, though, this would result in the sentence being on two lines.

In html, the two font types would be done thus, but I don't know if Quest's programming language would allow it:

The Lady gives you a brief, contemptuous glance. <span style="font-family: FontTypeHere;">"Do I hear the buzzing of an impudent fly?"</span>

jaynabonne

The Lady gives you a brief, contemptuous glance. <span style="font-family: FontTypeHere;">"Do I hear the buzzing of an impudent fly?"</span>



That's exactly how you do it! You can even define styles in CSS and just reference the class in your spans. That way, if you want to change the dialogue style later, you can modify them all at once from the CSS. (And you can define the entire style for the text, not just the font.)

OurJud
jaynabonne wrote:

The Lady gives you a brief, contemptuous glance. <span style="font-family: FontTypeHere;">"Do I hear the buzzing of an impudent fly?"</span>



That's exactly how you do it!


Well, whaddya know! :D

Marzipan
It works! ...well sort of. Some fonts do, some don't. I've even tested it with the web editor with some of the fonts you can use online and it's still the same...I'm not really sure what the criteria is for a font to work or not work. I guess I'll just keep testing them out until I find some I like that are usable.

But as long as I have a thread here, one more quick question about verbs:

How do I make them more than one word long? For instance if I wanted the player to be able to wave, it works as 'wave npc' but not with 'wave to npc' or 'wave at npc'. I have it listed in the verb section as wave; wave to; wave at, but it seems like that format only works for single word aliases?

Silver
You can use any google font in the game but I imagine you might need to include some code to load it in. I dont have the answer to that though. :D

Silver
Marzipan wrote:
But as long as I have a thread here, one more quick question about verbs:

How do I make them more than one word long? For instance if I wanted the player to be able to wave, it works as 'wave npc' but not with 'wave to npc' or 'wave at npc'. I have it listed in the verb section as wave; wave to; wave at, but it seems like that format only works for single word aliases?


You need to set up a command.

http://docs.textadventures.co.uk/quest/ ... mands.html

Marzipan
Silver wrote:

"Marzipan"


But as long as I have a thread here, one more quick question about verbs:

How do I make them more than one word long? For instance if I wanted the player to be able to wave, it works as 'wave npc' but not with 'wave to npc' or 'wave at npc'. I have it listed in the verb section as wave; wave to; wave at, but it seems like that format only works for single word aliases?



You need to set up a command.

http://docs.textadventures.co.uk/quest/ ... mands.html



Still does the same thing. :(

Yeesh, I feel like I've spent 90% of this game's development time working on this one NPC...

HegemonKhan
The problem with spaces~multiple words, is that quest has to try to decipher that grammer structure, and human languages aren't easy to understand, especially for a computer, and thus for people trying to program~code the computer to understand. This is known as 'Parsing' I think, the computer or quest, looks at those spaces~multiple words, and has to figure out what it means, just as we do without concsiously realizing it:

wave
to
at
npc

using just:

wave, to, and npc

is it? :
("wave to npc") VS ("wave to" and "npc") VS ("wave" and "to npc") VS ("wave" and "to" and "npc")

thus, spaces ~ multiple words, grammer ~ human languages, is really bad for computer~programming languages, as those intricacies that we learn as babies (for our primary language anyways), is very hard to teach (humans, and especially computers), have you struggled with a secondary language? Imagine the difficulty in programming a computer to understand a human language! Alex has done an amazing job, as quest is able to uses lots of spaces in its codings, and with people's inputs during game play.

HK eats = Subject Verb = uber simple
HK is eating = Subject Verb Adverb = not so simple

I'm sure your MS word sofware is like millions of code lines to teach~train the computer to be working writing software that we take so for granted.

(and if you want to see how hard it is, just like at all the the spell-checkers and grammer-checkers that you use, especially on grammer, they're really not of too much use)

---------

though, I've no idea what I'm talking about, as this type of coding, is way beyond me, laughs. I'm just taking my best guess at it, using what knowledge I have.

(someday, I'll try and love to get to understanding 'Parsers', 'Decompilers', and etc programming stuff I hear about a lot, but I'm still far away from it, just still trying to learn coding basics still)

-------

You may want to look into Commands:

http://docs.textadventures.co.uk/quest/ ... mands.html
http://docs.textadventures.co.uk/quest/ ... mmand.html

<command name="fight command">
<pattern>fight #text#</pattern>
<script>
enemy_variable = GetObject (text)
if (enemy_variable = null) {
foreach (object_x, AllObjects ()) {
if (object_x.alias = text) {
enemy_variable = object_x
}
}
}
if (enemy_variable = null) {
msg ("Wrong input, try again.")
} else {
// fight~combat scripts
}
</script>
</command>

Marzipan
Wait, nevermind, figured it out! I was trying to specify the NPC you're supposed to do the command to, turns out all I needed was to stick #text# in there.

I feel kind of dumb now. :oops:

And I definitely do need to spend more time reading up on commands, I have a feeling I'm going to be using them a lot. Thanks for the links. :)

HegemonKhan
there's a bit of an issue with #text# vs #object# (pros and cons for both).

my above code, deals with the issue of using #text#

-----

if you use #object#, the Command searches your entire game code for an OBJECT, who's NAME is, your input for #object#.

so, you see the Object's name during game play, except that, that 'name' you see, is really an ALIAS, so when you type in that 'name', quest returns an error, as there is no OBJECT with that NAME:

<object name="orc_1">
-> <alias>orc</alias>
</object>

you type in 'orc', and the Command searches for an Object named 'orc', which it doesn't find, as there is no Object named as 'orc' (there's an Object named 'orc_1', but not 'orc'), and there's nothing that the person playing the game can do, as the Object's name is likely hidden from them (the very reason for having aliases: to keep the game design organization, such as a naming system, hidden from the person playing the game). Now, the game maker, can code in stuff to handle this, but otherwise, the person playing is helpless to deal with it.

the reverse is somewhat the same for using #text# instead, as YOU CAN type in the alias, but then you got to check if the Object exists and if it does, then to actually 'GET' that Object, as your input for #text# is just a String, when you want to act upon or to (need to) use the actual Object for what you want to do. You can see this coded for in my code in my post above (Credit goes to Pertex, as he gave~crafted this bit of code to~for me when I was working on my Combat Code, based off of Pertex' Combat Library's structure).

HegemonKhan
Commands can be very simple, or complex (using #text# and~or #object, multiple #texts~objects#, and Functions).

example of a Simple Command (no use of #text#, nor #object#, and simple scripting too):

<command name="hint_command">
<pattern>hint</pattern>
<script>
if (game.event_flag = 0) {
msg ("Try to find and kill the evil wizard.")
} else if (game.event_flag = 1) {
msg ("Didn't the wise owl say that you'll need the legendary dragon slayer sword to kill the dark dragon, which the evil wizard hid in his tower...?")
} else if ( game.event_flag = 2) {
msg ("Trick and wait for the dark dragon to exhaust it's fire, before attacking it.")
}
</script>
</command>
// you just have to type in: hint


an example of a complex Command:

<command name="alchemy_command">
<pattern>mix #text1# and #text2# together and then with #object1# and then use on #object2#</pattern>
<script>
alchemy_function (game.pov, text1, text2, object1, object2)
</script>
</command>

<function name="alchemy_function" parameters="self,ingredient1,ingredient2,weapon,enemy>
// this is way too advancd for me, laughs. As can seen I've no idea what I'm doing~going with this, lol.
</function>

Marzipan
Yeah, the complex ones are a little beyond me at the moment, lol :D

I guess the #text# means the player can literally type in any noun, and I'm sure I didn't handle it the most efficient way, but since there's only a few NPCs they can interact with anyway I just stuck in a script with something like 'if NPC1 is here print this message, if NPC2 print a different one' and so on.

HegemonKhan
#text# means that the Command will take that input as, AS TEXT (a String), so you'll have to add additional code lines if you want to do something with an Object, as a 'String' is not an 'Object', such as:

an equip_command:
// you type in: sword
// 'sword' is just a String right now, we can't equip a String (~ a 'word' ), lol (ya, I got the word 'sword' written with ink on my palm, and I'm going to use that ink-stained 'sword' handwriting, to cut down the 5 hungry orcs in front of me)
player.left_hand_object = GetObject (text)
// thus the: GetObject (text), this searches for (and if finds, Gets) an Object named 'your_#text#_input', and now we got an actual 'sword' OBJECT in our hand to cut down those 5 hungry orcs in front of me, hehe.

whereas,

if we used: #object# instead, the Command already~automatically searches for an Object named 'your_#object#_input', but the problem is if your Objects have an ALIAS, as this is what the person playing the game will see, and type in, and thus since no such Object has such a NAME, you get an error (or null Object, it doesn't find an Object to put into your hand).

so, they both got their pros and cons, if you use #text#, then you need to actually GET THE OBJECT (extra coding), but if you use #object#, then you got the issue of NAME vs ALIAS (extra coding), when it tries to search for an Object of that NAME, not of that ALIAS that you gave as your input.

The Pixie
I had not realised #object# uses either alias or name but not both (just tested it in a game to confirm). Personally, I give everything an alias, and use the name just for my own use anyway, which is I guess why I had not come across it before. If an object has other names, put them in the "Other names" list on the Object tab. You will find that #object# works fine with aliases and other names.

What is occasionally an issue is when you want to interact with an object that is not there, as #object# only looks through the player inventory and the current room. Just occasionally you want the player to refer to an object somewhere else, and then you have to use #text#, which is indeed a string, so then you have to match that to an object yourself.

OurJud
Marzipan wrote:Yeesh, I feel like I've spent 90% of this game's development time working on this one NPC...

Tell me about it. You can spend all day on one problem and if you're anything like me you'll feel that it's another day wasted. What you've got to keep telling yourself, though, is that it's another 'thing' learned and that you have the script safe and sound, and working, should you need to do the same again.

Also, the 'add command' function (right click on the room/object/game/whatever and choose 'add command) has been an absolute Godsend since Jay told me about it. For ages I've wondered how to add alternative commands, in the hope of covering all logical inputs for a given circumstance, and this is it.

I even tested its effectiveness yesterday for a scene where my player is in an office, and I wanted to give them a number of alternatives for exiting the room. I right-clicked on the room, picked 'add command' and added: leave; leave office; go out; go; big monkey

I then ran the scene, typed 'big monkey' and it triggered me leaving the office :D

What I love about this add command feature is that you can have any action following any verb. You can think carefully about what a layer may think of typing at any given moment, and add it this way so that the game understands it.

Having said all that, I've confused myself a little. When you add additional commands using this option, how does the game know what action those commands need to trigger. For instance, it understood 'big monkey' as I added it as a command, but how did the game know what I wanted that command to do??

Mmm, maybe I added those commands on the exit, not the room.

Marzipan
OurJud wrote:

"Marzipan"

Yeesh, I feel like I've spent 90% of this game's development time working on this one NPC...


Tell me about it. You can spend all day on one problem and if you're anything like me you'll feel that it's another day wasted. What you've got to keep telling yourself, though, is that it's another 'thing' learned and that you have the script safe and sound, and working, should you need to do the same again.



Haha, yeah, that's what I keep telling myself. At least the rest of the NPCs should be a breeze after this one.

Still sad I never got the fonts working like I wanted though...I don't get why I can change the entire game to a certain font by clicking one option, but it doesn't work at all for an individual line of text. Oh well.



Also, the 'add command' function (right click on the room/object/game/whatever and choose 'add command) has been an absolute Godsend since Jay told me about it. For ages I've wondered how to add alternative commands, in the hope of covering all logical inputs for a given circumstance, and this is it.



Yeah, once I figured out commands were the equivalent of tasks for ADRIFT I was all 'ohhhh, now I get it!' :) It opened up a lot of possibilities, before that I thought all I had to work with were verbs. (Which gives me an idea, I should try porting my ADRIFT game over for my next project, should be good practice...)


Having said all that, I've confused myself a little. When you add additional commands using this option, how does the game know what action those commands need to trigger. For instance, it understood 'big monkey' as I added it as a command, but how did the game know what I wanted that command to do??

Mmm, maybe I added those commands on the exit, not the room.



You don't just have a script that moves the player out of the room?

OurJud
OurJud wrote:Having said all that, I've confused myself a little. When you add additional commands using this option, how does the game know what action those commands need to trigger. For instance, it understood 'big monkey' as I added it as a command, but how did the game know what I wanted that command to do??

Mmm, maybe I added those commands on the exit, not the room.

Marzipan wrote:You don't just have a script that moves the player out of the room?

I do... I think. Not got Quest open at the mo'. I just can't get my head around how it knows 'big monkey' means 'exit room'.

I suppose it'll make sense when I open it up and inspect it.

Can you imagine if anyone jumps right to this page of the thread and reads the above about big monkeys? They'll wonder what the hell game I'm making :lol:

Marzipan
Well it's just the script then. With a command you're basically just telling the game 'whenever the player types [one of these commands] then do [this action].' It doesn't matter if the command is 'leave office', 'big monkey' or ' put the character in a ballerina dress and fly them to the moon', the action you told it to trigger is 'execute a script that moves the player out of the office'

OurJud
Marzipan wrote:Well it's just the script then. With a command you're basically just telling the game 'whenever the player types [one of these commands] then do [this action].' It doesn't matter if the command is 'leave office', 'big monkey' or ' put the character in a ballerina dress and fly them to the moon', the action you told it to trigger is 'execute a script that moves the player out of the office'

Yes, just checked. I couldn't think what I'd done, but as you say, a 'move player' script runs on those commands.

HegemonKhan
the first word is merely a 'trigger' word for activating the Command, it can be whatever you want, but once you type that word in first, quest will activate the Command that uses it.

the Scripts of the Command, is what it actually does, and the #text# and~or #object# input is merely a way of transfering~Getting something (an Object or a text~String), which you typed in after your 'trigger' word, to plug into the Scripts.

------------

P.S.

I'm still just working on character creation, laughs. 2-3 years now of still working on character creation for my game (it'll be complete... MAYBE... when I'm 100 years old, laughs).

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

Support

Forums