Working with behaviour scripts

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
standgale
Posts: 26
Joined: Fri May 07, 2021 4:12 am

Working with behaviour scripts

Post by standgale » Thu Nov 04, 2021 5:43 am

Kia ora,

Due to all the random problems with respect to my previous question about building standalone applications with script only stacks and behaviours, I'm just going to try building` it up bit by bit.

My first question is why does this sample application sometimes work when run in livecode (not as standalone) and sometimes not?
Sometimes it has an error when I click the button, when it calls the handler in the stack behaviour script.
So my guess is that sometimes the stack script is not loaded somehow?
Attachments
ScriptOnly.zip
two files, a livecode file and a livecodescript file
(1.88 KiB) Downloaded 177 times

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Working with behaviour scripts

Post by AndyP » Thu Nov 04, 2021 10:39 am

Just tried your sample out.

On first try the script only file was not found, the Stack Files tab in the main stack properties shows this,
LiveCode_Indy_2021-11-04_10-34-25.jpg
Creating and moving the script only file to the Scripts folder had everything working as expected and I could not get it fail.
Andy .... LC CLASSIC ROCKS!

standgale
Posts: 26
Joined: Fri May 07, 2021 4:12 am

Re: Working with behaviour scripts

Post by standgale » Fri Nov 19, 2021 1:47 am

Thanks for trying it out.
I originally had that file in the scripts folder but moved it out to produce an even simpler version for testing. However it didn't work for me consistently when it was in the Scripts folder either.
I just cannot get this whole script only thing to work with any degree of reliability no matter what I do and can find very little information about it.

standgale
Posts: 26
Joined: Fri May 07, 2021 4:12 am

Re: Working with behaviour scripts

Post by standgale » Fri Nov 19, 2021 1:54 am

Good to check that the paths are correct in the stack files tab of the stack inspector though. That's something to remember to look at.

standgale
Posts: 26
Joined: Fri May 07, 2021 4:12 am

Re: Working with behaviour scripts

Post by standgale » Fri Nov 19, 2021 4:21 am

Moving on from the previous example, I tried adding a script-only stack behaviour for the card.
When I try to create a standalone application however it has an error message
test 4 - error message.PNG
Attachments
ScriptOnlyTest4.zip
(2.08 KiB) Downloaded 168 times

standgale
Posts: 26
Joined: Fri May 07, 2021 4:12 am

Re: Working with behaviour scripts

Post by standgale » Fri Nov 19, 2021 4:51 am

Ok so I used this page to understand the error codes
and then changed the line it was having a problem with to refer to the card and stack
set the visible of button "btnOne" of card "cardFront" of stack "ScriptOnlyTests" to true
Although the line worked fine without that level of reference within livecode itself, it seems to be what was stopping it from building the standalone?

Because then it did build ok (although then livecode got stuck in a continuous loop telling me that the stack was already open and did I want to cancel/save/purge like it usually does when I try to build a standalone, and eventually I had to use task manager to kill it. I still don't know what causes that problem. )

Post Reply