Some quest-ions

WhitevanCandyman
Dear forum,

I have been using Quest for a few days now and I must say I love it. I do have some questions, though.

[list]

How can I make it so that you cannot use an exit unless specific items are in the inventory?
How can I make doors only to be unlocked with keys?
How can I make a maze that when you choose the wrong path, you get thrown back to the first room without messing the map up?


[/list:u]

I hope you will be able to help me.

Kind regards,
Toby van Kempen

HegemonKhan
here's some links:

01. http://quest5.net/wiki/Main_Page
02. http://quest5.net/wiki/Tutorial
03. http://quest5.net/wiki/Using_lockable_exits
04. http://quest5.net/wiki/How_to (guides)
05. http://quest5.net/wiki/Hs-blockingexit
06. http://quest5.net/wiki/Hs-lockedexits
07. http://quest5.net/wiki/Category:All_Fun ... t_Commands (page 1, range: A-S)
08. http://quest5.net/w/index.php?title=Cat ... h#mw-pages (page 2, range: S-Z)
09. http://quest5.net/wiki/Object_element
10. http://quest5.net/wiki/Attribute_Types
11. http://quest5.net/wiki/Category:ASLX_Elements
12. http://quest5.net/wiki/ASLX_Elements
13. viewforum.php?f=18 (libraries and code samples)
14. http://quest5.net/wiki/MoveObject
15. http://quest5.net/wiki/Parent
16. http://quest5.net/wiki/Object
17. http://quest5.net/wiki/If
18. http://quest5.net/wiki/Contains
19. http://quest5.net/wiki/HasObject
20. http://quest5.net/wiki/ScopeInventory

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

Toby wrote:How can I make it so that you cannot use an exit unless specific items are in the inventory?


(either "Contains" and "HasObject" can be used here)
("game.pov" is used instead of "player", but you can replace "game.pov" with "player" if you prefer)
("MoveObject" and "parent" do the same thing, moves an Object)

in scripting (Add a script):

if (Contains (game.pov, object_1) = true and Contains (game.pov, object_2) = true and Contains (game.pov, object_3) = true and ...etc...) {
// you can do this by within the "unlock" script (better), or by changing the built-in global "move" scripting for Exits)
msg ("Having the needed Objects, you're able to pass through the Exit.")
MoveObject (game.pov, room_2) // or: game.pov.parent = room_2
} else {
msg ("You can't pass through the exit until you have object_1, object_2, and object_3 in your inventory.")
}


Toby wrote:How can I make doors only to be unlocked with keys?


see the links above

Toby wrote:How can I make a maze that when you choose the wrong path, you get thrown back to the first room without messing the map up?


I don't know about how the map~grid stuff works yet (having used it yet), but as for moving the player back to the first room:

in scripting: MoveObject (game.pov, your_first_room) // or: game.pov.parent = your_first_room

WhitevanCandyman
Woah now, that's a whole lot of things I don't understand! Could you please explain to me how the "not able to pass unless certain items have been collected" part works? And where exactly do I put the script? Thanks!

EDIT: I tried the part with the maze. It unfortunately still messes up the map. I used the following code on the exit:

MoveObject (game.pov, West riverbed)


The map-messing up also happens when my code is as follows:

MoveObject (player, West riverbed)



EDIT: I put the code at the exit of my room, and it gave a massive error:

"kitchenhole" has the following errors:
Could not set value 'Contains (game.pov, Credit card) = true and Contains (game.pov, Lighter) = true and Contains (game.pov, Bandage) = true and Contains (game' - The number of opening brackets "(" does not match the number of closing brackets ")".. Could not set value 'Contains (game.pov, Credit card) = true and Contains (game.pov, Lighter) = true and Contains (game.pov, Bandage) = true and Contains (game' - The number of opening brackets "(" does not match the number of closing brackets ")".

Liam315
I can see a couple of errors, although I'd need a copy of your game to test more thoroughly and check what's gone wrong.

1. The if scripts already evaluate to true or false, so any function that returns a boolean value should not be written with an equals sign. In plain English, the parts where you have -
Contains (game.pov, Credit card) = true


should just read

Contains(game.pov,Credit card)


and so on for each one.

2. It looks like you've incorrectly copied some of HK's code; you've possibly missed the "if" part of the statement and you have more opening brackets ( than closing brackets ). At the moment, Quest is trying to set a variable called "contains(game.pov,Credit card)" to true, rather than doing something else IF that statement is true. Going by the items I can see in the error message, your exit script should be the following:

if (Contains(game.pov,Credit card) and Contains(game.pov,Lighter) and Contains(game.pov,Bandage)) {
MoveObject(game.pov,ROOM_NAME_HERE)
}
else {
msg ("You shall not pass.")
}


Again, it's hard to give you more helpful instructions without a copy of the game file.

WhitevanCandyman
Alright, so I took over your code (a massive thank you for that) and put it in the script at the exit. I then tested it and it showed the following error in game:


Error running script: Error compiling expression 'East riverbed': Unknown object or variable 'East riverbed'


This here is the code I put in



if (Contains(game.pov,Credit card) and Contains(game.pov,Lighter) and Contains(game.pov,Bandage) and Contains(game.pov,Battery)) {
MoveObject (game.pov, East riverbed)
}
else {
msg ("You feel as if you haven't completely investigated the apartment yet.")
}




Also, how can I share my game with you so you can see what's wrong?

HegemonKhan
take a look at these links:

03. http://quest5.net/wiki/Using_lockable_exits
05. http://quest5.net/wiki/Hs-blockingexit
06. http://quest5.net/wiki/Hs-lockedexits

they show you how to do the lockable door and exit in the GUI~Editor.

------

the scripting is what you'll do (add a script) in your Object's Verb, most likely the "use" Verb (it's already set up as a tab in the GUI~Editor, to make it easier on you). You may need to do scripting also for the "unlock", "open", and etc Verbs too.

It takes too long to explain where or how you do stuff on the GUI~Editor, as I'm busy right now, but if someone doesn't help you, after wednesday (feb. 26), then I'll have the time (hopefully), to be able to help you step by step in using the GUI~Editor.

--------

three ways to share your game:

open up your game (*.aslx) file with notepad, wordpad, or notepad++ ( http://notepad-plus-plus.org/ ), highlight all the text~code of your game (ctrl+A), copy it (ctrl+C), and then paste (ctrl+V) it here:

[code.]paste your game code here[/code.]

but without the dots ("." 's) in the code brackets, here's an example:

<asl version="540">
<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>
</asl>


OR, you can within the GUI~Editor:

at the top, there's a menu bar, find the button that looks like a piece of notepaper, it's between the "play" and "?~help" buttons. This notepad button is a toggle, switching between the GUI~Editor mode and the Code View (in-code) mode. When in the Code View mode, do the same as described above.

Lastly, simply add your game file as an attachment to your post.

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

game.pov <=> player

if (Contains (player,object_1) and Contains (player,object_2) and Contains (player,object_3)) {
-> MoveObject (player, room_2)
}

if the player (or: game.pov) contains object_1 and also contains object_2 and also contains object_3, then move the player (or: game.pov) to room_2

WhitevanCandyman
Hey there Hegemon,

Thanks for the help. I do have a rather silly question, though. What is a GUI~ Editor? It sounds important but I can't find it anywhere.

I'll attach my file to this post.

HegemonKhan
the GUI (Graphical User Interface)~Editor is what you're using in quest right now (unless, you're writing it in code), with all the buttons, options, drop down menus, windows, tabs, and etc, to make your game.

it's this:

http://quest5.net/w/images/e/ed/Blankgame.png

hehe, and it's a good question! not many people know this terminology.

your computer via its OS (Operating System: Win XP, Win 7, Win 8, etc) creates~uses a GUI too, hehe.

WhitevanCandyman
So if I understand it correctly,

[list]player is the exact same thing as game.pov, and thus the game reads player as game.pov and game.pov as player
if tells the game if something meets some requirements
Contains tells the game if something contains something else
(player,Battery) specifies what object must contain which object in order to meet the requirement
MoveObject tells the game to move the specified object to a specified room if the requirements are met
else tells the game what to do if the requirements aren't met[/list:u]

HegemonKhan
there's a slight difference between "game.pov" and "player", but only if you use~have~create multiple Player Objects. So, yes, they're interchange'able. I just like using "game.pov" because it still works if for example you decided to rename your default ("player") Player Object as "WhiteVan".

the "if" script (GUI~Editor: Run as script -> Add a script -> Scripts -> If...) is extremely powerful~useful script:

it's a "conditional", a "check" upon doing something:

let's say there's a key floating up in the sky above you...

if (HK.flying = false) {
-> msg ("What?!, did you think you could fly?!")
} else if (HK.flying = true) {
-> key.parent = HK
-> msg ("Being able to fly, you get the key up in the sky above you.")
}

if I'm not flying, then obviously I can't get the key.
if I am flying, then I can get the key.

if (HK.test_score >= 90) {
-> HK.allowance_cash = HK.allowance_cash + 10
} else if (HK.test_score < 80) {
-> HK.bottom_gets_spanked
-> HK.grounded = true
}

"if" is very powerful~useful (you'll use it A LOT!), it's the start of how you think like a computer and a programmer~coder, lol.

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

The Two SUPER SCRIPTS, you can practically almost do anything and everything with just them alone!

In GUI~Editor:

1. Run as script -> Add a script -> Scripts -> If...
2. Run as script -> Add a script -> Variables -> Set a variable or attribute

In Code:

If Script:

if (blah blah) {
-> // script
} else if (blah blah) {
-> // script
} else {
-> // script
}

Set a Variable or Attribute Script:

Object.Attribute = Expression_or_Value
~OR~
Variable = Expression_or_Value

examples:

orc.dead_boolean = false
HK.strength_integer = 100
HK.gender_string = "male"
HK.cash_integer = HK.cash_integer + 50
HK.physical_damage_double = HK.weapon_damage_double + HK.weapon_damage_double * (HK.strength_integer - orc.endurance_integer) / 100
you_go_first_boolean = true
HK.favorite_colors_string_list = split ("black;red",";")
HK.equipment_object_list = split ("helmet;plate_armor;boots;sword;shield;guantlets",";")

WhitevanCandyman
I see, but I messed somewhere up. Could you please tell me what I messed up and how I can prevent these little mistakes in the future?

Liam315
WhitevanCandyman wrote:Alright, so I took over your code (a massive thank you for that) and put it in the script at the exit. I then tested it and it showed the following error in game:


Error running script: Error compiling expression 'East riverbed': Unknown object or variable 'East riverbed'


I've had a look at your game, and the problem comes from a very small thing in the line

MoveObject (game.pov, East riverbed)


You have 2 objects in your game; one, a room called "East Riverbed" and another, an exit called "East riverbed".

Like in most coding languages, capitalization matters in Quest code. A "b" is different from a "B." As you have it, the script is trying to move the player to the exit named East riverbed, rather than to the room East Riverbed. Capitalize the "r" and it should work.

I'd also suggest that you change the way you name objects (while you're still early in development) to help you avoid similar problems in the future. (And they will happen, many are the times I've torn my hair out looking for an error only to find it was a tiny capitalization mistype. It's advice I wish I had come across when I started creating.)

Give all your objects very systematic names that follow the same pattern. Whether you choose to capitalize every word or keep them lower case, use spaces or underscores, etc. make sure you follow the same standard for every room, object, and exit. On top of this, create an alias for every object (this will be what it is known as to the player) even if it's the same as the object name. It creates consistency and can help you a lot further on down the road.

WhitevanCandyman
Liam, it worked perfectly! Thank you very much for the advice! I do have some experience with HTML and CSS and was aware that these things happen but I just can't believe I missed it. Thanks!

HegemonKhan
troubleshooting~debugging is fun ;)

at least you seem to have gotten it right, let us know if you still have some trouble with something, and~or if you need any other help.

WhitevanCandyman
I have found myself in yet another pickle!

The links were great but they weren't what I was looking for. They did show me how to USE a key to unlock it but didn't show me how to USE THIS ON (other object) to unlock it.

EDIT: I'm okay with just having to USE the key, but now I can use the command "USE KEY" anywhere and it still unlocks the kitchen door. So I came up with a plan:

I want to make an IF script, and I want it to look like this:

If I am in the hall, I can use the key, and it'll print a message "You insert the key in the keyhole and unlock the kitchen door.".
If I'm not in the hall (else) it'll say the message "You can't use that here.".

So if I'm correct, the code should be:



if (game.pov,Hall)
UnlockExit (kitchen unlock)
msg ("You insert the key in the keyhole and unlock the door.")
else
msg ("You can't use that here.)




EDIT: Well that didn't fly. I inserted the code, and the GUI told me it "Failed to load script".
Any thoughts?

HegemonKhan
"Parent~Child" = "Nesting~Indenting":

Folders' ~ Directories' Ordering (of containment) and~or Scripting's Ordering

ROOT (Top~Main) Parent (RP)
Direct Parent (DP)
Indirect Parent (IP)
Direct Child (DC)
Indirect Child (IC)

Great Grandfather = RP of all children below, DP of Grand Father, IP of Father~You~Your Children~Your Grandchildren
-> Grand Father = DC of Great Grandfather, DP of Father, IP of Father~You~Your Children ~ Your Grandchildren
->-> Father = IC of Great Grandfather, etc (I think you get the idea)
->->-> You = etc
->->->-> Your Children = etc
->->->->-> Your Grandchildren = etc

HK
-> HK's pants with a pocket
->-> wallet
->->-> $ 1.00
->->-> $ 5.00

C:\\
-> Programs
->-> Quest

The Void
-> Our Multiverse
->-> Our Universe
->->-> Our Galaxy Cluster
->->->-> Milky Way Spiral Galaxy (Our Galaxy)
->->->->-> The Sun (Our Star along~in the tendril of the Milk Way Galaxy)
->->->->->-> The Earth (Our Planet)
->->->->->->-> The Continents (the Land Plates)
->->->->->->->-> North America Continent
->->->->->->->->-> United States of America County

http://en.wikipedia.org/wiki/Biological_classification
http://en.wikipedia.org/wiki/Human

("King Paul Cried Out For Good Soup" = Kingdom, Phylum, Class, Order, Family, Genus, Species)

Human Anthropology (Anthrop=human, -ology = study of, "Human Anthropology" is redundant, lol):

we have an ~8% DNA difference from potatoes
we have an ~2% DNA difference from chimps
human so-called "races" must be like 0.00000000000001% DNA difference from each other, aka there's no such thing as "race".

Life ("Alive vs "Non-Alive"): Organic~Carbon ("Alive")
-> Domain: Biologically = Eukaryota, Behaviorially = Virus
->-> Kingdom: Animalia (Animals)
->->-> Phylum: Chordata (having a backbone~spine~spinal cord)
->->->-> Class: Mammalia (mammals: having breasts: mammary glands; milk secretion)
->->->->-> Order: Primates (Apes: no tails, and Monkeys: yes tails)
->->->->->-> Family: Hominidae (the Great Apes: Humans~Homo, Chimps~Pan, Gorillas~Gorilla, Orangutans~Pongo)
->->->->->->-> Tribe: Hominini (our ancestors; "ape-man" evolutionary split from chimps; non-chimps)
->->->->->->->-> Genus: Homo (Homo=man; mankind; humans)
->->->->->->->->-> Species: Homo sapiens sapiens (sapiens=wise; wise wise man; us ~ genetically modern humans from Toba Eruption ~ Near Extinction of Homo sapiens ~ the only ~1,000 human survivors ~ ya we were almost extinct heh, within South Africa became us = Homo sapiens sapiens, at ~70 mya to present day at 2014 AD. Because of humans near extinction of only 1,000 human survivors, that is why our DNA is genetically identical amongst the current 7 billion humans here in present day)
->->->->->->->->->-> "Race": there is no such thing~category~classification; all 7 billion humans' DNA is genetically identical; especially with all the inter-breeding we do and have done for at least centuries, if not longer into prehistory.

Note:

Homo sapiens covered (nearly) the entire world, but *ALL* of them were wiped out by the Toba Eruption, except for ~1,000 Homo sapiens living in South Africa. These 1,000 survivors became us, Homo sapiens sapiens, having re-spread across the world again, though with practically no genetic diversity unlike Homo sapiens, due to our near-extinction from the Toba Eruption.

The Great Rift Valley (~East Africa: Ethiopia and a few other countries) is the birth of humans, but South Africa is the birth of us, modern humans.

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

my arrows ( -> ) on the left side, represent the indentation~nesting~parent~child of the scripting, but do not write them in into the scripting! I use these arrows of mine as it can be faster than making the [code.][/code.] box to preserve the proper indentation~nesting~parent~child.

you can also use the "MoveObject (moving_object, destination_object)", instead of the "moving_object.parent=destination_object" that I use below (though the "MoveObject" 's syntax is tricky if you're trying to code~write it in, if you're new to coding)

setting and~or re-setting an object's location (via the "parent" Attribute) is in effect the same thing as 'moving' the object (MoveObject Script).

if (key.parent = game.pov) {
-> if (game.pov.parent = kitchen) {
->-> kitchen_door_and_or_exit.locked = false
->-> msg ("With the key, you unlock the door~exit in the kitchen")
-> } else {
->-> msg ("The key, is for the door~exit in the kitchen, and you ain't in the kitchen, silly")
-> }
} else {
-> msg ("You need the~a key first, silly")
}

conceptualization of the above script:

if the key (a child of) is "held by, or ie: inside of" (the parent, which is...) the game.pov (ie: "player" or "HK" or "Whitevan" Player Objects),
-> then, if the game.pov (a child of) is "held by or inside of" (parent) the kitchen,
->-> then, set the kitchen's door~exit to being unlocked: kitchen_door_and_or_exit.locked=false
->-> then, a message~display letting the game player know: blah blah blah
-> else, a message stating that they're not in the correct room
else, a message stating that they don't even have the key in their possession

---------

or think about it this way:

if:
kitchen (the kitchen has~contains~holds the locked door and~or exit, and the game.pov too, within it)
-> the locked door (optional, the locked door is in the kitchen)
-> the locked exit (the locked exit is in the kitchen)
-> game.pov (the game.pov is in the kitchen, which has the locked door and~or exit)
->-> key (the key is in the game.pov 's possession)
then:
unlock the kitchen's locked door and~or exit

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

here's how you write (code) it properly:

if (key.parent = game.pov) {
if (game.pov.parent = kitchen) {
kitchen_door_and_or_exit.locked = false
msg ("With the key, you unlock the door~exit in the kitchen")
} else {
msg ("The key, is for the door~exit in the kitchen, and you ain't in the kitchen, silly")
}
} else {
msg ("You need the~a key first, silly")
}


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

in the GUI~Editor,

there should be a way to "use object on~with object" ...

if I have to, I'll look in the GUI~Editor for how this is done for you, if you can't figure it out.

here it is in code: http://quest5.net/wiki/Useon

I think the tutorial should have this... one sec...

.....

*************************************

HERE IT IS:

http://quest5.net/wiki/More_things_to_do_with_objects

(you may also want to read the previous section too: http://quest5.net/wiki/Custom_commands )

(if you haven't, I highly suggest that you go through the entire tutorial yourself, trying to do everything within quest yourself of the tutorial)

the tutorial has directly on how to use "useon" (lol).

seriously, the tutorial ( http://quest5.net/wiki/Tutorial ) answers all of your questions, try to go through all of it, as it'll really help and familiarize yourself with quest's GUI~Editor and how to do stuff in~with it

***************************************

enjoy, ask if you need help

Liam315
The difference between "use key" and "use key on [object]" is something that's come up a few times before (if Alex et al are reading this, perhaps this is something you could consider integrating into the next version).

You'll need to create an entirely new command to handle this scenario, as it's not something handled natively by Quest. Thankfully, the command you can create will use the lock/key pair that you set up with the GUI so you won't have to do anything extra after creating it.

The steps are as follows:

1. Create a new command. (Name it whatever you want, I used "unlockwithkey".)

2. Set the command pattern to:
unlock #object_unlock# with #object2#; unlock #object_unlock# using #object2#

3. Set the script of the command to:
if (HasAttribute (object_unlock, "locked")) {
if (object_unlock.key = object2) {
if (object_unlock.locked) {
object_unlock.locked = False)
msg (object_unlock.unlockmessage)
do (object_unlock, "onunlock")
}
else {
msg (CapFirst(object_unlock.article) + " is not locked.")
}
}
else {
msg (CapFirst(object2.article) + " doesn't fit in the keyhole.")
}
}
else {
msg (CapFirst(object_unlock.article) + " is not locked.")
}


The "else" messages can of course be modified to whatever suits your game. You shouldn't need to add any other scripts as this works globally and uses all of the things that you set up to make the standard "use key" command work.

Hope this helps.

WhitevanCandyman
Liam, are the # required for the command pattern?

EDIT: Hegemon, that's an amazing idea. I'll get to going through the tutorial straight away.

At the scripts tutorial, the tutorial tells me to click the "then" tab to add what should happen if the TV is on. I can't, however, find the "then" tab in the web creator. Is this normal or am I missing something?

EDIT: Woah man, this stuff frightens me:
Screen Shot 2014-02-26 at 13.39.18.png

Liam315
Yes the #'s are required for the command pattern. In a command pattern, anything between them is used as a variable in the script.

To use a very simple example:

You have command pattern that says "drink #object#" and a script that says:
if (object.liquid = True) {
msg ("You gulp it down to quench your thirst")
}
else {
msg ("You can't drink that!")
}

The part that says object.liquid stands in for anything the player might type, whether it's "drink water", "drink beer", or "drink chair". Depending on what the player types, the script becomes "if (water.liquid)", "if (chair.liquid)" etc. If the water or beer has an attribute that says it's a liquid, then it will print the first message, whereas the chair would have an attribute that says it is not a liquid, so the second message would be displayed. The point is, whatever object the player types in after the word "drink" will be assessed by the command script substituting the typed object for #object#.

Also, the scripts honestly look far more complicated than they really are, especially in the GUI view where everything is expanded to look bigger. I didn't know a line of code in Quest or anything else when I started, and since then I've taught myself not only Quest but the basics of HTML, CSS, and Javascript/jquery - you'll get there eventually :)

WhitevanCandyman
Alright, so liquid is a variable set by the editor, right?

Liam315
Yep, that's just an example of any attribute that an object might have, either by default or something that you have created yourself.

WhitevanCandyman
And those attributes go on the object itself, and the variables are set/made/whatever in the command pattern?

HegemonKhan
if you're using the online~web Editor, then it just doesn't have the same features as the offline~desktop~download'able version does, though you can still do the same things still, but the method to do them is a bit different. I never used or seen what the web~online version, so I can't help with it.

otherwise, such as within a Verb, make sure you choose:

run as a script

to allow you to choose (add) the scripts, otherwise, it's just a message~text box.

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

HK edit:

actually the #....# is more like a parameter for a command, hehe, just as a function has and uses parameters.

in the Command Element's "pattern" box, yes you type in the pound~number signs: #....#

but during game play, you do NOT type in the number~pound signs

WhitevanCandyman
Alright, so it looks like it's better to use the desktop version. I have bootcamp on my mac so that's not a problem. I downloaded Quest 5 and put it on the windows, after which I download the .aslx file of my game and try to load it in Quest…
It's definitely loading stuff, the green bar loads too but when it's done loading it shows a pop-up with the following message:

Failed to load game due to following errors:
*Incorrect ASL version number

Oh boy. Now what?

Liam315
Sorry, I didn't realise you were on the online editor before. The error you got means that the version of Quest that runs on the website is different to the one you downloaded. You'll need to redownload a different version that matches the one used by the online editor, although which one that is I couldn't say.

HegemonKhan
easy fix, just go into the game file's code, and change this (it's at the top):

<asl version="whatever is the version of quest you're using~downloaded">

your version number in the code, must match your quest downloaded version, lol.

I use quest version 5.40 still, so my game code must be this:

<asl version="540">
<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>
</asl>


if, you're using version 5.50, then your game code must look like this:

<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>
</asl>

WhitevanCandyman
So if I understand it correctly, if my quest desktop app is version 5.4.1 (build 5.4.4873.17397) I only have to open the .ASLX file with Notepad or Brackets and then change the version number to "541"?

HegemonKhan
yep, that should work.

<asl version="541">

if you can for a mac, you should download this program, it's really nice for code work (and it's free):

notepad++ ( http://notepad-plus-plus.org/ )

once you got it up and running, simply choose "XML" under the "Language" at the top menu bar.

WhitevanCandyman
I've done as you instructed, but it still shows the error

EDIT: Altering the build version number in the .ASLX file didn't do any good either

HegemonKhan
hmm... note sure then, maybe ask Alex, or maybe some mod or good programmer member may know (like Liam, lol)...

in the meantime... maybe try:

540 or 544

... other than that, I'm not sure...

try just to make a new game (making sure that you can at least use your download'able quest), and you can then check it's coding to see what it's version number is, and change your game file's coding to that, if you haven't tried that version number yet.

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

HK edit:

just a quick explanation of quest files:

A Game File's name and extension: your_game_file_name.aslx

A Game File's Coding:

<asl version="???">
-> your mass of game coding, lol
</asl>

A Library File's name and extension: your_library_file_name.aslx

A Game File's Coding:

<library>
-> your mass of coding, lol
</library>

----------

P.S.

ooo, just thought of this:

1. go into your web game file's code, highlight and copy it

2. create a new game file with your desktop version, and delete all of it's code (but remember what the version number is)

3. paste in your web version code, and change the version to it's proper number.

see if this works... if it doesn't... then maybe there's a (or a few or bunch of) code line(s) that are of the wrong syntax for the version you're using for your desktop version vs it's web version...

this isn't too big of a fix either, hardest will just be spotting what needs to be changed, lol.

WhitevanCandyman
That did it, thanks!

HegemonKhan
what was your version number (that worked)? just curious.

WhitevanCandyman
The desktop app made a game with the version number 540.

HegemonKhan
ah okay, so for the asl version number, you ignore the last digit (the "patches" of a version):

5.4.1 -> 5.4.0 -> 540

5.5.5 -> 5.5.0 -> 550

5.3.9 -> 5.3.0 -> 530

4.8.3 -> 4.8.0 -> 480

5.4.4873.17397 -> 5.4.0 -> 540

is how I'm thus assuming it works, lol.

I wanted to see what your version number matched up to, to your post's version numbers of your desktop app (desktop versionn):

whitevan wrote:So if I understand it correctly, if my quest desktop app is version 5.4.1 (build 5.4.4873.17397) I only have to open the .ASLX file with Notepad or Brackets and then change the version number to "541"?

WhitevanCandyman
If I write the code in the desktop app and then copy the code to my browser app, would it still work? I find the browser app much easier to work with

HegemonKhan
It should. well, maybe not if some things you do in the desktop version don't exist in the web version... meh...

--------

anyways, Alex does plan to make the web version as functional as the desktop version, but he hasn't finished it yet, obviously. He's working on it, as he wants to dump the desktop version all together, as the future is online~web, due to the problem of all the different devices and systems (whereas online bypasses having to code for each of the 1000's of devices~consoles~systems that people use).

WhitevanCandyman
I understand that he's working on Quest all by his lonesome self, is that correct?

WhitevanCandyman
Copying the code to the web app works, by the way

HegemonKhan
no idea if he's doing it entirely solo or not...

viewforum.php?f=15
(and there's other links too, but I don't know of them...)
(as this code stuff is way beyond my ability to understand, lol)

WhitevanCandyman
Alright, next problem! I've been following the entire tutorial and have arrived at the "Custom commands" section.

I do as instructed, I put

say #text#


in the command pattern, then put

"You say "\" + text + "\", but nobody replies."


as scripting code under Print expression. In the web app, it returns what I typed (When I type "Say Hello world!" it returns "Say Hello world!") and in the windows desktop app, when in game, it returns:

Error running script: Error compiling expression "You say "\" + text + "\", but nobody replies":SyntaxError: Unexpected character: \Line 1, Column: 11


Any ideas what I'm doing wrong? The wiki says that the \ is needed so it won't think the " is an end of a string

HegemonKhan
are you doing this in the GUI~Editor? if you are, make sure you change the drop down box:

from (default): [MESSAGE] = purely text
to: [EXPRESSION] = text + code (Attributes)

run as script -> add a script -> output -> print a message -> [EXPRESSION] -> (your message)

[MESSAGE]: Hi, my name is HK.

[EXPRESSION]: "Hi, my name is " + game.pov.alias + "."

outputs: Hi, my name is HK.

[EXPRESSION]: game.pov.alias + " is a " + game.pov.gender_string + " " + game.pov.race_string + " " + game.pov.class_string + "."

outputs (for example): HK is male human warrior.

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

otherwise, your syntax is simply wrong (this is annoying as "bleep"... I still have difficulty in getting it right myself, ARGH!)

I'd need to see what your code looks like (if you could post this part of your code), to be able to fix it up for you.

as, how you write it out, is different between in-code vs in-GUI~Editor, which might be causing why it's incorrectly syntaxed.

for practice, try to do the "character creation", as it involves practice with syntaxing an [EXPRESSION] "print message" script:

http://quest5.net/wiki/Character_Creation
http://quest5.net/wiki/Showing_a_menu

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

here's the "rules" to the syntax writing of an [EXPRESSION] "print message" script:

break it up into "chunks":

" text "
+ Object.Attribute +

AND~OR

text
" + Object.Attribute + "

for example:

In Code:

msg (game.pov.alias + " is a " + game.pov.age_integer + " year old " + game.pov.gender_string + " " + game.pov.age_string + " " + game.pov.race_string + " " + game.pov.class_string + ".")

outputs (for example): HK is a 18* year old male adult human warrior.

*(I wish, lol)

the "chunks":

game.pov.alias + " ( this quote mark matches up with the quote mark in: ." )
is a
" + game.pov.age_integer + "
year old
" + game.pov.gender_string + "
" + game.pov.age_string + "
" + game.pov.race_string + "
" + game.pov.class_string + "
." ( this quote mark matches up with the quote mark in: game.pov.alias + " )

AND~OR

game.pov.alias +
" is a "
+ game.pov.age_integer +
" year old "
+ game.pov.gender_string +
" (space) "
+ game.pov.age_string +
" (space) "
+ game.pov.race_string +
" (space) "
+ game.pov.class_string +
"."


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

actually, you can compare your tutorial game file to my own tutorial game file, lol

(I did the tutorial way back when it was still version="520", and I'm too lazy to go through it, updating the code line syntaxes to the new version's format of them, so I can't add the game file as an attachment, as you'd need to change the syntaxes yourself for it to work, ie load~open~start~play it, anyways)

(despite that some of the syntax may be different and etc, it should still be useful and viable to compare it with your tutorial game attempt)

so, here's it in code:

<asl version="520">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Tutorial Game">
<gameid>842278ef-87f7-4fa9-8a9f-7f81f2933f46</gameid>
<version>1.0</version>
</game>
<object name="lounge">
<inherit name="editor_room" />
<description>This is quite a plain lounge with an old beige carpet and peeling wallpaper.</description>
<object name="player">
<inherit name="defaultplayer" />
<scenery />
<alias>me</alias>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<turns type="int">0</turns>
<statusattributes type="stringdictionary">turns = </statusattributes>
</object>
<exit alias="south" to="kitchen">
<inherit name="southdirection" />
</exit>
<object name="tv">
<inherit name="editor_object" />
<inherit name="switchable" />
<alt>television; telly</alt>
<look>The tv is an old model, possibly 20 years old.</look>
<switchedondesc>It is currently showing an old western.</switchedondesc>
<switchedoffdesc>It is currently switched off.</switchedoffdesc>
<switchonmsg>You press the power button and the tv turns on.</switchonmsg>
<switchoffmsg>You press the power button again and the tv turns off.</switchoffmsg>
<watch type="script">
if (IsSwitchedOn(tv)) {
msg ("You watch for a few minutes. As your will to live slowly ebbs away, you remember that you’ve always hated watching westerns.")
}
else {
msg ("You watch for a few minutes, thinking that the latest episode of ‘Big Brother’ is even more boring than usual. You then realise that the TV is in fact switched off.")
}
</watch>
</object>
<object name="sofa">
<inherit name="editor_object" />
<look>You see a big soft red sofa to sit on.</look>
<sit>There's no time for lounging about now.</sit>
</object>
<object name="table">
<inherit name="editor_object" />
<inherit name="surface" />
<look>There's a large wooden table in the middle of the lounge.</look>
<object name="lamp">
<inherit name="editor_object" />
<inherit name="switchable" />
<look>This is an old fashioned lamp.</look>
<switchedon />
<switchonmsg>The switched on lamp shines brightly.</switchonmsg>
<switchoffmsg>The switched off lamp goes dim quickly.</switchoffmsg>
<switchedondesc>The lamp smells of burning candle wax.</switchedondesc>
<switchedoffdesc>Your eyes slowly adjust to the darkened room.</switchedoffdesc>
<take />
</object>
<object name="flowers">
<inherit name="editor_object" />
<inherit name="plural" />
<look>They are very pretty and sweet smelling red roses.</look>
<take />
<usedefaultprefix />
</object>
<object name="newspaper">
<inherit name="editor_object" />
<look>You see a newspaper from last week.</look>
<read>You read the old newspaper's contents, learning nothing new.</read>
<take />
<takemsg>You fold the newspaper and place it neatly under your arm.</takemsg>
<dropmsg>You forget about the newspaper under your arm, dropping it as you move and use your arms.</dropmsg>
</object>
<object name="defibrillator">
<inherit name="editor_object" />
<look>A heart defibrillator can magically revive a dead person, if all those hospital dramas are to be believed.</look>
<take />
<use type="script">
if (player.parent = lounge) {
revive Bob
}
else {
msg ("You're not even remotely close enough to place the defibrillator on Bob's chest.")
}
</use>
</object>
<object name="spellbook">
<inherit name="editor_object" />
<inherit name="container_open" />
<take />
<listchildren />
<object name="fireball">
<inherit name="editor_object" />
<drop />
<spell />
<learn type="string"></learn>
<cast type="string"></cast>
</object>
</object>
</object>
<object name="wallpaper">
<inherit name="editor_object" />
<scenery />
<look>The horrible beige wallpaper hangs loosely on the walls.</look>
</object>
<object name="carpet">
<inherit name="editor_object" />
<scenery />
<look>The old beige carpet really is dirty and smells bad, you need to replace it with a new carpet soon.</look>
</object>
<object name="Bob">
<inherit name="editor_object" />
<inherit name="male" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<alt type="list"></alt>
<look type="script">
if (GetBoolean(Bob, "alive")) {
msg ("Bob is sitting up, appearing to feel somewhat under the weather.")
}
else {
msg ("Bob is lying on the floor, a lot more still than usual.")
}
</look>
<askdefault type="script">
if (GetBoolean(Bob, "alive")) {
msg ("I can't help you, sorry.")
}
else {
msg ("He is dead, you won't get an answer from him.")
}
</askdefault>
<useon type="scriptdictionary">
<item key="defibrillator">
revive Bob
</item>
</useon>
<tell type="scriptdictionary" />
<ask type="scriptdictionary">
<item key="heart attack cardiac arrest">
if (GetBoolean(Bob, "alive")) {
msg ("Well, one moment I was sitting there, feeling pretty happy with myself after eating my afternoon snack - a cheeseburger, pizza and ice cream pie, smothered in bacon, which I'd washed down with a bucket of coffee and six cans of Red Bull - when all of a sudden, I was in terrible pain, and then everything was peaceful. Then you came along.")
}
else {
msg ("He is dead, you won't get an answer from him.")
}
</item>
</ask>
</object>
<object name="troll">
<inherit name="editor_object" />
<inherit name="male" />
<look>He's a big green ugly troll.</look>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<alt type="list"></alt>
</object>
</object>
<object name="kitchen">
<inherit name="editor_room" />
<description>The kitchen is is an ordinary kitchen with a trash bin, a fridge, and Sarah.</description>
<exit alias="north" to="lounge">
<inherit name="northdirection" />
</exit>
<object name="bin">
<inherit name="editor_object" />
<scenery />
<look>This is the trash bin, it smells very bad.</look>
<alt type="list"></alt>
</object>
<object name="Sarah">
<inherit name="editor_object" />
<inherit name="female" />
<inherit name="surface" />
<look>She is beautiful with curly long blond hair and blue eyes.</look>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<open type="boolean">false</open>
<close type="boolean">false</close>
<give type="scriptdictionary">
<item key="flowers">
msg ("Sarah takes the flowers and kisses you.")
MoveObject (flowers, Sarah)
</item>
</give>
</object>
<object name="fridge">
<inherit name="editor_object" />
<inherit name="container_closed" />
<listchildren />
<look type="script">
if (fridge.isopen) {
msg ("The fridge is open, casting its light out into the gloomy kitchen.")
}
else {
msg ("A big old refrigerator sits in the corner, humming quietly.")
}
</look>
<object name="flour">
<inherit name="editor_object" />
<inherit name="plural" />
<weight type="int">500</weight>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
<take />
</object>
<object name="eggs">
<inherit name="editor_object" />
<inherit name="plural" />
<weight type="int">250</weight>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
<take />
<look type="script">
msg ("A box of eggs, weighing " + eggs.weight + " grams.")
</look>
</object>
<object name="sugar">
<inherit name="editor_object" />
<weight type="int">1000</weight>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
<take />
</object>
<object name="milk">
<inherit name="editor_object" />
<look>This is milk is rotten.</look>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
<take />
<weight type="int">200</weight>
</object>
<object name="cheese">
<inherit name="editor_object" />
<look>This is ordinary yellow cheese.</look>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
<take />
<weight type="int">100</weight>
</object>
<object name="beer">
<inherit name="editor_object" />
<look>This is really powerful beer, that will get anyone drunk.</look>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
<take />
<weight type="int">750</weight>
</object>
<object name="apple">
<inherit name="editor_object" />
<look>It is a yummy red apple.</look>
<take />
<eat type="script">
msg ("You eat the apple. Tasty.")
RemoveObject (apple)
</eat>
</object>
</object>
<object name="cupboard">
<inherit name="editor_object" />
<inherit name="container_closed" />
<look>You see an ordinary cupboard.</look>
<listchildren />
<listchildrenprefix>The cupboard is bare except for...</listchildrenprefix>
<object name="beans">
<inherit name="editor_object" />
<inherit name="plural" />
<look>These are ordinary dark beans.</look>
<take />
<weight type="int">400</weight>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
</object>
<object name="rice">
<inherit name="editor_object" />
<look>This is ordinary white rice.</look>
<take />
<weight type="int">600</weight>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>some</prefix>
</object>
</object>
<object name="window">
<inherit name="editor_object" />
<inherit name="openable" />
<look>This is an ordinary glass window.</look>
<openscript type="script">
HelperOpenObject (window)
if (Contains (kitchen,bee)) {
msg ("You open the window. Not much happens.")
}
else {
msg ("You open the window and a bee flies into the kitchen.")
MoveObject (bee, kitchen)
EnableTimer (bee timer)
}
</openscript>
<closescript type="script">
msg ("You close the window.")
HelperCloseObject (window)
</closescript>
</object>
</object>
<verb>
<property>watch</property>
<pattern>watch</pattern>
<defaultexpression>"You can't watch " + object.article + "."</defaultexpression>
</verb>
<command name="say">
<pattern>say #text#</pattern>
<script>
msg ("You say, \"" + text + "\", but nobody replies.")
</script>
</command>
<command name="weigh">
<pattern>weigh #object#</pattern>
<script>
if (HasAttribute(object, "weight")) {
msg ("It weighs " + object.weight + " grams.")
}
else {
msg ("You can't weigh that.")
}
</script>
</command>
<object name="bee">
<inherit name="editor_object" />
<look>This is an african killer bee.</look>
</object>
<turnscript>
<enabled />
<script>
player.turns = player.turns + 1
</script>
</turnscript>
<verb>
<property>learn</property>
<pattern>learn</pattern>
<defaultexpression>"You can't learn " + object.article + "."</defaultexpression>
</verb>
<verb>
<property>cast</property>
<pattern>cast</pattern>
<defaultexpression>"You can't cast " + object.article + "."</defaultexpression>
</verb>
<command name="saying">
<pattern>say #text_talk# to #object_troll#</pattern>
<script>
if (object_troll.parent=player.parent) {
msg ("You say: " + text_talk)
msg (object_troll.name + " ignores you.")
}
</script>
</command>
<type name="spell">
<drop type="boolean">false</drop>
<take type="boolean">false</take>
<learn type="script">
if (not this.parent = player) {
this.parent = player
msg ("How about that? You can now cast " + this.alias + ".")
}
else {
msg ("Er, you already know that one!")
}
</learn>
</type>
<function name="revive Bob">
if (GetBoolean(Bob, "alive")) {
msg ("Bob is already alive.")
}
else {
msg ("Miraculously, the defibrillator lived up to its promise, and Bob is now alive again. He says his head feels kind of fuzzy.")
SetObjectFlagOn (Bob, "alive")
}
</function>
<timer name="bee timer">
<interval>20</interval>
<script>
if (player.parent = kitchen) {
msg ("The bee buzzes past you. Pesky bee.")
}
</script>
</timer>
</asl>


maybe at some point, I'll go through and update it to a more recent version, maybe...

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

HK Edit:

in Code it looks like this:

msg ("You say, \"" + text + "\", but nobody replies.")

in the GUI~Editor, it should look like this:

run as script -> add a script -> output -> print a message -> [EXPRESSION] ->

"You say, \"" + text + "\", but nobody replies."

personally, I always get confused which side the \ goes with the ", lol, so I just use instead, the single quatation marks:

"You say, ' " + text + " ' , but nobody replies."

WhitevanCandyman
Hi there Hegemon,

I wrote the script with my bare hands, with the help of the tutorial.
I've added two screenshots of the GUI and the code view and put them in one image for your convenience.
Screen Shot 2014-02-27 at 09.29.24.png

HegemonKhan
try this (as I think the wiki put the left ' \ ' in the wrong place):

"You say \" " + text + " \", but nobody replies."

WhitevanCandyman
Yeah, that did it. I thought it was a typo on the tutorial. Silly me!

HegemonKhan
hate the smallest + simpliest + stupid'est mistakes... as they're often the hardest to spot, lol.

WhitevanCandyman
Yeah, well, I thought that it wouldn't make sense to put the first like \"" and the second like "\".

WhitevanCandyman
Alright, so I've been playing around with the IF scripts for a while now, and was wondering if there is an IF expression to use for when the room is either light or dark.

HegemonKhan
here's in-code stuff (not sure how to do it in the GUI~Editor though):

(I haven't worked with dark~light stuff yet, so I can't be of much more help than giving these links)

http://quest5.net/wiki/Dark
http://quest5.net/wiki/SetDark
http://quest5.net/wiki/SetLight
http://quest5.net/wiki/CheckDarkness
http://quest5.net/wiki/SetObjectLightstrength
http://quest5.net/wiki/SetExitLightstrength
http://quest5.net/wiki/Darklevel
http://quest5.net/wiki/Lightstrength

Object.dark = true -> dark
Object.dark = false -> (I presume) light

Object.weak
Object.strong

WhitevanCandyman
It also seems to not play any sounds when I, for example, want to sit on the old swing set.

msg ("{once:You sit on the swing, after which you can hear a loud crack coming from the swing.}<br/>It seems best not to sit on it.")
play sound ("66780__kevinkace__crate-break-4.wav", false, false)


EDIT: Nevermind! I was playing my game in the Safari browser and apparently sounds don't work in it.

WhitevanCandyman
Okay, so, does anyone know how to change the layout of the menus? I'm talking about the areas highlighted in red:
Screen Shot 2014-02-28 at 14.18.47.png

WhitevanCandyman
So I've been playing around with the IF functions a lot and they are very useful, but I have a question about them.

Is it possible for something to have two IFs? Example:…


IF player is in room Kitchen AND object has flag Phone ringing


Basically I wish to know if there is an AND function or something similiar.

xavea
For something like that, I use nested if commands:

If: player is in kitchen
If: object has flag phone ringing
Then: desired outcome


That way both clauses need to be true for the desired outcome to happen. It has worked that way for me.

tlk
That does work, but you can also just use "and" exactly like you would think to be a little more efficient (assuming you don't mind writing out a bit of code):

if (player.parent=kitchen and phone.ringing=true) {
msg ("Whatever you want to happen.")
}


You can do this for as many conditions as need to be met, just remember that the whole condition has to be presented in each case. Not a problem in that example, but if you were testing multiple attributes on one object it can throw you off if you're not used to it. Example:

if (player.hp>5 and <10)


doesn't work, but

if (player.hp>5 and player.hp<10)


does. You can also use "or" in a similar manner to run your desired script if any of a handful of conditions are met rather than all of them.

WhitevanCandyman
Alright, thanks for the replies. I'll give both of them a go and I'll get back to you if they work and for troubleshooting. Thanks!

EDIT: Alright, using tlk's solution, I made this piece of code:


if (game.pov.parent = Kitchen and GetBoolean(Wallphone, "ringing")) {
msg ("You pick the phone up. A somewhat hoarse voice asks you \"Is your refrigerator running?\" after which the once somewhat noisy refrigerator appears to have grown sentient.<br/><br/>With an awe inspiring growl it stands on its four small legs. The once inanimate refrigerator, now startled and appalled, lets out a mighty roar and screams \"I HAVE BEEN COMPROMISED! ABORT MISSION! MY KIND CANNOT BE SEEN!\".<br/><br/>With a powerful leap it jumps through the hole in the wall and disappears in the forest across the river.<br/><br/>After this event, you reply to the man on the phone.<br/>\"Why yes, it <b>is</b> running! Thanks for warning me!\"")
MoveObject (Refrigerator, Forest clearing)
IncreaseScore (0)
}
else {
if (game.pov.parent = Kitchen) {
msg ("The phone isn't ringing.")
}
else {
if (GetBoolean(Wallphone, "ringing")) {
msg ("You're nowhere near the phone.")
}
else {
msg ("What phone?")
}
}
}


TL;DR What I'm doing here is IF the player is in the kitchen AND the phone is ringing, you can pick it up.
If the player is in the kitchen but the phone isn't ringing, it'll say that the phone isn't ringing.
If the player is not in the kitchen, it'll say that there's no phone to pick up.
When the player enters the kitchen, it'll run a script after 20 seconds adding a flag to the phone and printing a message.
If the player entered the kitchen before, thus triggering the 20 seconds, but has moved rooms, it'll say that the phone in the kitchen is ringing. If the player then tries to pick it up, it'll say that the player is nowhere near the phone.
I haven't tested it out yet, but I soon will!


EDIT: It worked like a charm! Everything but the timer works. After entering the kitchen for the first time, it has to run this script:


SetTimeout (20) {
SetObjectFlagOn (Wallphone, "ringing")
if (game.pov.parent = Kitchen) {
msg ("The phone is ringing. {command:pick the phone up:Pick it up?}")
}
else {
msg ("The phone in the kitchen is ringing.")
}
}


The 20 seconds pass, but the message doesn't print. Any thoughts?


EDIT: Alright, well, it fixed itself, though it plays after 10 seconds, not 20… Weird!

HegemonKhan
while you seem to now get how to use the conditionals of:

and
or

let me just point out how you can use them for~with numbers, including within (or without of) a range:

if (x > 0 and x < 10) {
-> msg ("hi")
} else {
-> msg ("bye")
}

what is my range of numbers that will result in the output of "hi" ???
Answer: 1 through 9

what is my range of numbers that will result in the output of "bye" ???
Answer: (-oo through 0) and (10 through +oo)

------

if (x < 0 and x > 10) {
-> msg ("hi")
} else {
-> msg ("bye")
}

what is my range of numbers that will result in the output of "hi" ???
Answer: (-oo through -1) and (11 through +oo)

what is my range of numbers that will result in the output of "bye" ???
Answer: 0 through 10

-----------

if (x=5 or x=10) {
-> msg ("hi")
} else {
-> msg ("bye")
}

what numbers will result in the output of "hi" ???
Answer_1: 5
Answer_2: 10

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

if (x=5 and y=10) {
-> msg ("hi")
} else {
-> msg ("bye")
}

Answer: only when you got x=5 and y=10, at the same time
Wrong: x=5 and y<>10
Wrong: x<>5 and y=10

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

if (x=5 or y=10) {
-> msg ("hi")
} else {
-> msg ("bye")
}

what numbers will result in the output of "hi" ???
Answer_1: x=5 and y=any number
Answer_2: y=10 and x=any number

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

there's also the conditional of "not equals":

not
~OR~
<>

if (not x=5) {
~OR~
if (x<>5) {

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

here's two examples:

<function name="age_integer_to_string_function" parameters="object_x"><![CDATA[
if (object_x.age_integer >= 0 and object_x.age_integer < 4) {
object_x.age_string = "baby"
} else if (object_x.age_integer >= 4 and object_x.age_integer < 13) {
object_x.age_string = "child"
} else if (object_x.age_integer >= 13 and object_x.age_integer < 20) {
object_x.age_string = "teen"
} else if (object_x.age_integer >= 20) {
object_x.age_string = "adult"
}
]]></function>


<function name="day_of_birth_integer_function"><![CDATA[
msg ("What is your day of birth?")
get input {
if (IsInt (result) = false) {
day_of_birth_integer_function
} else if (IsInt (result) = true) {
if (game.pov.month_string = "january" or game.pov.month_string = "march" or game.pov.month_string = "may" or game.pov.month_string = "july" or game.pov.month_string = "august" or game.pov.month_string = "october" or game.pov.month_string = "december") {
if (ToInt (result) > 0 and ToInt (result) < 32) {
game.pov.day_integer = ToInt (result)
} else if (ToInt (result) < 1 or ToInt (result) > 31) {
day_of_birth_integer_function
}
} else if (game.pov.month_string = "april" or game.pov.month_string = "june" or game.pov.month_string = "september" or game.pov.month_string = "november") {
if (ToInt (result) > 0 and ToInt (result) < 31) {
game.pov.day_integer = ToInt (result)
} else if (ToInt (result) < 1 or ToInt (result) > 30) {
day_of_birth_integer_function
}
} else if (game.pov.month_string = "february") {
if (global_data_object.year_integer = global.data_object.old_leap_year_integer) {
if (ToInt (result) > 0 and ToInt (result) < 30) {
game.pov.day_integer = ToInt (result)
} else if (ToInt (result) < 1 or ToInt (result) > 29) {
day_of_birth_integer_function
}
} else if (global_data_object.year_integer <> global.data_object.old_leap_year_integer) {
if (ToInt (result) > 0 and ToInt (result) < 29) {
game.pov.day_integer = ToInt (result)
} else if (ToInt (result) < 1 or ToInt (result) > 28) {
day_of_birth_integer_function
}
}
}
}
}
]]></function>

WhitevanCandyman
Great stuff! I never knew how powerful those scripts could be. I do have a question, though. After picking the phone up, the refrigerator rushes off to the forest clearing only to be struck by an assailant. In the scripts, it moves the refrigerator to the forest clearing, after which I want it to display a different "look at" message. My code for the "look at" looks like this:



if (Refrigerator = Forest clearing) {
msg ("The once great refrigerator is now lying back-down on the grass in a puddle of cooling liquid. It looks like it's… dying?")
}
else {
msg ("A small and noisy refrigerator. It is completely white with some rusty stains at the bottom.")
}



Right after the "IF" function, you'll see (Refrigerator = Forest clearing). I thought that it would work the same as the "playerIsInRoom" function but it doesn't. It doesn't display a different "look at" message when in the forest clearing. Does anyone know how to make it display a different "look at" message when it is in a different room? I double-checked the capitals, so it can't be that.

Liam315
It needs to be:

if (Refrigerator.parent = Forest clearing) {

WhitevanCandyman
Sweet, it worked! I can't believe how helpful this community is! ^_^

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

Support

Forums