Ultimate Noob Coding


#109

Error: occupying_the_spaceship line 70: bad label {notes_info}


#110

Hm, how odd. Er, you’re using the latest version of CS (not that I can see why it’d make a difference with {} ), and Quicktest is definitely checking the latest version of your file?

Oh also, what should notes_info be set to in the *gosub on line 70?


#111

I’m not and I was just thinking the same thing! haha. This is about 2 years old. I should probably update, although I will test it first.


#112

Oh, two years…maybe, then. XD Especially if you’ve check the value of notes_info at line 70 and it’s a valid label name.


#113

Notes_info is created as "profiles1"
It can be set to one of 20 different labels (profiles1 - profiles10 or profiles1b - profiles20b)

I’ve checked and double checked the spellings - no errors I can see.


#114

It looks like the use of {} to replace *setref and *gotoref was added in March 2015, so maybe it is the CS version.


#115

I’ve tested my demo and it’s not treating {notes_info} correctly. I’ll update to the latest CS.

Thanks for all the help!


#116

Updating passes quicktest! Sadly it’s throwing up new errors (title too long - it exceeds 30 characters)

Well it had to be updated before publication anyway - More work to do.


#117

AAH!
What have I missed?!
:frowning_face:

Oh, oh :point_up:
And I call them "Loop"
I win :fist:


Yup. As a code-y type coder, I can confirm this.

Which can lead to code like this

this
*create text "dcba"
*if (text = "dcba")
*if (${text} = "dcba")

But not this: *if ({text} = "dcba")
*CMIIW


#118

So I’ve updated to the latest choicescript and it passes quicktest.

However, upon loading my game to test it, it says:

Script error.

I click okay and it loads.
Then when I select the first option to start playing it says

<div id=container1> is missing from index.html

Any ideas?


#119

Have you tried downloading the latest version of CS again, this time to a different location, and copying your scene files into it there, and then testing? It sort of sounds like something might be up with the copy of ChoiceScript (although I’m not sure).


#120

Probably it’s because you updated your CS but instead of moving your game scenes to the latest CS, you “pile up” the latest CS over the old CS, rewriting the files :thinking:

Unless I’m mistaken, ofc


#121

Nope, I’ve got it. I copied the scenes directory and all the images from the old mygame directory. The problem is, I also copied the old index.html file too :blush:


#122

Well, that was rather anti-climactic solution :expressionless:


#123

So, I’m messing around with a scene in my WIP and decided that one of the choices I’ve let people make earlier in the game should force a character to be in a certain scene later. So what is currently:

*choice
	*selectable_if (intheair = 1) #I was avoiding sniper fire and trying to fight back. 
		*if (sawreinforcements = 1) 
			*set dovehackedcomms 1
			*goto evasivemanuevers1
		*elseif (sawreinforcements = 0)
			*goto evasivemanuvers1
	*selectable_if ((snipersspotted = 1) AND (gunissniper = 1)) #I was giving Dove cover and taking out the enemy snipers.
		*if (sawreinforcements = 1)
			*set dovehackedcomms 1
			*goto droppingsnipers1
		*elseif (sawreinforcements = 0)
			
			*goto droppingsnipers1
	#I was firing at exposed guardsmen on the platform. 
		*goto droppingguardsmen1

Should be replaced with the first option going on its own and the others being separate paths. So, can I make an “if/elseif” where the elseif contains the choice and the if statement alone goes to evasivemanuevers?


#124

Two questions, if I may. First, what exactly do you mean by “going on its own” in this context, and what makes that different from just another “separate path”?

Second, why not replace *elseif (sawreinforcements = 0) with *else ? Currently, if the variable sawreinforcements holds any value other than 1 or 0, ChoiceScript won’t know what to do. What should it do if sawreinforcements is 2, or 3, or 0.35? Using *else will collect all the possible values for a variable that haven’t been named already, so ChoiceScript will always know what to do, no matter what value the variable holds.

Now, to answer what I think you’re asking, please correct me if I’ve guessed incorrectly, either:

  1. You want players who have both intheair = 1 and sawreinforcements = 1 to automatically advance to *label evasivemanuvers1 without seeing the *choice at all, or
  2. You want players who chose the first option to go to *label evasivemanuvers1 only if they have sawreinforcements = 1, while players who chose the first option with sawreinforcements = 0 should go to a different *label.

If my first guess is correct, you can stick something like *if (intheair = 1) and (sawreinforcements = 1) ahead of the *choice, so that players who meet both are automatically sent to the appropriate *label before ChoiceScript ever shows the *choice.

Something like so:
*if (intheair = 1) and (sawreinforcements = 1)
	*set dovehackedcomms 1
	*goto evasivemanuvers1

*choice
	*selectable_if (intheair = 1) #I was avoiding sniper fire and trying to fight back.
		*goto create_a_new_label_for_this
	*selectable_if ((sniperspotted = 1) and (gunissniper = 1)) #I was giving Dove cover and taking out the enemy snipers.
		*if (sawreinforcements = 1)
			*set dovehackedcomms 1
		*goto droppingsnipers1
	#I was firing at exposed guardsmen on the platform.
		*goto droppingguardsmen1

If my second guess is correct, just use different *goto commands after *if and the *else (or *elseif, as appropriate.)

Perhaps something like this:
*choice
	*selectable_if (intheair = 1) #I was avoiding sniper fire and trying to fight back.
		*if (sawreinforcements = 1)
			*set dovehackedcomms 1
			*goto evasivemanuvers1
		*else
			*goto create_a_new_label_for_this
	*selectable_if ((sniperspotted = 1) and (gunissniper = 1)) #I was giving Dove cover and taking out the enemy snipers.
		*if (sawreinforcements = 1)
			*set dovehackedcomms 1
		*goto droppingsnipers1
	#I was firing at exposed guardsmen on the platform.
		*goto droppingguardsmen1

You may note that in both my examples, I completely removed the *elseif statement under #I was giving Dove cover and taking out the enemy snipers. In your own example, both the *if and the *elseif used the same *goto, and you didn’t mention changing that. Since the only difference between the *if and the *elseif was the extra variable setting under the *if, I simplified that part of the code until it only set the relevant variable.

If you didn’t actually intend for both sides of the *if/*else to go to the same place, it would be simple to leave the *else in, and give it a different *goto than the *if received.

Again, I’m not entirely sure what you’re asking for help with, and I’m working on my best guesses. I hope this helped, and I apologize if it didn’t.


#125

My computer updated last night and restarted. I reopened my programs (including CSIDE) and it said I had a combo of tabs and spaces, which I didn’t as it would’ve been caught on the Quicktest the night before when I posted my update. Anyways, I’m trying to get my tabs reformed and it keeps complaining about this section.

*choice
	#Lisa
		*set AIName "Lisa"
		*goto FirstStalk
	#Jake
		*set AIName "Jake"
		*goto FirstStalk
	#Samantha
		*set AIName "Samantha"
		*goto FirstStalk
	#Michael
		*set AIName "Michael"
		*goto FirstStalk
	#Didn't you hear me? I said *I* would name ${AIhim}.
		*label input_AIName
		You're right. Go ahead. 
		*input_text AIName
		
		*comment check capitalization
		*if ("${AIName}" != "$!{AIName}")
			#Your AI's name is $!{AIName}, is that right?
				*choice
			(		#Yes.    *comment  Line 295 is here
						*set AIName "$!{AIName}"
						*goto FirstStalk
					#No, I named ${AIhim}, ${AIName}. The mission must be distracting me.
						*goto FirstStalk
					#No, my memory is a bit fuzzy.
						*goto input_AIName


Error: startup line 295: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.

I’m not seeing what is wrong, any ideas?


#126

On that option, you have a conditional check for ("${AIName}" != "$!{AIName}"), but not for its opposite.
As the result, if I input my AIName : “Bobo”, it will pass the check and will “fall out” of the *choice body


Besides, the option #Your AI's name blabla... is not nested on any *choice body (unless you intentionally wanted to show the hash symbol, ofc) :thinking:


#127

Well, your recommended fix was off. However, it was the hashtag giving me troubles. I don’t know how that got there. Thanks


#128

Yea, u’re welcome.
(20 obligatory chars)