Simple question - No programming background

omgrun
Hi... as you can see from the title, I have no programming background and I'm trying to do something very simple. Most of the threads I've read are confusing and are too advanced for me to understand, I really need help.

I have a simple chose your own adventure game.

I have "starting point" with option 1, option 2, and option 3.
Once the player has exhausted option 3, I want to be able to link back to "starting point" with "option 3" now removed. Is this possible?
If so, what's the easiest way to implement it?

Please explain these concepts to me like I'm five years old. When I mean I have no programming background, I mean I know literally nothing.
I need to have this project done in four days, so it's sort of time sensitive.

I'd appreciate any help you can offer me!

TinFoilMkIV
While maybe not the most efficient method, one of the more basic ways to pull this off is to use basic 'if' checks for text display. The text processor for quest allows you to put this directly into your text itself without having to run any extra scripts controlling it.
format for in text 'if' check

{if object.attribute:text}
Display text only if object attribute is true

\
you insert the whole expression with the braces directly into your text display. So it will look something like
msg ("Option 1 text here, Option 2 text here{if object.attribute:, Option3 text here} ")


Now you will need to work outside the basic text display and such to make this function the way you want, but not a whole lot. What you will need is an attribute stored in the location of your choice that will be used to control what text you will see at any given time. I personally recommend creating a control object outside the normal game area to hold such things, as it generally helps to keep things organized and isn't likely to get modified by something unrelated on accident.

What the actual {if object.attribute:text} does is this. When Quest is printing out your text and runs into this line, it goes and looks at the 'object.attribute' part first, and will then try to locate the said 'attribute' within the named 'object'. If the names are incorrect or simply doesn't match anything in your game, you'll get an error, so spelling and such is important here. Now when this does match an object and attribute, it will then see if your attribute equates to either "true" or "false", so the easiest way to manage this is to make sure the attribute in question is a boolean attribute, which literally means it equals either "true" or "false" as it's only possible values, basically like a light switch, it's either set to "on" or "off" at any given time.

So now assuming your attribute is set correctly and no typos involved, the whole {if object.attribute:text} will do one of two things. If your attribute was set to "false", then it will not display the 'text', however when it's true it will display the 'text' section as if it was normally part of your normal text string. So you can setup a situation where text only shows up under certain circumstances. You will of course at some point need to modify the attribute to turn it either on or off as you need.

So in your case you have text that is normally there but will disappear at some point. So your control attribute will start out as "true". So the first time through, your option 3 will be seen by the player. Now when they reach whatever your endpoint for option 3 is, you will need to have to do a bit of scripting, tho nothing terribly complicated. So before you send the player back to "starting point" you will need something like this
object.attribute = false
Replacing Object, and Attribute with the name of the object and attribute you are using, this will then "turn off" your option 3, so that when they go back to "starting point" it will no longer be there.

There are other ways to pull this off, and most are pretty similar in concept tho this should be the least coding intensive method.

Text Processor commands for reference
http://docs.textadventures.co.uk/quest/ ... essor.html

omgrun
So I should use an "if" script?

This is what I currently have: https://i.gyazo.com/8a18474ae6c760c21334a89550f5f727.png

If player has seen (page for option 1), remove page link from (start screen) to (??)
I don't understand the rest. What purpose does the "to" have?
What if I just want to remove it, and not move it "to" anywhere?

TinFoilMkIV
For reference, look at the 'add page link' script. It creates a link from one page, to a second page. The 'remove page link' function works the same but in reverse, you have to tell it what page it's going from and what page the link goes to, so that it can remove the correct link, and not just any random link on the from page.

EDIT: feel free to skip down to the big lined off edit section as I wrote this first part from more of a building everything via page scripts and not the normal game book format due to my own lack of familiarity with it.


You have the right idea however you're doing more in the scripting rather than running off the text processor, which really is a matter of preference and what is easier for you to read.

I'll see if I can give you a good example of both methods. So first thing first, a useful trick if you want to understand more of the coding behind the gui scripts, as well as should help you understand what you're looking at when people post code, and to more easily copy some code into your game. So in your screenshot, down where you actually have your scripts and such, the tab to the left says "Script:". Now if you look to the right of that you have a bunch of buttons. The one that I want to point out here is the "code view", its to the right of the clipboard and looks like a single page with text on it. What this does is switches the gui view of your scripts for the actual text based code, and clicking it again will switch back (if the code is typed correctly, errors in the code will cause it to go red instead of converting back to the gui mode).

For example, the code view of what you have there in that image comes out to this (minus page names)
if (HasSeenPage(Page1)) {
RemovePageLink (Page1, )
}

and again clicking the code view button to turn it off should go back to exactly what you saw before.

Now game books tend to be more limited and the type of scripting you can actively use to manipulate them, which is why I was recommending using the build in text functions. What you have there will certainly work, as it will take the link out of the page. What I was saying would be to have the text itself look to see what it should be showing instead of actually moving the links around. ie:
msg ("blah blah blah, page 1 and whatnot stuff is happening, what will you do?")
msg ("") //this is a blank line
msg ("[option1] [option2] {if object.attribute:[option3]}")


They accomplish basically the same thing, an option 3 that is not always there, the method depends on personal preference and organization.


Also an alternative that may be a bit more messy but actually simpler, would be to duplicate the start page onto page 2, so you have "start page" and "start page 2" or whatever you want to call them, and simply have "start page 2" not have option 3. This would basically be the method you would have to apply to a physical game book since you can't really re-write a physical book. Although I personally think that method would likely get messy very quickly if it's a situation that comes up more than a very few times.

=============================================================================================

EDIT: okay so part of this is my severe lack of familiarity with the game book option, as I'm the kind of guy that would just make a fake gamebook in text adventure mode if I was going to make one so I honestly haven't looked at them much, so sorry for any added confusion caused by this. Turns out I was thinking this was a bit more in depth than it is with build in features.

So, What you'll want is for a page where something important happens to have the page type set from "text" to "script + text". What this will do is allow you to have some code run when the player sees this page. In this case the main thing we want is to set some flags to say what text will and will not show up.

For your starting page, we will need a two part script, first we need to go down to scripts, and select "first time", this way we only turn the flag on once, otherwise it will just turn back on every time we come to this page. Then we need to set a flag to on, so under the add scripts, variables, set flag on. Leave the drop down at its default of 'flag name', and enter a name of your choice for the flag, so in this case I'm calling it "ShowOption3". The other option is to have a page before the "start page" that turns the flag on, then returning to "start page" will not turn it back on every time. Now in the Description section of the page you have some buttons on the right side for doing special text functions which are going to help with the next part.

So since we want the page options to be under our control without going through a bunch of different scripts, I would remove all of the page links at the bottom, instead we are going to use the 'Page' button on the right hand side to make our own links within the text.

So when you click the 'Page' button, it will ask you for the text for the link, and what page it will go to. This works the same as an actual page link, however its built right into the description of the page. You can even turn words anywhere in the description into such links. Anyways the important thing here is that we can now control our links without having to setup a bunch of functions and such. This is where the {if} for the text processor comes in. I'm going to use {if ShowOption3:{page:Page4:Choose options 3}}, instead of just a normal page link, so that this specific page link will only be seen when I want it to. The reason we don't just leave the other links as normal is that they will be below the description so we end up with option 1 and 2 being below 3, plus you can do more fancy stuff like building the links into the actual description and such.

Anyways, to make 'option3' dissappear we have the page it leads to set to 'script + text', and simply run the script 'set flag off' for the flag "ShowOption3" now when we return to the starting page, option 3 is now turned off.

omgrun
I really appreciate you trying to work this out with me. I promise I'm not intentionally trying to be dumb or difficult. But explaining things like this requires a lot of basic knowledge that I don't have. I don't know what an attribute is or what it does. I don't understand what things like a "control object" even are or what it means to be "outside the normal game area"
I don't understand code at all and half of what you're saying is complete greek to me I'm gonna try to explain what I currently have, what I currently understand, and what I can do to make the game do what I want. It doesnt need to be fancy, and I'd prefer to be able to work within the stuff I already have instead of re-working it to do something else.

I'm not trying to add an option that the player hasn't seen before, only remove options that they have already been attempted.
I've been using the main interface and not the script view to construct my game, so it looks like this.

 <object name="Start screen">
<description><![CDATA[You're a senior in art school.<br/><br/>-description of your sort of lackluster history in art school<br/>-You're so close to graduation now, all you have to do is finish one more project!<br/>-description of room<br/>-Your brain is blank, and you're experiencing quite a bit of art block.<br/>-So, what will you do?]]></description>
<options type="stringdictionary">
<item>
<key>Idea start</key>
<value>Try to come up with an idea.</value>
</item>
<item>
<key>Friend start</key>
<value>Call your friend to hang out.</value>
</item>
<item>
<key>Video games start</key>
<value>Slack off and play video games.</value>
</item>
<item>
<key>Go for a walk start</key>
<value>Go for a walk.</value>
</item>


I don't have any tags that say "msg" and I don't understand how I would make them print "msg" instead of giving options in the string dictionary, which is what it seems to be doing?

What I'm gathering is that I should make an object attribute (??) for when the page has been seen and use it to control which options are available.

So would I add a function... right? Or type it onto each page individually? I might label it "ifseen" and either set to true (yes, the player has seen it) or false (no, the player has not seen it) but HOW exactly I would do that is kind of lost on me.

Is it possible to hide "item: video games start" after the player has already seen the "video games" option?

Use small words. Dang. This is killing me... it should not be so hard, but I'm so confused.

omgrun
Okay, I read your edit and this is starting to make sense to me! I'm changing the stuff I've already made now. I think I can figure this out now, But I'll come back if I run into any errors I can't figure out.


Thanks so much for your help, you're a lifesaver!

TinFoilMkIV
yea sorry about the added confusion, I'm used to working 99% in scripts and barely even looked at how the game books are actually formatted in the editor before now. all the msg("asfdsafs") stuff is how you show text in a script so I kinda default to that when thinking in text.

Good to hear you're making some progress now.

EDIT: Just to hopefully clear up some confusion and maybe help down the road I'll try to clarify a bit.

Don't worry too much about the attributes stuff, seems they're almost exclusively for text adventure mode so it makes sense that you had no idea what I was talking about. Basically tho an attribute is some sort of value that belongs to a specific object, and example is that a flag is actually a type of attribute that belongs to the game object itself, so it applies everywhere. But yea apparently the Game Book mode doesn't use any attributes outside game flags, so no need to really worry about it.

The idea of a "control object" is something that exists solely to hold information or activate code on other objects. So something that the player will never directly interact with but helps to keep the game moving. Generally they're not actually necessary but they help a lot with organization and avoiding mishaps with objects that see a lot of action.

And "normal game area" is kinda subjective, I use the term to mean "area a player can encounter or interact with", so something outside of this is basically like an unreachable room where you keep things you want to mess with as the game developer but aren't supposed to be part of the actual game experience. Or in terms of a game book a page 9999 that has no links that you keep notes on or test scripts on and that the player will never see in the actual game.

omgrun
I managed to figure out the flagging, and even a few things on my own. A lot of this stuff is still way too advanced, but I feel like I've reached the "stick figure drawing" level of skill required.
Now the problem I'm having is that the game is over 20 MB, and won't upload on this site.

I have no idea how it could be so big. It's 38 unique pages, Some choices go away after they've been flagged, but there's no fancy code or anything like that.
I don't know how to transfer it to another filetype or anything else... dang it.

TinFoilMkIV
Hmm, do you have any images or sound files in your game? Those are the only things I can think of that would increase the size by that much without an incredibly huge game.

XanMag
I'm guessing you have MP3 files on there. Converting them to .wav will save a ton of space. X2 is far bigger than that even... Not sure how I'm going to widdle it down... I use media.io as my converter. Very simple.

Also, check the folder you have your .aslx file in. Is there a chance other files got saved in there? On upload, Quest takes the entire folder, not just the .aslx file.

omgrun
I don't even have pictures. No music, no anything. The game is all text.

.... I moved the folder. it's 18 KB now. HAHA. what? I think It was saving my entire folder full of crap along with it.

TinFoilMkIV
Yea it had to have been picking up a bunch of other files you didn't want with it to get that kind of size. Quest games without any extra sounds/music/images/whatever are quite small.

omgrun
More painfully basic questions incoming. I'm pretty much finished with my game and I'm trying to do one last thing... I want the html body area to be black to match my actual game. (right now only my gameborder background is black)

I can use the "web tools" view to modify it and get what I want, but it never makes a lasting change and I can't figure out how to edit the actual css stylesheets.

I've been poring over the "modifying the UI" section and I'm trying to use a Jquery command to edit the html body background to be black, but either my syntax is wrong or I'm not understanding the right way to do it.

plz help :'(

You guys have been super awesome so far. I really would not have made it this far without help.

XanMag
I'm not sure if this thread is helpful or not but I read your recent query and remembered this was posted not too long ago. Hope it is useful.

viewtopic.php?f=18&t=5283

omgrun
I was trying to use that thread.
My problem is all of those things refer to changing stuff within the game border. I'm just trying to get the area outside the gameborder, the body color, or the margin color to go black.
if there's a way to edit the "playercore.css" sheet and get it to stick, that would be valuable.
I've seen other games do it, I just can't figure it out.
Something so simple should not be this hard, but I have 0 coding experience so having nothing work and having no idea why it doesn't work is like continually tumbling down an escalator.

Here is a link to the game, for reference. http://play.textadventures.co.uk/Play.aspx?id=xdsujcqx3kwc9pv3x6vmpw


Edit: I jury-rigged it by increasing the game size and the padding.
Sloppy solution, but it's better than a white background.

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

Support

Forums