different tv messages each time you watch tv?

poolhall20
14 Jan 2014, 03:13
hey guys, im extremely new.. not just to this forum but also game design and coding/ scripting or whatever. i know pretty much nothing but im working on a text adventure game(well, trying to) so there are a lot of areas im stuck on at the moment. one thing id like to have is when you keep clicking "watch tv" or whatever, i want different messages to play each time. i have it so it says its set to the news and i thought itd be cool for like each time you press it it says "...in other news blah blah blah" kinda thing? im also stuck on conversations, id like a dialogue kinda deal like fallout. ill be honest, ive read through the wiki pages and im not understanding it anymore than before -_-

so yeah, if anyone can help thatd be awesome. i really wouldnt make a thread if i wasnt completely stuck and didnt think i wouldnt be able to continue the game without help. thank you

HegemonKhan
14 Jan 2014, 07:19
unfortunately,

even with using the GUI~Editor, you'll have to train your brain to think in terms of "code logic", despite not writing it in code.

this is just simply the nature of designing a computer (programmed) game.

you have to think like a computer:

Conditionals: "if this, then do that, else do X", "foreach X, do Y", "if firsttime do this, otherwise do that", and etc

Comparisons: "if, this equals~not equals~greater than~lesser than~etc that, then do X", ie: "if (true=true), then do X", ie: "if (5=5), then do X"

Conversions (String Dictionaries): "if this, then, change to or become, that", ie: "water=fire;fire=water;earth=air;air=earth", ie: "january=winter; february=winter;march=spring;may=spring;etc", ie: "january=1;1=january;february=2;2=february;etc"

logical~virtual movement~actions using altering of attributes instead of actually in-game-moving of objects, such as a "gold coin" around (see algebraic substitutions -> "transactions" below).

and etc...

and you'll have to be good at math:

game mechanics (ie: your strength * skill * weapon_damage - monster endurance * skill * armor defense = your final_physical_damage) and game balancing of those mechanics

algebraic substitution for altering attributes (ie: player.strength = player.strength + 1, ie: "transactions", ie: buy: player.cash = player.cash - sword.cash and shop_owner.cash = shop_owner.cash + sword.cash)

and good at writing:

story~plot~events

and media:

art~graphics and sounds~music

-----------

first is the concept of using randomization (which is very useful for many things that you probably want to do):

(In Code): GetRandomInt (min,max)

Object.Attribute = Value_or_Expression

Expression: as we're using a built-in function: GetRandomInt (min,max)

don't worry about this being code syntax~format, as I'll tell you how to do this in the GUI~Editor later, but as of right now, we're just going over the useful concept of randomization. Anyways, what this built-in Function does is, for example:

Object: television
Attribute: topic_choice
Attribute Type: int (integer)
Value: 0

television.topic_choice = GetRandomInt (1,5)

it'll "randomly" select some number between 1 and 5, ie: 1, 2, 3, 4, or 5

(let's say it's "4")
television.topic_choice = 4

then, we'd use an "If" (or "Switch") Scripts:

if (television.topic_choice = "1") {
-> msg ("FOXNEWS")
} else if (television.topic_choice = "2") {
-> msg ("CNN")
} else if (television.topic_choice = "3") {
-> msg ("MSNBC")
} else if (television.topic_choice = "4") {
-> msg (""BBC")
} else if (television.topic_choice = "5") {
-> msg ("C-SPAN")
}

~OR~

The "switch" Script is (nearly) exactly the same as the multiple "ifs" above, it's just a slightly different structure, that's all.

switch (television.topic_choice) {
-> case ("1") {
->-> msg ("FOXNEWS")
-> }
-> case ("2") {
->-> msg ("CNN")
-> }
-> case ("3") {
->-> msg ("MSNBC")
-> }
-> case ("4") {
->-> msg ("BBC")
-> }
-> case ("5") {
->-> msg ("C-SPAN")
-> }
}

so, what would the game engine output? Answer: BBC

does this concept-wise make sense (and *hopefully* this code writing does too, hehe~wink) ???

what would the game engine output be, if the "randomization" [aka: GetRandomInt (1,5) ] function chose: 2, ??? Answer: CNN

----------

so, think of this just like using a phone, you type (or dial ~ I'm old, lol), in a specific number, and it calls someone specific. That's all we're doing in concept. How you want to generate the "number" you'll use to "call that specific person", I'll also be trying to explain some of these ways conceptually here as well, keep reading, hehe.

"randomization" is but one (though very useful) way to generate the "number".

-----------

you can use the above concept, or you can add slightly to it, to get a slightly different design-result:

(we're NOT using the "randomization" function here, instead, we're incrementing the number each time, for what the output will be, it'll follow a cyclical pattern)

Object: television
Attribute: watch_count
Attribute Type: int
Value: 1

if (television.watch_count = "1") {
-> msg ("FOXNEWS")
} else if (television.watch_count = "2") {
-> msg ("CNN")
} else if (television.watch_count = "3") {
-> msg ("MSNBC")
} else if (television.watch_count = "4") {
-> msg (""BBC")
} else if (television.watch_count = "5") {
-> msg ("C-SPAN")
}
television.watch_count = television.watch_count + 1

~OR~

switch (television.watch_count) {
-> case ("1") {
->-> msg ("FOXNEWS")
-> }
-> case ("2") {
->-> msg ("CNN")
-> }
-> case ("3") {
->-> msg ("MSNBC")
-> }
-> case ("4") {
->-> msg ("BBC")
-> }
-> case ("5") {
->-> msg ("C-SPAN")
-> }
}
television.watch_count = television.watch_count + 1

so each time we "watch" (Verb) the "television" (Object):

Old: television.watch_count = 1

television.watch_count (New) = television.watch_count (Old) + 1 (Value)
television.watch_count (New) = 1 (Old) + 1 (Value)
television.watch_count (New) = 1 + 1

New: television.watch_count = 2

Old: television.watch_count = 2

television.watch_count (New) = television.watch_count (Old) + 1 (Value)
television.watch_count (New) = 2 (Old) + 1 (Value)
television.watch_count (New) = 2 + 1

New: television.watch_count = 3

Old: television.watch_count = 3

television.watch_count (New) = television.watch_count (Old) + 1 (Value)
television.watch_count (New) = 3 (Old) + 1 (Value)
television.watch_count (New) = 3 + 1

New: television.watch_count = 4

etc etc etc

------

if (television.watch_count = "6") {
-> television.watch_count = 1
}
if (television.watch_count = "1") {
-> msg ("FOXNEWS")
} else if (television.watch_count = "2") {
-> msg ("CNN")
} else if (television.watch_count = "3") {
-> msg ("MSNBC")
} else if (television.watch_count = "4") {
-> msg (""BBC")
} else if (television.watch_count = "5") {
-> msg ("C-SPAN")
}
television.watch_count = television.watch_count + 1

~OR~

if (television.watch_count = "6") {
-> television.watch_count = 1
}
switch (television.watch_count) {
-> case ("1") {
->-> msg ("FOXNEWS")
-> }
-> case ("2") {
->-> msg ("CNN")
-> }
-> case ("3") {
->-> msg ("MSNBC")
-> }
-> case ("4") {
->-> msg ("BBC")
-> }
-> case ("5") {
->-> msg ("C-SPAN")
-> }
}
television.watch_count = television.watch_count + 1

---

alright, were you able to understand this too ???

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

Object: poolhall20
Attribute: response_choice
Attribute Type: boolean (boolean = flag)
Value: unknown

msg ("alright, were you able to understand this too ???")
get input {
-> // quest engine will automatically set: result = user's typed-in input during game play
-> poolhall20.response_choice = result
-> If (poolhall20.response_choice = "yes") {
->-> msg ("GOOD JOB !!!! hehe :D")
-> } else if (poolhall20.response = "no") {
->-> msg ("HK did a bad job, boo hoo. HK tries to explain better the 2nd time around")
-> }
}

-----------

we can also get~select~choose a result~choice by:

1. having the user type in their input during game play (via the "get input" Script)
2. selecting the choice~result from a pop up menu window (via the "show menu" Script)

both of these automatically set the variable "result" (your choice~result) to:

(Variable = Value_or_Expression)

result = your choice

and for my example game for you below, I'll use the "get input" Script.

----------

Anyways, now that I scared you immensely, let's do this via the GUI~Editor, which is a lot less scary for you, lol

what are you using?

1. online version or offline~desktop version? (there's some differences and~or more~less features between the two of them)
~AND~
2. text adventure mode or gamebook~storybook mode? (there's some differences and~or more~less features between the two of them)

I can only help with the offline~desktop version and with text adventure mode, as that is all that I've used so far, lol.

I still use an older version of quest (540), but this shouldn't matter as I try to help you, hopefully...

err... I ended up just creating an example game for you, if you want me to help you do it yourself in the GUI~Editor, let me know, but here's the example game for you to study and play with (game code below ~ you can copy and paste this to a new game ~ ask if you need help on how to do this, or you can download the game .exe file, as an attachment, also, even further, below):

if it won't load~open~start up (as you're likely using the most recent version), either I have the wrong version number coded in (ask and we can help you with how to change this) or you'll have to make a few changes to the code to make it compatible with your version, again, ask us and we can help you do this too.

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d67ec73f-f879-4911-9d88-c02ea527c534</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="television">
<inherit name="editor_object" />
<inherit name="switchable" />
<alias>tv</alias>
<switchedon type="boolean">false</switchedon>
<look type="script">
watch_function
</look>
<watch type="script">
watch_function
</watch>
<channel type="script"><![CDATA[
if (IsSwitchedOn (television)) {
msg ("What channel do you want to watch?")
msg ("(1) FOXNEWS (2) CNN (3) MSNBC (4) BBC (5) C-SPAN")
msg ("Type in the number of the channel that you want, please.")
get input {
if (IsInt (result)) {
if (ToInt (result) > 0 and ToInt (result) < 6) {
global_data_object.channel_choice = ToInt (result)
global_data_object.channel_name = StringDictionaryItem (global_data_object.channel_conversion, ToString (global_data_object.channel_choice))
msg ("You turn to " + global_data_object.channel_name + " channel.")
}
else {
invoke (television.channel)
}
}
else {
invoke (television.channel)
}
}
} else {
msg ("You can't change the channel, while the tv is still turned off.")
}
]]></channel>
</object>
</object>
<object name="global_data_object">
<inherit name="editor_object" />
<attr name="channel_choice" type="int">1</attr>
<channel_list type="stringlist">
<value>1</value>
<value>2</value>
<value>3</value>
<value>4</value>
<value>5</value>
</channel_list>
<channel_conversion type="stringdictionary">
<item>
<key>1</key>
<value>FOXNEWS</value>
</item>
<item>
<key>2</key>
<value>CNN</value>
</item>
<item>
<key>3</key>
<value>MSNBC</value>
</item>
<item>
<key>4</key>
<value>BBC</value>
</item>
<item>
<key>5</key>
<value>C-SPAN</value>
</item>
</channel_conversion>
<attr name="channel_name">unknown</attr>
</object>
<verb>
<property>watch</property>
<pattern>watch</pattern>
<defaultexpression>"You can't watch " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>channel</property>
<pattern>channel</pattern>
<defaultexpression>"You can't change the channel of the tv."</defaultexpression>
</verb>
<function name="watch_function">
if (IsSwitchedOn (television)) {
msg ("You look at the tv and watch what is on the screen...")
if (global_data_object.channel_choice = 1) {
msg ("FOXNEWS")
}
else if (global_data_object.channel_choice = 2) {
msg ("CNN")
}
else if (global_data_object.channel_choice = 3) {
msg ("MSNBC")
}
else if (global_data_object.channel_choice = 4) {
msg ("BBC")
}
else if (global_data_object.channel_choice = 5) {
msg ("C-SPAN")
}
}
else {
msg ("You look at the tv and see a black screen, as it is turned off.")
}
</function>
</asl>

poolhall20
14 Jan 2014, 08:57
oh my god, thank you so much for such an indepth answer :O ill have to read over it a few times to get everything i think heh, but i think i do understand it. its so hard for me to learn with just reading >.< umm you asked what version im using and stuff? i have the desktop version of quest and i am indeed in text adventure mode :p

kk ill try to get the tv workin, thanks again man :3

HegemonKhan
14 Jan 2014, 09:13
It took me awhile to get the game made (argh), so I'm tired and that's why I didn't write out yet how to do it in the GUI~Editor mode (this takes much more work~writing than explaining via code, sighs).

do you know how to get into the code of the game (of my game file) ???

you'll have to right click on it, and use notepad (or wordpad, or even better: notepad++ @ http://notepad-plus-plus.org/ ) to open it up.

(actually, now that you can do this, you can just create a new game, go into it's code, delete all the code, and then paste in my game code in~from my previous post, change the version number, save it, and then try to start it up...)

then all you do is change this (it's the very first line, at the very top):

<asl version="540">

to

<asl version="your_version_number">

and then save it

then try to load~start it up... hopefully it'll work... lol

if it does start up, see if you can study it, and try to find out how to do~find those things with the GUI~Editor yourself.

if not...

I'll help you step by step on how to do it in the GUI~Editor, but on thurs or later, as I got homework to get done for my wed class, lol.

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

ask if you got any questions... my post was mostly "theoretical" to try to help you towards understanding some of these important concepts, as they're how conversations~topics are created and designed.

I started just like you, no game making experience nor any coding experience nor any quest experience, but quest really is noobie-friendly, and I've come so far in a year+ now (actually learning code, well quest's code anyways, but also the universal code logic ~ way of thinking ~ and etc too), considering starting from scratch.

if you want to see my own progress (my own embarassing beginning, hehe):

viewtopic.php?f=10&t=3348&hilit=noob+hk+help+me+thread

I was so confused just by all the terms and stuff... laughs.

poolhall20
14 Jan 2014, 10:02
oh man, you didnt have to make that game, i was just lookin for a simple explanation or whatever.

yeah i got your game goin, ill give the script a thorough look thru. and can i open it in "code view"? or does it have to be notepad?

umm okay quick question? okay, like, ""Object: television
Attribute: topic_choice
Attribute Type: int (integer)
Value: 0""

i go to the attributes section of the tv and click add... do i name a new one topic_choice manually? cause i did that and i didnt see any option to make the type integer.

when you say attribute... how do you make a topic_choice one? and make the type integer? i dunno if im doin it right, sorry, i really am a complete noob here :s

i just was checking out some text based games and got an idea to make one myself heh. i have a story and everything thought out, its just this whole scripting and stuff thats got me stuck. its so annyoing, sculptors and other artists dont have to know complex things like this to make art. and video games are art, but we have to deal with this barrier :/ and im worried that i wont be able to figure this stuff out, and thats gonna stop me from being able to make this game, that really irritates me. i mean, ive thought of things to put in the game or gameplay mechanics and stuff, but due to my lack of knowledge of scripting and everything im not able to implement them. its like its stifling creativity.

... sorry, kinda ranted there a bit>.< im just really frustrated

HegemonKhan
14 Jan 2014, 10:09
in the meantime, if you haven't already, you can study~practice these (they can help you in doing the conversations), as they have step by step GUI~Editor help:

(from the "how to" wiki page: http://quest5.net/wiki/How_to )

http://quest5.net/wiki/Character_Creation
http://quest5.net/wiki/Unlockdoor
http://quest5.net/wiki/Hs-multiple
http://quest5.net/wiki/Showing_a_menu
http://quest5.net/wiki/Hs-case

http://quest5.net/wiki/Conversations
http://quest5.net/wiki/Dynamic_Menus_for_Conversations
http://quest5.net/wiki/Using_Lists
http://quest5.net/wiki/A_Hint_System
http://quest5.net/wiki/Turn-based_events

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

Quest's "Coding Bible" wiki pages:

1. http://quest5.net/wiki/Category:All_Fun ... t_Commands (page 1, range: A-S)
2. http://quest5.net/w/index.php?title=Cat ... h#mw-pages (page 2, range: S-Z)
3. http://quest5.net/wiki/Object_element

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

and seriously, these two Scripts will do most of almost anything that you want to do, lol:

GUI~Editor mode:

1. Run as script -> Add a script -> Scripts -> If... -> (set it up)
2. Run as script -> Add a script -> Variables -> Set a variable or attribute -> (set it up)

hopefully this stuff helps you :D

--------

P.S.

you can use the GUI-Editor's "GUI~Editor mode <--> Code View mode" toggle button (the note paper button) too, certainly.

though, if you couldn't start up my game, this wouldn't have been an option for you obviously, lol.

---------

P.S.S.

poolhall20 wrote:i go to the attributes section of the tv and click add... do i name a new one topic_choice manually? cause i did that and i didnt see any option to make the type integer.

when you say attribute... how do you make a topic_choice one? and make the type integer? i dunno if im doin it right, sorry, i really am a complete noob here :s


ya, you can name it whatever you want (I use quotes to let you know that it's just my name that I'm using as an example. You don't have to name it "topic_choice", lol. Though, you'll learn you need some kind of system with naming things to help yourself with organization and universal-ness for multiple games you may make ~ speed), these are "custom" (self made) attributes.

just understand that the "Name" Attribute (for Attributes or Objects or Functions or etc) is it's "ID" for the quest engine. You can NOT have two things with the same value for their "Name" Attribute, but we've got the "Alias" Attribute for "naming" things as we think of naming. Many things can have the same value for their "Alias" Attribute.

for example:

Object (1)'s Name Attribute: orc_1
Attribute (1)'s Attribute Name: alias
Attribute (1)'s Attribute Type: string
Attribute (1)'s Attribute Value: orc

Object (2)'s Name Attribute: orc_1
Attribute (1)'s Attribute Name: alias
Attribute (1)'s Attribute Type: string
Attribute (1)'s Attribute Value: orc

this would cause an error, as the quest engine doesn't know which "orc_1" you're refering to (such as in a Verb's scripting).

Object (1)'s Name Attribute: orc_1
Attribute (1)'s Attribute Name: alias
Attribute (1)'s Attribute Type: string
Attribute (1)'s Attribute Value: orc

Object (2)'s Name Attribute: orc_2
Attribute (1)'s Attribute Name: alias
Attribute (1)'s Attribute Type: string
Attribute (1)'s Attribute Value: orc

no error at all, as the quest engine only cares about "orc_1" and "orc_2", and not "orc".

-----

AFTER you name the attribute, then in the window (below the Attribute Name), there should be a small "drop down box", click on it, to get the choices for the Attribute's Attribute Type: string, int (integer), double, boolean, string list, object list, string dictionary, object dictionary, and script dictionary.

and AFTER you select the Attribute Type, then the Value box (below the Attribute Type box) changes to match up with what Attribute Type you chose.

-----

no, you're not a noob, this is confusing in-of-itself to new people, and on top of that, I didn't explain it at all (or I don't explain stuff well, if I do, lol).

please ask as you got any more questions, as it's easier to respond to a direct question, I can be more clear in my answer, lol.

-----

GAMES are (well, actually its optional) art... and *MORE*, lol

aspects of a game (a good game is a massive project, that takes years for a team of people who're pros-experts ~ know what they're doing! compared to us, who're just starting to learn how to do stuff, lol):

(for an RPG anyways)

1. Game Programming~Coding (implementing everything below that you want done and in your game, lol)
2. Game Designing~Ideas~Non-coding Game Work (see below)
2A. Authorship~Writing (story, plot, events, dialogues~conversations, and etc)
2B. Game World~Map, dungeons, and etc
2C. Systems of: Misc Objects, Actors (PCs and NPCs and/or Monsters), Rooms~Buildings, Items, Magic, Equipment, Thievery, Dialogue, Quests, Combat, Travel, Movement (3D Physics), and etc
2D. Media (optional): music, sound, art~graphics, Animation (Movement ~ 3D Physics, Sprites, and etc), and etc
2E. UI (User Interface): user friendly (bad controls and~or interface ruins a otherwise good game)
2F. Game Mechanics (equations, formulas, algorithims, and etc ~ This is NOT easy to do!!!, at least for me anyways)
2G. Game Balancing (of mechanics and etc, what should be the perfect amount of damage loss range for having this amount of HP ~ at this level, etc etc etc, ie if you have 9999 hit points you don't want casual monsters doing 5000 damage to you, nor do you want them to be doing 100 damage to you as well, lol ~ This is NOT easy to do!!!, at least for me anyways)
etc etc etc

this is why games are no longer made by a single person... the big games can easily hit (using) a team of over 100 people !!!!

poolhall20
14 Jan 2014, 10:36
thank you so much for taking the time to show me all this. alright, ill try to figure this stuff out the best i can.

edit: omfg >.< i cant believe i didnt see the integer option in the drop down list, sorry bout that. hehe okay im getting there, slowly but surely :P

HegemonKhan
14 Jan 2014, 11:07
quest's GUI~Editor is very user-friendly, but I wanted to learn to code, so I moved away from it, trying to code in my game myself (well trying to learn how to code things right now, lol). For me, working with the code was generally easier, though there's many things that are better and faster via using the GUI~Editor, than by coding too.

so, don't think you have to code, Alex made quest and its GUI~Editor for this very reason: so you don't have to code !!!

though you have to still have the right "mindset ~ code logic ~ thought process" even with working with the GUI~Editor, in how you do the stuff that you want:

for a real easy example

most new people have the mindset of physically moving things:

give "gold coin" to baker's inventory, get a pie in your inventory

whereas the proper~better "thinking" is:

decreasing your "currency" attribute and increasing the shop owner's "currency" attribute, and just moving the pie over to your inventory (or don't even move the pie over ~ simply using~setting a string attribute: player.equipped = "pie" ~ though this limits you in functionality in what you can then do)

this hopefully is clear why it's better... you're going to have way too many objects and as well as having to move them around and keep track of them too... UBER MESSY NIGHTMARE !!!!

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

chuckles, this is common:

either:

1. you're a programmer, but have no artistic or nor game design ability, so you need to get an artist and~or a designer
2. you're an artist, but have no programming or nor game design ability, so you need to get a programmer and~or a designer
3. you're a designer, but have no artistic or nor programming ability, so you need to get an artist and~or a programmer

and the worst:

4. you have neither programming ability, nor designing ability, and nor any artistic ability... lol (I'm trying to learn to code and to design... but art, that's a lost cause for me... sighs)

poolhall20
14 Jan 2014, 11:32
lool yeeeah i think i fit into number 2 XP even with your game and mine side by side my eyes are just glazing over hehe. im trying to copy what it says on yours about the tv and stuff, still not easy. i mean i really like drawing, and even 3d modeling, but scripts and this technical stuff? im havin a pretty tough time with it. ive found myself spending most of my time making background images for the different environments than actually working on the game :P maybe i just need some sleep, look at everything with fresh eyes. its like 3am right now heh

HegemonKhan
14 Jan 2014, 11:37
I meant to try to find the options within the GUI~Editor...

for example:

try to make the "watch" function on your own (try to find how to do the Scripts for it) all within~by~using~via the GUI~Editor.

(I didn't mean for you to actually try to code~write in the stuff, if you're trying to do this, sorry for not being clear!)

then try to make a "character creation" function via the GUI~Editor...

find other things that have GUI~Editor guides (pictures and instructions on how to do them), and try at doing them yourself.

slowly build up what you can do in the GUI~Editor (as I have done for over a year with the coding).

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

when... (lol) I learn to code and design, can I hire you for free to do the art stuff for me? ;) (just kidding!) :P :D

poolhall20
14 Jan 2014, 11:45
oooh okay. nah you were clear enough, i just have a hard time understanding sometimes. learning disability or something, i dunno.

actually, id be happy to do some art for ur game or whatever. i wouldnt ask to be paid or anything tho :3

HegemonKhan
14 Jan 2014, 11:50
the other reason I moved to learning to use the code, is because I was having a hard time figuring out how to do things in the GUI~Editor, sighs. All the different Scripts and their different settings~options within the GUI~Editor, confused me... lol.

(that's why it took me awhile to make that testing game file for you ~ bloody figuring out how to get that built-in stuff to work, lol... I forgot to set the "switchable" boolean attribute on the tv, which caused a lot of problems, sighs)

I found myself understanding the code more than the GUI~Editor, so I guess I'm more of a coder than a visual (art'sy) person, lol