Bob and the defibrillator

Candacis
19 Apr 2013, 10:15Hi there, I'm really new at Quest and so I'm trying to do the tutorial. I got to the "More things to do with objects" chapter.
First, I think, I spotted a little mistake in the tutorial:
This confused me at first, because the tutorial used the Use/Take tab all the time and not the inventory tab. Is this from an older version?
Anyway, now I'm stuck at this:
I don't even know where to begin. I assumed I have to alter the script on the defibrillator use/take tab under "use (on its own)". I've tried to make a new script, starting with "If" and "player is in room". But when I try to print a message under the "else" tab, I get an error:
This is a screenshot from my problem page:

Can someone help me? What did I do wrong?
First, I think, I spotted a little mistake in the tutorial:
First, go to Bob's inventory tab, and double click "defibrillator" in the "Use" table to bring up the Script Editor.
This confused me at first, because the tutorial used the Use/Take tab all the time and not the inventory tab. Is this from an older version?
Anyway, now I'm stuck at this:
Note that if you pick up the defibrillator and go to the kitchen, "use defibrillator" will still work. It would be pretty remarkable for a defibrillator to work at such a long range, so consider adding an "if" command to the "revive bob" procedure. You can select "player is in room" from the list of conditions to check whether the player is in the lounge before carrying out the defibrillation. If they're not in the lounge, print a suitably sarcastic message.
I don't even know where to begin. I assumed I have to alter the script on the defibrillator use/take tab under "use (on its own)". I've tried to make a new script, starting with "If" and "player is in room". But when I try to print a message under the "else" tab, I get an error:
System.NullReferenceException: Object reference not set to an instance of an object.
at TextAdventures.Quest.EditorControls.ScriptEditorControl.AddNewScriptCommand(String script)
at TextAdventures.Quest.EditorControls.ScriptEditorControl.cmdAddScript_Click(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
This is a screenshot from my problem page:

Can someone help me? What did I do wrong?

Pertex
19 Apr 2013, 13:29Yes , you are right. I changed the first point in the wiki.
For your second problem we need more information. Could you click this button

and post the complete code here?
For your second problem we need more information. Could you click this button

and post the complete code here?

Candacis
19 Apr 2013, 16:15Thanks for the fast reply ^_^
Here is the code you asked for:
If I try to get a else message, it doesn't let me and displays the error I posted earlier.
Here is the code from my revive Bob function:
Am I even on the right path trying to get an if command unter the defibrillator use (on its own) tab? I'm not really familiar with code language except a little html and css.
Here is the code you asked for:
if (game.pov.parent = lounge) {
revive Bob
}
else {
}
If I try to get a else message, it doesn't let me and displays the error I posted earlier.
Here is the code from my revive Bob function:
if (GetBoolean(Bob, "alive")) {
msg ("Bob is alive. You don't need to use the defibrillator again.")
}
else {
msg ("Miraculously, the defibrillator lived up to is promise, and Bob is now alive again. He says his head feels kind of fuzzy.")
SetObjectFlagOn (Bob, "alive")
}
Am I even on the right path trying to get an if command unter the defibrillator use (on its own) tab? I'm not really familiar with code language except a little html and css.

Pertex
19 Apr 2013, 18:48Strange, I don't get this message. I don't know why this message appears. Are you working with the online or the oflline editor?
And no, you are not on the right way.
"use (on its own)" is correct if you want to "use defibrilator". If you want to "use defibrilator on bob" you have to add a script at the "use this on other object" section

And no, you are not on the right way.



Candacis
19 Apr 2013, 22:19I'm using the offline editor and the newest version of Quest (downloaded it yesterday).
I thought, if you want to use defibrillator on bob, I have to add a script under Bobs use/take script. Is this not enough? Is your approach to add a script under the defibrillator "use this on other objects" better? Should I then delete the script in the use/take tab from Bob? I'm just trying to understand.
Okay, I just tried again to add a message under the "else" line and now it worked properly. ^_^ I don't know what I did to get the error message last time. Sorry for the trouble
I thought, if you want to use defibrillator on bob, I have to add a script under Bobs use/take script. Is this not enough? Is your approach to add a script under the defibrillator "use this on other objects" better? Should I then delete the script in the use/take tab from Bob? I'm just trying to understand.
Okay, I just tried again to add a message under the "else" line and now it worked properly. ^_^ I don't know what I did to get the error message last time. Sorry for the trouble

HegemonKhan
20 Apr 2013, 06:48I'm not sure if this is the error, but I would constantly get errors when I was a noob working with the GUI~Editor and with the tutorial, due to my deleting of script lines (due to messing up and putting in the wrong script or at the wrong "nesting" ~ indenting level ~ the wrong "add new script" button or whatever other mistake I'd make), and not then re-adding a script there at that spot. Quest is waiting for me to put in the script line that I want, and thus when I don't do so, it gives me the error message, when I try to add in another script line elsewhere (not realizing at the time that I have the "hanging" empty script line that quest needs me to re-add in for it, and so, quest blocks me from doing so. Upon saving, exiting ~ closing quest, and re-opening ~ starting quest, the error message is now removed, and I can add script lines again anywhere (however, this might be only temporary, as the missing~"hanging" empty script line remains still, I can't remember, if the error message re-pops up again, or not).
I could help you through the tutorial, if you want, though it'll take me a bit of time, to re-read the updated tutorial to get to the spot that you're at, so that I know what I'm doing, so that I can then help you through it correctly. As it's been quite a while since I've done the tutorial (and a now obsolete~old tutorial at that too), so I don't remember much of the content of it, and nor of the defibriliator part, though it shouldn't take me too long to get "up-to-speed" on the new tutorial, and be ready to help you. The only problem though, is that I'm very busy with things, work, I got to do in real life (yes, even on the weekend, sighs).
I'll see if I can find~have the time to work on this for you, but I may not have the time to do so too.
I could help you through the tutorial, if you want, though it'll take me a bit of time, to re-read the updated tutorial to get to the spot that you're at, so that I know what I'm doing, so that I can then help you through it correctly. As it's been quite a while since I've done the tutorial (and a now obsolete~old tutorial at that too), so I don't remember much of the content of it, and nor of the defibriliator part, though it shouldn't take me too long to get "up-to-speed" on the new tutorial, and be ready to help you. The only problem though, is that I'm very busy with things, work, I got to do in real life (yes, even on the weekend, sighs).
I'll see if I can find~have the time to work on this for you, but I may not have the time to do so too.
HegemonKhan
20 Apr 2013, 12:08Note: this is for quest v5.3, I've not updated to v5.4 yet. Some things might be different, but I think most will be the same, hopefully.
----------------------
A Partial Tutorial Guide:
The "GUI" (Graphical User Interface) or "Editor" is the screen or window that you can click on, and choose the objects and settings~options, with dropdown menus for you to choose from. Your own computer's~window's desktop is an example of a GUI~Editor (compared to using the MS Dos like command prompts). This is made for noobs, and thus a big appeal~mission of Alex' Quest, to make a text adventure game available for non-coders to use (while still as well also being even more powerful a text adventure game engine for coders to use too).
on the left side (the "left pane") is the "tree of stuff", a new game's tree would look like this:
Objects (everything is either an object or a script. A script is code that which does, conditions, and~or defines stuff)
-> Game (this is a unique object, the Game Object)
->-> Verbs ("Local" Verbs. Local means that the verb ONLY works on that specific object that you created it for. Verbs show up as buttons on the right pane, "Places and Objects", and as "hyperlinks = the blue text that you can click on for options" when you are playing the game)
->-> Commands ("Universal" Verbs. Universal means for commands that the command can be "attempted = depends on how the command is set up" on any object anywhere. Commands require that the game player actually type in the command itself)
-> Room (the default and initial Room Object. A "Room" type object)
->-> Player (the default Player Object. the Player Objects are another unique object. you can create many other Player Objects too, and be able to switch between them)
Functions ("passive" powerful action scripts. Passive means that quest doesn't automatically and nor constantly do the script)
Timers ("clock" scripts = used to create seconds, minutes, hours, and~or etc ... though very unpractical to go into days, weeks, months, years, lol)
Walkthrough (for game making and~or game testing)
Advanced
-> Included Libraries (a game file made as a "library" file, so that others can put it into their own game and use it's stuff, as their Included Libraries, notice the default two Included Libraries: Core.aslx = the game engine, and english.aslx = english language text~font)
->-> English.aslx
->-> Core.aslx
Templates (a useful "tool" for easy~"Universal" labeling things, making messages too ,and~or to change the labelings of things = such as for foreign language game makers, converting~translating an english game into their language)
Dynamic Templates (see Templates, basically it's the same in differences to a Template, as with the example of: Print a [MESSAGE] = just text = Template vs Print an [EXPRESSION] = script and~or text = Dynamic Template)
Object Types (think of this as creating an "object group", such as for example a "monster_type". I set all the attributes such as "dead=false", "hp", "mp", and etc, that I want for this Object Type, "monster_type", and then for each object that I create to be a "monster object", all I have to do is to add the "Inherited" attribute, "monster_type", and that object gets all of the attributes of that object type, and so it automatically gives that object, the attributes: "dead=false", "hp", "mp", and etc. I can do this again, for another object that I want to be a "monster object", by again just adding the "Inherited" attribute, "monster_type". so, this saves me the redundency of having to manually add these same attributes over and over again for every object that I make and want to be a "monster object". I think "room" objects, "object" objects, and "object and/or room" objects are all Object Types. You can see "Inherited" = Object Type = "Type" Attributes by: Player -> Attributes Tab. All the light greyed stuff, under "Inherited Types" and "Attributes ~ the bottom box" are attributes that are automatically given from the Inherited Type, "defaultplayer" or the other Inherited Type attributes too. So, yes, you can assign an Inherited Type upon~within another Inherited Type, you can have many layers~levels deep of Inherited Types and their Attributes for just a single Inherited Type)
Javascript (this is for coders to use alternative additional coding, Javascript, to do more cool stuff, lol)
and, the right side (right pane),
is additional details~options menu~window, for whatever you've clicked on (have highlighted) in the left pane (the "tree of stuff")
lastly, there's also the bar at the top:
File ~ Edit ~ Add ~ Tools ~ Help
The "Add" is also (just like the right pane) based upon what you got highlighted in the left pane (the tree of stuff).
Notable "Add" choices are:
Object (let's you add an "object" object)
Room (let's you add a "room" object)
Exit (let's you add~create "Exits" = connects two rooms together)
Turnscript (this is an "Active" action script. "Active" means that the game engine is constantly and automatically running~using it. Do note that you can create an "Universal" Turnscript or a specific Turnscript for a room, depending on whether you got "Object", or, for example, "Room", highlighted in the left pane ~ the "tree of stuff")
Generally about the right pane:
for an example, click on "Game" (left pane, the "tree of stuff") so that it is highlighted:
you'll now see further details about "Game" (remember that this is the unique object, Game Object), in the right pane, which looks like this:
game
6 Tabs: Setup (1) ~ Script (2) ~ Room Descriptions (3) ~ Player (4) ~ Display (5) ~ Attributes (6)
clicking on the different Tabs, changes what is displayed below the Tabs
some of the options are the exact same as in the top bar's "Add" choice (File ~ Edit ~ Add ~ Tools ~ Help), you can use either method (the way of reaching the desired option), the options are the exact same, they do the same thing.
so for an example, in my guide I'll give a "path" for you to follow to get to the right place, and then what you do there:
Path: Game -> Script (Tab) -> Start Script (such as for a character creation script block) -> Add new script ->
so, as practice, do you understand this?
---------------------------
two extremely powerful, useful, and commonly~constantly used scripts:
Variables -> Set a variable or attribute
Scripts -> If... ( or Switch... )
two extremely powerful, useful, and commonly~constantly used attribute types:
boolean = "flagging" = true/false
integer = -OO , ... , -1, 0, +1, ... , +OO
example of a boolean ("flagging"):
a key is too high to reach, but if you could fly, you can get the key.
boolean: "flying" = false (because you are "walking") :: can't get the key
boolean: "flying = true :: can get the key
or (explanation shouldn't be needed, lol):
boolean: "running" = false :: game.pov.speed = 1
boolean: "running" = true :: game.pov.speed = 2
integers (creatively) can be used as booleans:
if (npc.dialogue = 0), then msg ("Hi")
if (npc.dialogue = 1), then msg ("Bye")
if (npc.dialogue = 2), then msg ("Die!")
if (npc.dialogue = -10), then msg ("I hate you!")
if (npc.dialogue = 10), then msg ("I love you!")
OR
switch (npc.dialogue)
-> case
->-> ("0")
->->-> msg ("Hi")
->-> ("1")
->->-> msg ("Bye")
->-> ("2")
->->-> msg ("Die!")
->-> ("-10")
->->-> msg ("I hate you!")
->-> ("10")
->->-> msg ("I love you!")
examples of these in use (but they're not in correct format, this is for concept~understanding only, intentional shown in a code-like fashion, so you start to get used to code, lol. As the GUI~Editor is not easy to do guides of~for, nor to fix problems, and etc, lol):
--------------------------------------------------------------------------------
Defibriliator section:
(you've no idea how many times I had to spell out defibrillator, when I was a noob trying to do the tutorial myself, I actually learned how to spell out defibrillator at the time, and I've proudly forgotten and never spelled that cursed word again, until now, lol)
here's the steps:
http://quest5.net/wiki/Interacting_with_objects
CREATING A CHARACTER
Room -> Objects (Tab) -> Add -> name: Bob
Bob -> Setup (Tab) -> (lower) Type -> [MALE CHARACTER]
Bob -> Setup (Tab) -> Description -> [TEXT] -> Bob is lying on the floor, a lot more still than usual.
PREFIX AND SUFFIX
Bob -> Setup (Tab) -> [X] Use default prefix and suffix -> [] Use default prefix and suffix
OR
Bob -> Setup (Tab) -> (lower) Type -> [ MALE CHARACTER (NAMED) ] (I don't have this option in v5.3, lol)
http://quest5.net/wiki/More_things_to_do_with_objects
GIVING AND USING OBJECTS
This just gives a general overview of what will be discussed in actual detail on how to do this stuff in the below sections
UPDATING THE DESCRIPTION
Bob -> Setup (Tab) -> Description -> [RUN SCRIPT] -> Add new script ->
Scripts -> If... -> If [OBJECT HAS FLAG] -> If [OBJECT HAS FLAG] [OBJECT] [Bob] [FLAG NAME] alive ->
-> then, Add a script -> Output -> Print A Message -> Print [MESSAGE] "(see tutorial)" ->
Add Else, Add new script ->
-> Print [MESSAGE] "(see tutorial)"
USING THE DEFIBRILLATOR
Object (left pane) -> top bar -> Add -> Room -> name: Lounge (or did the tutorial have you simply change your "Room" object's Name or Alias to "Lounge" ??? meh)
Lounge -> Object (Tab) -> Add -> name: defibrillator
defibrillator -> Setup (Tab) -> Description -> [TEXT] -> "(see tutorial)"
defibrillator -> Inventory (Tab) -> [] Object can be taken -> [X] Object can be taken
Bob -> Use/Give (Tab) -> Use other object on this -> action [HANDLE OBJECTS INDIVIDUALLY] -> Add (box) -> name: defibrillator (spell exactly correctly ~ the same as your "defibrillator" object) or just choose from the drop~pull down arrow, lol ->
Script Window (if you can't see this script window, then close, but don't exit~quit lol, all your other windows, as it gets hidden behind them) ->
Output -> Print A Message -> Print [MESSAGE] -> "(see tutorial)"
Add new script -> Variables -> Set Object Flag -> Set flag [OBJECT] [Bob] [FLAG NAME] alive
Bob -> Use/Give (Tab) -> Use other object on this -> action [HANDLE OBJECTS INDIVIDUALLY] -> Edit Script (box) ->
(if you need help with this, let me know), change it so it looks like this:
If Bob is not alive, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Set ( = true ) flag [OBJECT] [Bob] [FLAG NAME] alive ( = true )
else ->
-> print message -> "bob is already alive, silly!"
or, you can do the opposite too (use "dead", instead of "alive"):
If Bob is dead, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Unset ( = false ) flag [OBJECT] [Bob] [FLAG NAME] dead ( = false )
else ->
-> print message -> "bob is already alive, silly!"
USING FUNCTIONS
defibrillator -> Use/Give (Tab) -> Use (on its own) -> [] Display menu of objects this can be used on -> [X] Display menu of objects this can be used on -> menu caption -> (leave blank, or type something in, like "what do you want to use the defibrillator on?")
OR
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> add new script -> ( see below the: VVVVVVVV )
OR
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> add new script -> copy and paste ->
VVVVVVVVV
from the tutorial: "...The way to do this is to set up a function."
MY EXPLANATION OF WHAT WE'RE DOING FOR THIS PART OF THE TUTORIAL
What we're doing is to create a function with~having the script block:
so that for the:
Bob -> Use/Give (Tab) -> Use (other object) on this -> box -> defibrillator -> Script -> ( see between the ******* )
AND
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> Script -> ( see between the ******* )
************
Script:
Scripts -> Call Function -> Call function (the name that you gave the function that you made) with parameters: add (box) -> (leave this blank, don't add any parameters)
so that you only need to put this single script (call function) in for these (or more) script areas, instead of having this large script block for these (or more areas):
(you should NOT have this in these script areas)
************
HOW TO ACTUALLY DO WHAT THE TUTORIAL IS ASKING FOR
Bob -> Use/Give (Tab) -> Use (other object) on this -> box -> defibrillator (double click on this to bring up the "Edit Script" window, or you can click once on this to highlight it and then click on the "Edit "Script" button: Add ~ Edit Object ~ Edit Script ~ Delete) ->
in the script editor window:
click and hold shift, and then try to drag the mouse to highlight all the scripts, so you can then cut it (so you can then paste it into your soon-to-be-made: Function). be very careful here, as it's not fun to lose a large script block and have to redo it, lol. I'd practice first on some test script block, until you can do it correctly.
Object (left pane) -> top bar -> Add -> Function -> name: (tutorial says to use: revive bob)
revive bob
Function (Tab)
Name: revive bob
Return Type: [NONE] (leave this as: NONE, don't change it)
Parameters: Add (box): (leave this blank, don't add any parameters)
Script: Add new script -> (paste, see below)
and now:
Bob -> Use/Give (Tab) -> Use (other object) on this -> box -> defibrillator (double click on this to bring up the "Edit Script" window, or you can click once on this to highlight it and then click on the "Edit "Script" button: Add ~ Edit Object ~ Edit Script ~ Delete) ->
Script:
it should be empty, but now, add this script line:
Scripts -> Call Function -> Call function revive bob with parameters: add (box) -> (leave this blank, don't add any parameters)
and also do this now too:
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> add new script or Edit Script ->
(this either should be empty, or if it got the large script block, then delete it)
but now you want to do this as well:
Scripts -> Call Function -> Call function revive bob with parameters: add (box) -> (leave this blank, don't add any parameters)
you're now almost done, but we got one last thing to do, to put a "check" (an "If..." script) so that you can't use the defibrillator on dead bob, when you're not in the same room as him, lol (unless you got a magical defibrillator, hehe).
(this is the last paragraph right above: GIVING OBJECTS)
so, this is what you do:
Object (left pane) -> top bar -> Add -> Function -> revive bob
we just need to edit the script a bit, so it looks like this now:
If Player is in Lounge, then:
-> If Bob is not alive, then ->
->-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
->-> Set Object Flag -> Set ( = true ) flag [OBJECT] [Bob] [FLAG NAME] alive ( = true )
-> else ->
->-> print message -> "bob is already alive, silly!"
else ->
-> Print message ("What?! Did you think this was a magical defibrillator? you need to get near bob first, in order to use the defibrillator on him, silly!")
or, you can do the opposite too (use "dead", instead of "alive"):
If Player is in Lounge, then:
-> If Bob is dead, then ->
->-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
->-> Set Object Flag -> Unset ( = false ) flag [OBJECT] [Bob] [FLAG NAME] dead ( = false )
-> else ->
->-> print message -> "bob is already alive, silly!"
else ->
-> Print message ("What?! Did you think this was a magical defibrillator? you need to get near bob first, in order to use the defibrillator on him, silly!")
or...
If Player is not in Lounge, then:
-> Print message ("What?! Did you think this was a magical defibrillator? you need to get near bob first, in order to use the defibrillator on him, silly!")
Else ->
-> If Bob is dead, then ->
->-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
->-> Set Object Flag -> Unset ( = false ) flag [OBJECT] [Bob] [FLAG NAME] dead ( = false )
-> else ->
->-> print message -> "bob is already alive, silly!"
----------------------
A Partial Tutorial Guide:
The "GUI" (Graphical User Interface) or "Editor" is the screen or window that you can click on, and choose the objects and settings~options, with dropdown menus for you to choose from. Your own computer's~window's desktop is an example of a GUI~Editor (compared to using the MS Dos like command prompts). This is made for noobs, and thus a big appeal~mission of Alex' Quest, to make a text adventure game available for non-coders to use (while still as well also being even more powerful a text adventure game engine for coders to use too).
on the left side (the "left pane") is the "tree of stuff", a new game's tree would look like this:
Objects (everything is either an object or a script. A script is code that which does, conditions, and~or defines stuff)
-> Game (this is a unique object, the Game Object)
->-> Verbs ("Local" Verbs. Local means that the verb ONLY works on that specific object that you created it for. Verbs show up as buttons on the right pane, "Places and Objects", and as "hyperlinks = the blue text that you can click on for options" when you are playing the game)
->-> Commands ("Universal" Verbs. Universal means for commands that the command can be "attempted = depends on how the command is set up" on any object anywhere. Commands require that the game player actually type in the command itself)
-> Room (the default and initial Room Object. A "Room" type object)
->-> Player (the default Player Object. the Player Objects are another unique object. you can create many other Player Objects too, and be able to switch between them)
Functions ("passive" powerful action scripts. Passive means that quest doesn't automatically and nor constantly do the script)
Timers ("clock" scripts = used to create seconds, minutes, hours, and~or etc ... though very unpractical to go into days, weeks, months, years, lol)
Walkthrough (for game making and~or game testing)
Advanced
-> Included Libraries (a game file made as a "library" file, so that others can put it into their own game and use it's stuff, as their Included Libraries, notice the default two Included Libraries: Core.aslx = the game engine, and english.aslx = english language text~font)
->-> English.aslx
->-> Core.aslx
Templates (a useful "tool" for easy~"Universal" labeling things, making messages too ,and~or to change the labelings of things = such as for foreign language game makers, converting~translating an english game into their language)
Dynamic Templates (see Templates, basically it's the same in differences to a Template, as with the example of: Print a [MESSAGE] = just text = Template vs Print an [EXPRESSION] = script and~or text = Dynamic Template)
Object Types (think of this as creating an "object group", such as for example a "monster_type". I set all the attributes such as "dead=false", "hp", "mp", and etc, that I want for this Object Type, "monster_type", and then for each object that I create to be a "monster object", all I have to do is to add the "Inherited" attribute, "monster_type", and that object gets all of the attributes of that object type, and so it automatically gives that object, the attributes: "dead=false", "hp", "mp", and etc. I can do this again, for another object that I want to be a "monster object", by again just adding the "Inherited" attribute, "monster_type". so, this saves me the redundency of having to manually add these same attributes over and over again for every object that I make and want to be a "monster object". I think "room" objects, "object" objects, and "object and/or room" objects are all Object Types. You can see "Inherited" = Object Type = "Type" Attributes by: Player -> Attributes Tab. All the light greyed stuff, under "Inherited Types" and "Attributes ~ the bottom box" are attributes that are automatically given from the Inherited Type, "defaultplayer" or the other Inherited Type attributes too. So, yes, you can assign an Inherited Type upon~within another Inherited Type, you can have many layers~levels deep of Inherited Types and their Attributes for just a single Inherited Type)
Javascript (this is for coders to use alternative additional coding, Javascript, to do more cool stuff, lol)
and, the right side (right pane),
is additional details~options menu~window, for whatever you've clicked on (have highlighted) in the left pane (the "tree of stuff")
lastly, there's also the bar at the top:
File ~ Edit ~ Add ~ Tools ~ Help
The "Add" is also (just like the right pane) based upon what you got highlighted in the left pane (the tree of stuff).
Notable "Add" choices are:
Object (let's you add an "object" object)
Room (let's you add a "room" object)
Exit (let's you add~create "Exits" = connects two rooms together)
Turnscript (this is an "Active" action script. "Active" means that the game engine is constantly and automatically running~using it. Do note that you can create an "Universal" Turnscript or a specific Turnscript for a room, depending on whether you got "Object", or, for example, "Room", highlighted in the left pane ~ the "tree of stuff")
Generally about the right pane:
for an example, click on "Game" (left pane, the "tree of stuff") so that it is highlighted:
you'll now see further details about "Game" (remember that this is the unique object, Game Object), in the right pane, which looks like this:
game
6 Tabs: Setup (1) ~ Script (2) ~ Room Descriptions (3) ~ Player (4) ~ Display (5) ~ Attributes (6)
clicking on the different Tabs, changes what is displayed below the Tabs
some of the options are the exact same as in the top bar's "Add" choice (File ~ Edit ~ Add ~ Tools ~ Help), you can use either method (the way of reaching the desired option), the options are the exact same, they do the same thing.
so for an example, in my guide I'll give a "path" for you to follow to get to the right place, and then what you do there:
Path: Game -> Script (Tab) -> Start Script (such as for a character creation script block) -> Add new script ->
the character creation script block:
(continued from the path above) -> Output -> Print a message -> Print [EXPRESSION] "What is your name?"
Add new script -> Output -> Get input -> Get input, then run script ->
-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.alias = [EXPRESSION] result
-> Add new script -> Output -> Print a message -> Print [EXPRESSION] " - " + game.pov.alias
-> Add new script -> Output -> Show a menu ->
-> Show menu with [text] "What is your gender?"
-> Options from list/dictionary split ("male;female",";")
-> Allow player to cancel [yes/no ~ your choice]
-> After choosing, run script ->
->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.gender = [EXPRESSION] result
->-> Add new script -> Output -> Show a menu ->
->-> Show menu with [text] "What is your race?"
->-> Options from list/dictionary split ("human;dwarf;elf;orc",";")
->-> Allow player to cancel [yes/no ~ your choice]
->-> After choosing, run script ->
->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.race = [EXPRESSION] result
->->-> Add new script -> Output -> Show a menu ->
->->-> Show menu with [text] "What is your class?"
->->-> Options from list/dictionary split ("technomancer ~ your wizard;warrior;cleric;thief",";")
->->-> Allow player to cancel [yes/no ~ your choice]
->->-> After choosing, run script ->
->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.class = [EXPRESSION] result
->->->-> Add new script -> Output -> Print a message -> Print [EXPRESSION] game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class +"."
->->->-> Add new script -> Scripts -> Switch... ->
->->->-> Switch: game.pov.gender
->->->->-> Cases: Add -> Add (do again as needed) ->
->->->->->-> Case Expression: "male"
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.endurance = [EXPRESSION] game.pov.endurance + 1
->->->->->-> Case Expression: "female"
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.agility = [EXPRESSION] game.pov.agility + 1
->->->-> Switch: game.pov.race
->->->->-> Cases: Add -> Add (do again as needed) ->
->->->->->-> Case Expression: "human"
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.endurance = [EXPRESSION] game.pov.endurance + 1
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.agility = [EXPRESSION] game.pov.agility + 1
->->->->->-> Case Expression: "dwarf"
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.strength = [EXPRESSION] game.pov.strength + 1
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.endurance = [EXPRESSION] game.pov.endurance + 1
->->->-> Switch: game.pov.class
->->->->-> Cases: Add -> Add (do again as needed) ->
->->->->->-> Case Expression: "technomancer"
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.intelligence = [EXPRESSION] game.pov.intelligence + 2
->->->->->-> Case Expression: "cleric"
->->->->->-> Add new script -> Variables -> Set a variable or attribute -> Set variable game.pov.spirituality = [EXPRESSION] game.pov.spirituality + 2
->->->-> Add new script -> output -> Wait for key press -> Wait for key press, then run script ->
->->->->-> Output -> Clear the screen
so, as practice, do you understand this?
---------------------------
two extremely powerful, useful, and commonly~constantly used scripts:
Variables -> Set a variable or attribute
Scripts -> If... ( or Switch... )
two extremely powerful, useful, and commonly~constantly used attribute types:
boolean = "flagging" = true/false
integer = -OO , ... , -1, 0, +1, ... , +OO
example of a boolean ("flagging"):
a key is too high to reach, but if you could fly, you can get the key.
boolean: "flying" = false (because you are "walking") :: can't get the key
boolean: "flying = true :: can get the key
or (explanation shouldn't be needed, lol):
boolean: "running" = false :: game.pov.speed = 1
boolean: "running" = true :: game.pov.speed = 2
integers (creatively) can be used as booleans:
if (npc.dialogue = 0), then msg ("Hi")
if (npc.dialogue = 1), then msg ("Bye")
if (npc.dialogue = 2), then msg ("Die!")
if (npc.dialogue = -10), then msg ("I hate you!")
if (npc.dialogue = 10), then msg ("I love you!")
OR
switch (npc.dialogue)
-> case
->-> ("0")
->->-> msg ("Hi")
->-> ("1")
->->-> msg ("Bye")
->-> ("2")
->->-> msg ("Die!")
->-> ("-10")
->->-> msg ("I hate you!")
->-> ("10")
->->-> msg ("I love you!")
examples of these in use (but they're not in correct format, this is for concept~understanding only, intentional shown in a code-like fashion, so you start to get used to code, lol. As the GUI~Editor is not easy to do guides of~for, nor to fix problems, and etc, lol):
<object name="orc"><![CDATA[
<dead type="boolean">false</dead>
<hp type="integer">100</hp>
<verb name="attack">
Scripts: If (Scripts: Firsttime ("dead" boolean = true)) {
then: Set a variable or attribute: game.pov.experience = game.pov.experience + orc.experience
} otherwise {
Print Message: msg ("It's long dead already')
} else {
Set a variable or attribute: orc.hp = orc.hp - game.pov.physical_damage
Print Expression: msg ("You hit it for " + game.pov.physical_damage + " and now it only has " + orc.hp + " hp left.")
Scripts: If (Print Expression: msg (orc.hp <= 0)) {
then: Set a variable or attribute: orc.dead = true
}
}
</verb>
]]></object>
--------------------------------------------------------------------------------
Defibriliator section:
(you've no idea how many times I had to spell out defibrillator, when I was a noob trying to do the tutorial myself, I actually learned how to spell out defibrillator at the time, and I've proudly forgotten and never spelled that cursed word again, until now, lol)
here's the steps:
http://quest5.net/wiki/Interacting_with_objects
CREATING A CHARACTER
Room -> Objects (Tab) -> Add -> name: Bob
Bob -> Setup (Tab) -> (lower) Type -> [MALE CHARACTER]
Bob -> Setup (Tab) -> Description -> [TEXT] -> Bob is lying on the floor, a lot more still than usual.
PREFIX AND SUFFIX
Bob -> Setup (Tab) -> [X] Use default prefix and suffix -> [] Use default prefix and suffix
OR
Bob -> Setup (Tab) -> (lower) Type -> [ MALE CHARACTER (NAMED) ] (I don't have this option in v5.3, lol)
http://quest5.net/wiki/More_things_to_do_with_objects
GIVING AND USING OBJECTS
This just gives a general overview of what will be discussed in actual detail on how to do this stuff in the below sections
UPDATING THE DESCRIPTION
Bob -> Setup (Tab) -> Description -> [RUN SCRIPT] -> Add new script ->
Scripts -> If... -> If [OBJECT HAS FLAG] -> If [OBJECT HAS FLAG] [OBJECT] [Bob] [FLAG NAME] alive ->
-> then, Add a script -> Output -> Print A Message -> Print [MESSAGE] "(see tutorial)" ->
Add Else, Add new script ->
-> Print [MESSAGE] "(see tutorial)"
USING THE DEFIBRILLATOR
Object (left pane) -> top bar -> Add -> Room -> name: Lounge (or did the tutorial have you simply change your "Room" object's Name or Alias to "Lounge" ??? meh)
Lounge -> Object (Tab) -> Add -> name: defibrillator
defibrillator -> Setup (Tab) -> Description -> [TEXT] -> "(see tutorial)"
defibrillator -> Inventory (Tab) -> [] Object can be taken -> [X] Object can be taken
Bob -> Use/Give (Tab) -> Use other object on this -> action [HANDLE OBJECTS INDIVIDUALLY] -> Add (box) -> name: defibrillator (spell exactly correctly ~ the same as your "defibrillator" object) or just choose from the drop~pull down arrow, lol ->
Script Window (if you can't see this script window, then close, but don't exit~quit lol, all your other windows, as it gets hidden behind them) ->
Output -> Print A Message -> Print [MESSAGE] -> "(see tutorial)"
Add new script -> Variables -> Set Object Flag -> Set flag [OBJECT] [Bob] [FLAG NAME] alive
Bob -> Use/Give (Tab) -> Use other object on this -> action [HANDLE OBJECTS INDIVIDUALLY] -> Edit Script (box) ->
(if you need help with this, let me know), change it so it looks like this:
If Bob is not alive, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Set ( = true ) flag [OBJECT] [Bob] [FLAG NAME] alive ( = true )
else ->
-> print message -> "bob is already alive, silly!"
or, you can do the opposite too (use "dead", instead of "alive"):
If Bob is dead, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Unset ( = false ) flag [OBJECT] [Bob] [FLAG NAME] dead ( = false )
else ->
-> print message -> "bob is already alive, silly!"
USING FUNCTIONS
defibrillator -> Use/Give (Tab) -> Use (on its own) -> [] Display menu of objects this can be used on -> [X] Display menu of objects this can be used on -> menu caption -> (leave blank, or type something in, like "what do you want to use the defibrillator on?")
OR
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> add new script -> ( see below the: VVVVVVVV )
OR
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> add new script -> copy and paste ->
If Bob is not alive, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Set ( [b]= true[/b] ) flag [OBJECT] [Bob] [FLAG NAME] alive ( [b]= true[/b] )
else ->
-> print message -> "bob is already alive, silly!"
or, you can do the opposite too (use "dead", instead of "alive"):
If Bob is dead, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Unset ( [b]= false[/b] ) flag [OBJECT] [Bob] [FLAG NAME] dead ( [b]= false[/b] )
else ->
-> print message -> "bob is already alive, silly!"
VVVVVVVVV
from the tutorial: "...The way to do this is to set up a function."
MY EXPLANATION OF WHAT WE'RE DOING FOR THIS PART OF THE TUTORIAL
What we're doing is to create a function with~having the script block:
If Bob is not alive, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Set ( [b]= true[/b] ) flag [OBJECT] [Bob] [FLAG NAME] alive ( [b]= true[/b] )
else ->
-> print message -> "bob is already alive, silly!"
or, you can do the opposite too (use "dead", instead of "alive"):
If Bob is dead, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Unset ( [b]= false[/b] ) flag [OBJECT] [Bob] [FLAG NAME] dead ( [b]= false[/b] )
else ->
-> print message -> "bob is already alive, silly!"
so that for the:
Bob -> Use/Give (Tab) -> Use (other object) on this -> box -> defibrillator -> Script -> ( see between the ******* )
AND
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> Script -> ( see between the ******* )
************
Script:
Scripts -> Call Function -> Call function (the name that you gave the function that you made) with parameters: add (box) -> (leave this blank, don't add any parameters)
so that you only need to put this single script (call function) in for these (or more) script areas, instead of having this large script block for these (or more areas):
(you should NOT have this in these script areas)
If Bob is not alive, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Set ( [b]= true[/b] ) flag [OBJECT] [Bob] [FLAG NAME] alive ( [b]= true[/b] )
else ->
-> print message -> "bob is already alive, silly!"
or, you can do the opposite too (use "dead", instead of "alive"):
If Bob is dead, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Unset ( [b]= false[/b] ) flag [OBJECT] [Bob] [FLAG NAME] dead ( [b]= false[/b] )
else ->
-> print message -> "bob is already alive, silly!"
************
HOW TO ACTUALLY DO WHAT THE TUTORIAL IS ASKING FOR
Bob -> Use/Give (Tab) -> Use (other object) on this -> box -> defibrillator (double click on this to bring up the "Edit Script" window, or you can click once on this to highlight it and then click on the "Edit "Script" button: Add ~ Edit Object ~ Edit Script ~ Delete) ->
in the script editor window:
click and hold shift, and then try to drag the mouse to highlight all the scripts, so you can then cut it (so you can then paste it into your soon-to-be-made: Function). be very careful here, as it's not fun to lose a large script block and have to redo it, lol. I'd practice first on some test script block, until you can do it correctly.
Object (left pane) -> top bar -> Add -> Function -> name: (tutorial says to use: revive bob)
revive bob
Function (Tab)
Name: revive bob
Return Type: [NONE] (leave this as: NONE, don't change it)
Parameters: Add (box): (leave this blank, don't add any parameters)
Script: Add new script -> (paste, see below)
If Bob is not alive, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Set ( [b]= true[/b] ) flag [OBJECT] [Bob] [FLAG NAME] alive ( [b]= true[/b] )
else ->
-> print message -> "bob is already alive, silly!"
or, you can do the opposite too (use "dead", instead of "alive"):
If Bob is dead, then ->
-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
-> Set Object Flag -> Unset ( [b]= false[/b] ) flag [OBJECT] [Bob] [FLAG NAME] dead ( [b]= false[/b] )
else ->
-> print message -> "bob is already alive, silly!"
and now:
Bob -> Use/Give (Tab) -> Use (other object) on this -> box -> defibrillator (double click on this to bring up the "Edit Script" window, or you can click once on this to highlight it and then click on the "Edit "Script" button: Add ~ Edit Object ~ Edit Script ~ Delete) ->
Script:
it should be empty, but now, add this script line:
Scripts -> Call Function -> Call function revive bob with parameters: add (box) -> (leave this blank, don't add any parameters)
and also do this now too:
defibrillator -> Use/Give (Tab) -> Use (on its own) -> Action [RUN SCRIPT] -> add new script or Edit Script ->
(this either should be empty, or if it got the large script block, then delete it)
but now you want to do this as well:
Scripts -> Call Function -> Call function revive bob with parameters: add (box) -> (leave this blank, don't add any parameters)
you're now almost done, but we got one last thing to do, to put a "check" (an "If..." script) so that you can't use the defibrillator on dead bob, when you're not in the same room as him, lol (unless you got a magical defibrillator, hehe).
(this is the last paragraph right above: GIVING OBJECTS)
so, this is what you do:
Object (left pane) -> top bar -> Add -> Function -> revive bob
we just need to edit the script a bit, so it looks like this now:
If Player is in Lounge, then:
-> If Bob is not alive, then ->
->-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
->-> Set Object Flag -> Set ( = true ) flag [OBJECT] [Bob] [FLAG NAME] alive ( = true )
-> else ->
->-> print message -> "bob is already alive, silly!"
else ->
-> Print message ("What?! Did you think this was a magical defibrillator? you need to get near bob first, in order to use the defibrillator on him, silly!")
or, you can do the opposite too (use "dead", instead of "alive"):
If Player is in Lounge, then:
-> If Bob is dead, then ->
->-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
->-> Set Object Flag -> Unset ( = false ) flag [OBJECT] [Bob] [FLAG NAME] dead ( = false )
-> else ->
->-> print message -> "bob is already alive, silly!"
else ->
-> Print message ("What?! Did you think this was a magical defibrillator? you need to get near bob first, in order to use the defibrillator on him, silly!")
or...
If Player is not in Lounge, then:
-> Print message ("What?! Did you think this was a magical defibrillator? you need to get near bob first, in order to use the defibrillator on him, silly!")
Else ->
-> If Bob is dead, then ->
->-> print message -> "(miraculously...he comes back to life... or blah blah blah = see tutorial)"
->-> Set Object Flag -> Unset ( = false ) flag [OBJECT] [Bob] [FLAG NAME] dead ( = false )
-> else ->
->-> print message -> "bob is already alive, silly!"

Candacis
20 Apr 2013, 20:36Oh my god, Hegemon, wow, thank you so much
It is a lot of information to take in, I think I have to re-read this several times ^^
But I understand the revive Bob function now a little bit better and it makes more sense to insert the player in lounge command there. Thanks!
Now it works good and I made my way past the bee timer
Another question turned up. I made a picture frame for the kitchen (500x300), but in the game it only shows a thin line of the picture and not the whole picture. I suspect, it conflicts with the map, because as long as I turn the map off, it shows the picture properly. Is there a way to have both? Picture frame and map or do I have to choose? ^^

It is a lot of information to take in, I think I have to re-read this several times ^^
But I understand the revive Bob function now a little bit better and it makes more sense to insert the player in lounge command there. Thanks!
Now it works good and I made my way past the bee timer

Another question turned up. I made a picture frame for the kitchen (500x300), but in the game it only shows a thin line of the picture and not the whole picture. I suspect, it conflicts with the map, because as long as I turn the map off, it shows the picture properly. Is there a way to have both? Picture frame and map or do I have to choose? ^^