0 votes
by (490 points)
edited by

Okay. This passage has had me banging my head off the wall for over 48 hours now, and I've been continuing to poke and play at it and try to get it to work (to no avail).

When I posted this originally, I thought it might be something in the (show:) macro I was using (and so was asking why my near-identical coding was causing errors when I was sure it wasn't supposed to be), but the macro works perfectly for the "Datapad" half and it does work for the ?Year1 hook when I'm testing it for Registration for Year 1.

But no matter what I do, the ?Register hook will not show up. And to give a bit of context: I have tried switching the order of the ?Year1 and ?Register in the (show:) macro, I've tried putting them in their own (show:) macros, I've adjusted what the ?Register hook covers, I've moved around my line break removers ( \ ), and much to my continued frustration, NOTHING IS WORKING.

 

I cannot get any further on this thing until I get past this section, and I have FOURTEEN (14) classes I have to use this coding for. (Which is a minor enough thing once the coding's working, as I just have to copy-paste all my pre-written stuff. But, keywords here are "once the coding's working".)

 

Here's the coding skeleton (I removed all descriptive stuff to make it smaller and slightly easier to read):

(if: $Datapad is "Class")[\
Basic course description.

This class is ''REQUIRED COURSEWORK'' for:
$CoX[Sect]
	(if: $Action is "Datapad")[
	|Continue>[Read more...]
	(click: ?Continue)[\
		(set: $Class to 1)\
		(show: ?Year1, ?Year2)]
\	]
|Year1)[Part 1]|Part_1)[ - Year 1/Class 1 summary.]
|Year2)[Part 2]|Part_2)[ - Year 2/Class 2 summary.]
(click: ?Year1)[\
	(show: ?Part_1)]\
(click: ?Year2)[\
	(show: ?Part_2)]
(if: $Action is "Register")[
	|Clear>[\
		(if: $Year is 1)[
			(if: any of (a: ...$Registered) is "Class 1")[
				You are already registered for this class.]
			(else:)[
				(show: ?Year1, ?Register)]
		]
		(if: $Year is 2)[
			(if: any of (a: ...$Registered) is "Class 2")[
				You are already registered for this class.]
			(else:)[
				(show: ?Year2, ?Register)]
		]
	]
]\
|Register)[\
	Do you want to register for this class?
	$AlCe[''|Yes>[YES] / |No>[NO]'']
]
(click: ?Yes)[
	(if: $Year is 1)[
		(set: $Registered to it + "Class 1")
		(replace: ?Register)[
			You are now registered for Class 1.]
	]
	(if: $Year is 2)[
		(if: $Class1_Credit > 0)[
			(set: $Registered to it + "Class 2")
			(replace: ?Register)[
				You are now registered for Class 2.]
		]
		(else:)[
			(set: $Registered to it + "Class 1")
			(replace: ?Register)[
				You are now registered for Class 1.]
		]
	]
]
]

Maybe I'm just missing something stupid (gods, I hope not, I've been doing this sort of stuff for over a year now), but I'd really appreciate another set of eyes on this.

Am I just missing something or is this something in the Twine program that's glitching?

 

Edit from 3.5 days after posting the initial question:

I still can't figure it out, and I'd really rather not have to add another two or three passages to make up for the ONE HOOK that just will not show up for reasons I cannot for the life of me ascertain. Can someone at least try and see if it works for them? I can't see any reason why it wouldn't work.

1 Answer

+1 vote
by (660 points)
selected by
 
Best answer

It's because you're calling the hook before the code has gotten to the hook:

(show: ?Year1, ?Register)

will show Year1 as it is before this command but not Register because at the time the code is called the hook doesn't exist, so it ignores it.

Further up you have:

(show: ?Year1, ?Year2)

before the Year1 and Year2 hooks, however it does work because it's in a Click command, which will run after the hooks exist.

by (490 points)

Thank you for your assistance (and my apologies for not selecting it earlier).

While it didn't really help me solve the problem (as I finally worked out the solution myself the day before you answered), at least now I know why it started working after doing some more passage rearranging.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...