Here’s the error message I’m getting: “It is illegal to fall out of a *choice statement, you must *goto or *finish before the end of the indented block.”
However, all of the choices have *goto lines at the end of them. Identical versions of the code without the *selectable_if lines don’t give me the error, so somehow it must be causing the code to “fall out” without getting to the *goto. I just can’t figure out why. Does anyone have an example of code they’ve used to make a choice selectable when a variable is greater than a certain value?
That probably wouldn’t help you as the forum doesn’t indent code properly beyond the first indent!
However, one possibility occurs–if all the choices are conditional (and may therefore fail, theoretically) then it probably needs an ‘else’ to those, i.e. a non-conditional final choice, otherwise it is actually “falling out of a *choice statement without a goto…” As I always have at least one non-conditional option this is just a wild guess, but it might explain why it works properly when you remove the conditions.
Nope, I always make certain to have at least one non-conditional choice available. It must be something to do with the indents. Just to make certain, *selectable_if should be indented to the same degree as the # in the non-conditional choices, yes? So, for example, if my code reads
*choice
#option one
*selectable_if (money > 99) #option two
And #option and *selectable_if are both given a single indent, that should read correctly, right?
Yep, same level of indent for those two is correct. Assuming everything else under each of those is also indented correctly, I can’t honestly see where the problem is.
Alright, I still have no idea what the issue was, but retyping the lines from scratch seems to have fixed it. Must’ve been some stray indent or something. I’ll keep working, I’m still hopeful about getting this up tonight, though it may have to wait until tomorrow if I hit more snags.
The # indent and the *selectable_if indents should be the same.
I don’t think that’s the problem. Check the exact line number referred to in IE.
Edit: well I was too slow there, wasn’t I!
Thank you all for the assistance. It’s really nice to have a community willing to help out when problems like this crop up.
Debugging is taking more time than I expected. I’m hoping you folks can help me with another one that is giving me some trouble. I have a choice I want to only make available if the player has enough money to buy an item and also enough space on their wagon to contain it. So, I have the line as follows, where the ‘Weight’ variable represents space on the wagon.
*selectable_if (Money > 59) and (Weight > 299) #Choice
That’s giving me an error message for that line specifically, which reads “Invalid expression at char 11, expected no more tokens, found: CLOSE_PARENTHESIS”
What’s the problem here? Is this not the correct way to make a choice’s selectability dependent on two variables?
Still working on this and a couple other persistent bugs. I want to get these resolved before putting up the demo, so at this point it’s looking like it’ll have to get posted tomorrow. Thank you all for your patience, and if anyone has an idea how to make that line work I would really appreciate it.
With *selectable_if, you need parentheses around each pair of equations, so the line should read like:
*selectable_if ((money > 59) and (weight > 299)) #Choice
Parentheses are needed to ‘hold together’ each equation, and each pair of equations for it to work sometimes.
That fixed it. In retrospect, that should have been obvious. Thanks for the help!
Almost ready with something I can put up as a demo, even though I have a lot more I want to add in the coming days and weeks. However, I have two lingering issues I could use some help with, both of which probably have embarassingly simple solutions that I’m not seeing.
First off, how exactly do I change the game title that displays “My First ChoiceScript Game” on every page? I’m assuming this is buried somewhere in one of the JScript files, but I haven’t been able to locate it.
The second question is for folks who’ve had luck putting this up on webs.com pages. Now that I’ve been on for a week, I have the ability to add raw HTML. I’m assuming there’s a way to just upload my whole ‘web’ folder to get the game up, but I’m not clear on how to do that in a way the site will accept. Could someone who has done that before give me a quick explanation of the process?
Once again, a big thank you to all the helpful people on this forum.
To change the name, look in the index.html file (the one that is in the ‘mygame’ folder) Just Ctrl+F and search for what the standard title is (I can’t remember it right now.) You’ll want to change it in two places. The first is called something like ‘My first ChoiceScript Game | Something else I can’t remember’ while the second is something like ‘My first ChoiceScript Game’ (they should be within a few lines of each other IIRC). The first (the one with the | in the name) will control what the web browser calls the page (like the web browser calls this page “Demo Hosting - Choice of Games”), while the second controls the title that is actually displayed on the page itself. (Hope that made sense, writing it kinda fast here.)
To upload to webs.com, find the ‘web’ folder (the one with all the JavaScript files). Upload everything in that folder besides .htaccess (webs should bar you even if you try anyways IIRC) then create folders for icons and mygame using the ‘create folder’ button in the file manager for webs.com (You can actually rename the mygame folder, just remember to alter where it says ‘mygame’ in the index file you just uploaded to the new folder name, remember no spaces) (You can also rename that index file to anything you want without problem). Then upload the various things in the mygame and icons folder using the file manager. There’s no trick to remember, or anything that needs to be done to the files before uploading.
I think that’s everything (again, sorry if it’s kinda unintelligible).
Thank you very much, Reaperoa!
I’ve got everything up and running now. I’m going to make a new thread for the game, but here’s a link for those who’d like one in this thread:
http://goingwest1.webs.com/web/West/index.html