Beginner Python Extension Issue - Building an Interactive Story template

Hi
I am new to coding python / interactivity in general and am trying to build the logic and a super basic template for an interactive story / choose-your-own-adventure style project but i keep running into issues with my extension. Any help would be greatly appreciated.
thanks : )

Interactive_Story_Template.1.toe (6.0 KB)

Hi @pricer,

it’s best to have a concrete question and explain in detail where you are running into issues.
Include what you have tried so far and what the results are and what your expectations are.

cheers
Markus

apologies Markus, that makes sense.
I have attached an updated .toe that has the same issues. I am sure I am overlooking something basic.
When I press either button I get the error:

  File "/project1/chopexec1", line 12, in onOffToOn
td.tdAttributeError: 'td.containerCOMP' object has no attribute 'ButtonClick' Context:/project1
python >>> 

This error has occurred a lot for me and sometimes the method will work for a while before I then get the above error message and it stops working.

thanks
R

Interacative Story Wed_27_Nov.toe (5.8 KB)

Hi @pricer,

one issue seems that your extension is not properly evaluating and returning an error on start:

Error retrieving extension for /project1: (Extension 1)   File "/project1/DisExt", line 14, in __init__
td.tdAttributeError: 'td.ParCollection' object has no attribute 'index' Context:/project1/button1
  File "/perform"

this points to line 14 in your extension where the attribute self.index is set to op('button1').par.index but the Button COMP does not have such a parameter making the extension fail.

If you change that line to just self.index = 0, the extension and with it the button interaction will start to work.

cheers
Markus

thanks Markus, I really appreciate u looking at this - that was a silly mistake - i meant to use op('switch1').par.index instead.
I fixed this and am not getting the error messages now but the interaction is not working at all - the switch index is not changing / triggered by the GoToPage() method and similarly the UpdateButtons() method is not updating the button labels : (
Interacative Story Thurs 28 Nov.toe (5.9 KB)

Ended up getting it fixed…

Interacative Story_Fri_fixed.toe (6.6 KB)