Set the Script in StandAlone

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Set the Script in StandAlone

Post by interactbooks » Mon Jan 03, 2011 2:34 pm

I'm having trouble with a stack that uses the following command:

set the script of image "NewImage" to "global i"

Originally I set the script to several lines of code and it was working perfectly, I then must have violated the 10 line script rule which I only just found out about, and it stopped working. Well now I can't get it to work at all even when setting the script to just 1 line (like the above example).

I'm wondering if there is some trigger that was set off so that now I am not able to use the "set script" command at all?

I'm sure other people have run into this issue, but trying to search the forum for something similar is near impossible since the search function does not let you search on the word "script".

Help!

Ezra

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Set the Script in StandAlone

Post by Janschenkel » Mon Jan 03, 2011 2:41 pm

You shouldn't have to set scripts in a standalone - you can use front scripts, back scripts and behavior scripts to accomplish nearly anything that doesn't involve the end user writing LiveCode scripts directly. Anyway, how is it failing? Is it that setting the script to something like

Code: Select all

on mouseUp
   beep
end mouseUp
doesn't make the control beep when clicked upon? Or are you getting an error message?

Also, if the stack is password-protected, you cannot get or set the scripts of any of the controls in it until you unlock it by setting the passKey property of the stack to the password with which you encrypted it.

Jan Schenkel.
Last edited by Janschenkel on Mon Jan 03, 2011 8:10 pm, edited 1 time in total.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

interactbooks
Posts: 65
Joined: Thu Oct 07, 2010 4:47 pm

Re: Set the Script in StandAlone

Post by interactbooks » Mon Jan 03, 2011 2:51 pm

Jan,

Thanks for the quick reply and solution. The stack was in fact password protected! The reason I'm setting the script is because I am loading new images into my stack at runtime and need to have set behaviors defined for these images. Each image has some unique custom properties so I can't just preset these behaviors. I will definitely check out the links you included to see if there is a better way of accomplishing this task.

Thank again!

Ezra

Post Reply