*gosub_scene issues with locating file

Evenening ladies and gentleman.

It is currently 8 past midnight and I have been spending the past 2 hours working on the combat system for a project of mine.

Now I encountered a issue that causes me a aneurysm.
I created a combat file so I didnt have to copy paste the exact same code over and over again for my turn based combat system, but *gosub_scene doesent seem to reconise the file for god knows what reason.

Since I originaly planned to go to bed a hour ago I decided to just ask for help and go to sleep now before going insane.

If anyone could point out any possible issues it would be much appreciated.

startup.txt:

*scene_list
  combat

gosub_scene requires you to define not only the file name, but also the label name

example: gosub_scene combat attack

this will redirect you to the label attack within the file combat

to be redirected to a file without mentioning any label, use goto_scene instead of gosub_scene, but this will redirect you to the top of the file, it will read entire file instead of certain parts that you have labeled

example: goto_scene combat

cheers mate :victory_hand:

EDITED: another problem that you may encounter, is that you named the file with unintentional spaces, you may named the file "combat " [with a space at the end] instead of “combat”

You wont believe it but the name of the file was the actual issue.

Despite all letters appearing as lower case in the programm the actual file is labeled with a capital C…

The entire thing broke down cause of a Capital letter.

I of course didnt realise because every other scene I ever created is in lower case so I have no idea how I managed to do that but it now works perfectly fine again.

Thanks for the hint mate!

Already included it in the *scene_list in start up.
Could the placement be a issue?
Im assuming the programm loads scenes in the same order as they are in the scene list so I put it in the very bottom as it is a reocuring feature and not a actual chapter.
startup
humble_beginnings
Chapter_I
Chapter_II
Combat

I don’t think you actually need to include that file on your scene list at all. The website isn’t super clear on this, but as far as I can tell from my own writing, the scene list only tells the game what scene to go to next when progressing as standard from one scene to the next using *finish. Therefore the order only matters if you intend to put a *finish command at the end of Chapter II and then progress onto Combat, which I doubt you do!

Scenes that are accessed manually (i.e. via *gosub_scene, *redirect_scene, or *goto_scene) and which don’t otherwise appear in the standard order (e.g. functions, databases, glossaries) don’t need to be there. Not including them doesn’t stop you from accessing them from elsewhere.

If you use *gosub_scene, that scene actually does need to be in the scene list for quicktest to access it.

Didn’t exporting as html also require all files that need to be included to be listed in the scene list, or do I remember that wrong?

Hey, so I just tested this and it doesent have to be in the scene list funnily enough.

It still works during testing so scriobhaim was correct about this it seems.
It has no problems with accesing the scene even after compiling the game

SOOOOO im not sure if I should make a new topic since this is still relevant to the current one… the *return function after combat is over dosent work.
It states that “invalid return; gosub has not yet been called”

The idea is that after initiating the fight, the game moves you to the combat scene.
After the HP of either participant has been reduced to 0 the game is supposed to return to the previous scene and than move on to the next label to show the aftermath of the fight.

Im not sure If I understood something in the function wrong but I shall post my current code from what takes you to the combat screen and whats suppsoed to hapen after.

Humble beginnings:

*label fight_tom
You approach Tomte who nods towards you.

"You ready to get your ass kicked?" You tease Tomte playfully.

Tomte just smiles in response "I was planning to go easy on you but now I might reconsider."

The 2 of you head to the captain and he soon gives you the go.

Tomte seems to have a rather defensive stands, hiding behind his round shield.
*fake_choice
	*selectable_if (Long_Spear ="true") #Use the length of my spear to poke at his defense.
		
		You use your weapons length to your advantage and probe at his defense while remaining at a save distance.
		
		Tomte is meanwhile forced to constantly change his stands to block your little attacks. Yet it doesent seem like hes gone budge. Some of the other man watching begin to yawn at the show.
		
		*fake_choice
			#Continue to poke at him and try to find a opening
				You remain patient and try to find the right opening. Yet Tomte seems to be just as patient as you and never makes a rushed decision. The standoff lasts a while. You will have to make a opening move eventually.
				*gosub_scene combat
				*goto Tom_aftermath

			#Lunge forward and try to catch him off guard 
				You put all your weight into the attack and thrust towards Tomte. To your surprise tho he uses his shield to deflect the blow, causing you to stumble forward while he quickly closes the gap between you.
				*fake_choice
					#Try to counter and hit him with the hit him with the shaft
						*if (Strength >=1) and (Dexterity >=2)
							Using a mixture of strength and speed you hit tom in his side with the spears shaft, knocking the wind out of him for just a moment long enough to regain your footing. The fight goes on
							*set opponent_HP -5
							*goto_scene combat
							*goto Tom_aftermath
									
						*if (Strength <1) and (Dexterity <2)
							You try to move fast enough but the weight of the spear and its length slow you down. Tomte had closed the gap, striking you with his wooden sword. He has managed to land the first hit.  But that doesent mean he has won just yet.
							*set HP - 5
							*gosub_scene combat
							*goto Tom_aftermath

					#Try to get away from him
						*if Dexterity >=2
							You regain some distance and manage to keep Tomte at bay. Ready to continue the fight.
							*gosub_scene combat
							*goto Tom_aftermath

						*if Dexterity <2
							You stumble backwards, but despite your best efforts, Tomte closes the gap and raises his sword above you, landing a strike on you. You scramble back to your feet to continue the fight, even tho you are slightly bruised already.
							*set HP - 5
							*gosub_scene combat
							*goto Tom_aftermath

						
*label Tom_aftermath
*if opponent_HP >1
	*set fight_Tomte  "Won"
	You watch Tomte stumble back, visibly tired out from your back and forth.

	He eyes you carefully. He is getting tired and seems to realize that he cant keep up his defenses forever against you.

	You watch as his eyes dart back and forth as he desperately tries to find some form of opening in your stance and go for a offensive strike.

	He suddenly charges towards you, but it become very clear that offense isnt his strength at all.

	Before Tomte can even blink you trip him up and he hits the ground hard, his shield rolling away from him, leaving him without anything to hide behind. 

	You put the tip of your weapon against his back to prevent him from getting up, however he doesnt seem to even try.

	The sound of slow clapping draws your eyes to the guards-captain "congratulations  ${surname}, you won your first official duel. Tho you opponent only knowing how to cover in fear behind his shield definitely made things easier for you." 

	Some of the other recruits observing begin to giggle and snicker among themselves. 

	Tomte has meanwhile rolled over on his back to face upwards, tho he still remains on the ground.

COMBAT:

*label start
*if wounded = "False"
	*set HP * (1 * max_HP)
*if wounded = "Wounded"
	*set max_HP /2
*label your_turn
*if opponent_HP <1
	*set fight "won"
	*return
*if HP <1
	*set fight "lost"
	*return

${opponent}
*line_break
${opponent_HP} / ${opponent_maxHP}
	
	
	


${name}
*line_break
${HP} /${max_HP}
	
*choice
	#Defensive
		*rand damage 1 3
		*set damage + Strength
		*set opponent_hp - damage
		*rand block 5 8
		*set block + Dexterity
		You Strike ${opponent} dealing  ${damage} points worth of damage
		*goto opponents_turn


	#Neutral
		*rand damage 3 6 
		*set damage + Strength
		*set opponent_hp - damage
		*rand block 3 6
		*set block + Dexterity
		You Strike ${opponent} dealing  ${damage} points worth of damage
		*goto opponents_turn

		
	#Offensive
		*rand damage 5 8
		*set damage + Strength
		*set opponent_hp - damage
		*rand block 1 3
		*set block + Dexterity
		You Strike ${opponent}  dealing  ${damage} points worth of damage
		*goto opponents_turn

*label opponents_turn
*rand damage 1 8
*set damage + opponent_Strength
*set damage - block
*if damage < 0
	*set damage 0
*set HP - damage
${opponent} strikes you, dealing ${damage} points worth of damage
*goto your_turn
	

You need to also include a label when you use *gosub_scene. It should be “*gosub_scene combat start”

Also, with the option to try to counter in the inner fake_choice, it is possible for neither of the if statements to go off, and thus the gosub_scene will never happen. If Strength < 1 and Dexterity >= 2, or if Strength >= 1 and Dexterity is < 2, neither of those things will happen. You can fix this by changing that second “and” to an “or,” or you could simply not have a second if and proceed with its contents.

So I always need a label before a *gosub comment for the return function to actually work is what your saying?
Would it work in my case to have the same label multiply times after each choice or do I have to go through the effort to make it “combat_start_01, combat_start_02” etc. ?

Because I want some narrative opening moves for combat to give people the possibility to gain a advantag/disadvantage based on how effectivly they uitilze theirs skills or exploit opponent weakpoints.

So some major fight can be slightly more cinematic than minor once and just consist of “the numbers game”

Oh and thanks for pointing out my mistake.
Should have realised myself that “OR” would be the correct option here.

Will make sure to pay closer attention to that.

You’re welcome. You don’t need a label at the point where you return, just one in the scene where you’re calling the gosub. In this case, you already have one (“start”). You just need to reference it in the gosub_scene command.

Ok I just retried.
*gosub_scene combat start.

While it takes me to the combat scene like before. It still crashes after defeating my opponent stating “invalid return, gosub has not yet been called”

At this rate im slowly considering to just copy paste the combat system into the chapters and connecting everything with labels.
Even tho this will very likely bloat up the code and make it harder to read the code and tweak it in later stages.

Is this an error you get while playing or a quicktest error?

Quicktest:

Top of scene:

*gosub start
*bug fuck off quicktest
*label start

Otherwise:

You’re getting to the scene without a gosub being called. Retrace your steps and figure out how.

It may literally be that you used goto_scene instead by accident.

My god yes, because somone suggested to test *goto I used it at one of the options for testing and forgot to change it back after.

Now it works exactly as its supposed to!

The first combat scenario is complete!

Now just to add more flavour text based on the weapon the player chooses and some alternatives.

Thank you Will!