Two Questions:

Xilefenko
09 Nov 2016, 22:11First Question:
Is there any way you can make a Text Fade in and Fade out?
I want that after a few seconds a Text ["CHAPTER 1"] fades in and out after some time. How can I do that?
Second Question:
I want to make a script that starts a conversation with an NPC what would normally happen when you type in "Speak to ..."
How can I make a script that triggers that Verb or the script connected to that Verb?

OurJud
09 Nov 2016, 22:45I can help with the first, but the second I'll have to leave to someone else.
Your selectors won't be the same as mine (mine was done in Twine), but when you find the name of yours you need to add the following.
Firstly, if your game file doesn't have a CSS section, then it needs to be added. Open up your game's code file (it's the second icon from the right, across the top of the program - looks like paper with writing on it)
Then find (your year may be different):
<firstpublished>2014</firstpublished>
and immeditley below add:
<css><![CDATA[
<style type="text/css">
</style> ]]></css>
Okay, now the fade stuff. I don't know what text it is you want to make fade in and out, so for this example I'm going to use the selector a which will target all text. Links, for instance, would be targeted with a.cmdlink
So, find the selector for your desired text and add the following in the gap between the opening and closing style tags above:
a {animation-duration: 400ms; animation-name: blink; animation-iteration-count: infinite; animation-direction: alternate;}
@keyframes blink {from {opacity: 1;}to {opacity: 0;}}
This will give a very fast blink, but if you change the value to something like 8s (where it says 400ms) you will get a very slow fade in/out.
You'll also probably need to call the CSS. The PIxie explains how here: http://textadventures.co.uk/forum/quest/topic/cbsoydnuxkynv_d7ag2nla/removing-command-border#9fb40ed3-2198-42c9-b9aa-ecbd18f0c922
hegemonkhan
10 Nov 2016, 07:49I'm not sure if I'm answering your second question, but... oh well, worth a shot... lol
Verbs are just Script Attributes with a little extra code overhead to make them have their Verb functionality (hyperlink, button, Command functionality/properties/abilities, etc):
// just a Script Attribute:
<object name="example">
<attr name="greeting" type="script">
msg ("Hi.")
</attr>
</object>
// scripting (usage):
invoke (example.greeting)
// or:
do (example, "greeting")
// -------------------------------
now, a Verb (and it's extra code overhead):
<object name="example">
<attr name="greeting" type="script">
msg ("hi.")
</attr>
<attr name="displayverbs" type="simplestringlist">greeting</attr>
<attr name="inventoryverbs" type="simplestringlist">greeting</attr>
</object>
<verb>
<proeprty>greeting</property>
<pattern>greeting</pattern>
<defaultexpression>You can't do a greeting to that!</defaultexpression>
</verb>
// scripting (usage):
invoke (example.greeting)
// or:
do (example, "greeting")
to do/activate/call/invoke/use a Script Attribute (similiarly as you would to use a Function), all you do is either of these code lines:
invoke (NAME_OF_OBJECT.NAME_OF_SCRIPT_ATTRIBUTE)
~OR~
do (NAME_OF_OBJECT, "NAME_OF_SCRIPT_ATTRIBUTE") // 'do' is more useful/powerful than 'invoke' as it allows for concatenation, but 'invoke' works fine for when you just want to do/run/call/activate a simple Script Attribute usage.
// example of a infinite loop (calling the Script Attribute over and over / tail-recursion):
(do NOT do this! as it crashes quest, lol)
<game name="example">
<attr name="start" type="script">
msg ("hi")
invoke (game.start) // or: do (game, "start")
</attr>
</game>
// output:
hi
hi
hi
hi
hi
(and on and on, until quest crashes due to no more resources for the, overhead/activation record, of storing the Scripts' data)
and to compare to using/running/activating/calling/invoking a Function (an infinite loop example. Again, do NOT do this! as quest will crash):
<game name="example">
<attr name="start" type="script">
example_function
</attr>
</game>
<function name="example_function">
msg ("hi")
example_function
</function>
// output until crashes:
hi
hi
hi
hi
hi
(and on and on, until crashes)

Xilefenko
10 Nov 2016, 09:25@OurJud So I did not really understand where I have to put the second Code
a {animation-duration: 400ms; animation-name: blink; animation-iteration-count: infinite; animation-direction: alternate;}
@keyframes blink {from {opacity: 1;}to {opacity: 0;}}
XanMag
10 Nov 2016, 11:35For your verb activation, could you just put a flag on the trigger that activates the verb?
For example, Fred is an NPC. You have no reason to hate Fred. You speak to Fred and he makes a comment referencing your mother to a bovine. After you 'speak to Fred', add a flag named 'jerk' to object Fred.
You have a punch verb on Fred. If you have 'punch Fred' as input, Just run an 'If' script that checks to see if Fred has the flag 'jerk'. If it does, run your punch Fred response. Else print a message like 'you have no reason to punch Fred'.
Not sure if that answers your question, but that's how I interpreted it. Good luck.

OurJud
10 Nov 2016, 13:20@Xilefenko
What do you mean by 'second code'? Are you referring to the stuff you've quoted? If so, it goes within the CSS block, like this:
<css><![CDATA[
<style type="text/css">
a {animation-duration: 400ms; animation-name: blink; animation-iteration-count: infinite; animation-direction: alternate;}
@keyframes blink {from {opacity: 1;}to {opacity: 0;}}
</style> ]]></css>
But remember, the a at the beginning of that code will probably need changing to whatever name was given to the selector for the text you want to fade in/out.
If you can explain better what text it is specifically, I might be able to advise better.

Xilefenko
10 Nov 2016, 16:23@XanMag How do flags work exactly?

Xilefenko
10 Nov 2016, 16:23@OurJud I'm really sorry.
1.The thing is I'm relative new to Quest and I don't understand half of the things you said
I don't know what you mean by a "Selector" or "CSS Block"
2.English isn't my first language and that isn't helping either
I'm really sorry for making this more complicated than it had to be.
So what I want is that the text "CHAPTER 1" fades is and out after some time. That's all.
Thanks

OurJud
10 Nov 2016, 17:13In that case I'm not sure myself how you would target a single line of text.
Can I ask for your reason - in other words why do you want CHAPTER 1 to fade in and out?

Xilefenko
10 Nov 2016, 17:26@OurJud For cinematic effect.
hegemonkhan
10 Nov 2016, 20:55"@XanMag How do flags work exactly? (Xilefenko)"
I'm not XanMag, but to answer your question...
Boolean Attributes are binary/dualistic/oppositional, they have only two Values: 'true' or 'false'
here's some examples:
// when: orc.dead = false
if (orc.dead) {
msg ("The orc is already dead, silly.")
} else {
orc.dead = true
msg ("You attack the orc and kill it.")
}
// output/do:
// orc.dead = true
// msg ("You attack the orc and kill it.")
// when: orc.dead = true
if (orc.dead) {
msg ("The orc is already dead, silly.")
} else {
orc.dead = true
msg ("You attack the orc and kill it.")
}
// output/do:
// msg ("The orc is already dead, silly.")
// ------------------
// when: player.flying = true:
if (player.flying) {
floating_key.parent = player
msg ("Being able to fly, you easily fly up to the magical floating key high in the sky, and take it)
} else {
msg ("The key is floating high up in the sky, it's impossible to get the magical key unless you were able to fly...")
}
// output/ do:
// floating_key.parent = player
// msg ("Being able to fly, you easily fly up to the magical floating key high in the sky, and take it)
// when: player.flying = false:
if (player.flying) {
floating_key.parent = player
msg ("Being able to fly, you easily fly up to the magical floating key high in the sky, and take it.")
} else {
msg ("The key is floating high up in the sky, it's impossible to get the magical key unless you were able to fly...")
}
// output/ do:
// msg ("The key is floating high up in the sky, it's impossible to get the magical key unless you were able to fly...")
most people associate 'flags' with Boolean (true/false) Attributes, however I see any Attribute as a flag/indicator/state, when it is used to check (via the 'if' Script) its Value, to determine what action or not to do or not do.
if you want to see some more examples, here's my old (and very poorly/badly coded) combat code:
http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22483
http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread#22486 (and the key/legend for it --- I've learned since to never use abrevs ever again, lol)

OurJud
10 Nov 2016, 22:11Xilefenko said:
@XanMag How do flags work exactly?
To follow up Hege's post, and in simple terms, a flag is something that you 'set', usually on a player, so that later on you can run a script which checks for that flag, and if it's there does one thing, if not does another.
Let's take the simplest of examples - a key for a door.
At the point you want to give the player the key, you say (in simplified terms, not code):
- Set flag on player and call it hasKey
Then when you reach a room with a locked door you say:
-
Has the player got hasKey
-
If yes, say "The door swings open."
-
If not, say "You don't have the key."
hegemonkhan
11 Nov 2016, 00:19just thought of this, you can think of Boolean Attributes, as a 'toggle', which you can 'toggle'. Like a light switch, you can toggle it on/off, though with a Boolean Attribute you toggle it: true/false. And just like the light switch analogy, when/if the light switch is in its 'toggled on state', stuff happens (your house room lights turn on and light up your room), and like wise, when/if it's in its 'toggled off state, stuff happens. Now, with a light switch, the effects/results happen immediately upon switching its on/off state. But, this doesn't have to be the case in/with programming, with Booleans (or the other types of Attributes too). You can have one area/scripting/verb/function/etc change or set your Boolean's state/Value, and elsewhere in your game, an area/scripting/verb/function/etc that will 'if' check your Boolean's state/Value, and do an action (or not do an action) based upon what state/Value your Boolean Attribute is/has, far removed from where/when you changed or set its Value/state.
another example, using an Integer Attribute:
you got a 'dimensional teleporter' Object, which checks an Integer Attribute, and based on its Value, is where you're teleported (moved) to, for example:
(not a very good design obviously... you don't want 98 'else ifs', lol)
<object name="dimensional_teleporter_object">
<alias>dimensional teleporter</alias>
<attr name="displayverbs" type="simplestringlist">teleport</attr>
<attr name="teleport" type="script">
if (game.state = 1) {
player.parent = level_1_room
} else if (game.state = 2) {
player.parent = level_2_room
} else if (game.state = 3) {
player.parent = level_3_room
}
// etc 'else ifs'
else if (game.state = 99) {
player.parent = level_99_room // the last area/room/level of the game
}
</attr>
</object>
<object name="level_1_room">
</object>
// etc etc etc 'level_X_room' Room Objects, 99 of them... lol
<verb>
<property>teleport</property>
<pattern>teleport</pattern>
<defaultexpression>You can't teleport here.</defaultexpression>
</verb>