Ask a Question related to Macromedia Director Lingo, Design and Development.
-
kiaoraFiona webforumsuser@macromedia.com #1
scripts that control other scripts
Is there any behaviour script that when attached to a sprite can control the functionality of any other scripts attached to that sprite?
I want to try and create such a behaviour that would be along the lines of:
on MouseUp me
If condition is true then
all other scripts for sprite(me.spriteNum) are functional
else if condition is false then
all other scripts for sprite(me.spriteNum) are non-functional
end if
end
any ideas would be fantastic
many regards
fiona-beth
kiaoraFiona webforumsuser@macromedia.com Guest
-
version control of server scripts
Hello, I will install several servers in the near future, and I want to use a system that will do version control on the scripts. The main idea... -
How di I use scripts?
I found a great paginating script, but I have no idea how to use it. Thanks (script below) myPages = app.documents.pages; // Let's make sure... -
CS: Scripts do not appear in Scripts menu
I have several utility AppleScripts that I created for Illustrator 10. I'd like to use these in CS, and they work correctly when I choose "Browse"... -
Server Control Deployment and Client Scripts?
Barry, You shouldn't create that folder with your deployment. That folder is part of the Framework, and it already exists on the box. Jim... -
Scripts - Somebody know how to do this?
Hi, somebody know how is possible to open a popup on clients browser that are visiting my page? I need to open a popup within a message into... -
Rob Dillon #2
Re: scripts that control other scripts
Sure, just create a property and use it's value to control whatever you
like:
---------
property thisSprite
property onOrOff
on beginSprite me
thisSprite = me.spriteNum
onOrOff = 0
end
on mouseEnter me
if onOrOff then
-- change member, etc.
end if
end
on mouseLeave me
if OnOrOff then
-- change member, etc.
end if
end
on mouseDown me
if onOrOff then
-- change member, etc.
end if
end
on mouseUp me
if onOrOff then
onOrOff = 0
else
onOrOff = 1
-- change member, etc.
end if
-------
The mouseUp function will change the value of the property onOrOff
every time it is used, so click once, everything works, click again,
nothing works.
Is that what you were looking for?
--
Rob
_______
Rob Dillon
Team Macromedia
[url]http://www.ddg-designs.com[/url]
412-243-9119
[url]http://www.macromedia.com/software/trial/[/url]
Rob Dillon Guest
-
Richie Bisset #3
Re: scripts that control other scripts
you could set a flag, so for example:
on MouseUp me
If condition is true then
all other scripts for sprite(me.spriteNum) are functional
else if condition is false then
all other scripts for sprite(me.spriteNum) are
non-functional
end if
end
On Fri, 3 Oct 2003 12:34:35 +0000 (UTC), "kiaoraFiona"
[email]webforumsuser@macromedia.com[/email] wrote:
>Is there any behaviour script that when attached to a sprite can control the functionality of any other scripts attached to that sprite?
>
>I want to try and create such a behaviour that would be along the lines of:
>
> on MouseUp me
> If condition is true then
> all other scripts for sprite(me.spriteNum) are functional
> else if condition is false then
> all other scripts for sprite(me.spriteNum) are non-functional
> end if
> end
>
>any ideas would be fantastic
>
>many regards
>fiona-beth
>Richie Bisset Guest
-
Richie Bisset #4
Re: scripts that control other scripts
sorry, hit post before completing the message by accident. Rob's
soluiton is better anyway.
On Fri, 03 Oct 2003 14:19:08 +0100, Richie Bisset
<richie@rocket.nospam.co.uk> wrote:
>you could set a flag, so for example:
>
> on MouseUp me
> If condition is true then
> all other scripts for sprite(me.spriteNum) are functional
> else if condition is false then
> all other scripts for sprite(me.spriteNum) are
>non-functional
> end if
> end
>
>
>
>On Fri, 3 Oct 2003 12:34:35 +0000 (UTC), "kiaoraFiona"
>webforumsuser@macromedia.com wrote:
>>>Is there any behaviour script that when attached to a sprite can control the functionality of any other scripts attached to that sprite?
>>
>>I want to try and create such a behaviour that would be along the lines of:
>>
>> on MouseUp me
>> If condition is true then
>> all other scripts for sprite(me.spriteNum) are functional
>> else if condition is false then
>> all other scripts for sprite(me.spriteNum) are non-functional
>> end if
>> end
>>
>>any ideas would be fantastic
>>
>>many regards
>>fiona-beth
>>Richie Bisset Guest
-
Gretchen Macdowall #5
Re: scripts that control other scripts
In article <bljqcr$qtn$1@forums.macromedia.com>, "kiaoraFiona"
[email]webforumsuser@macromedia.com[/email] wrote:
the functionality of any other scripts attached to that sprite?> Is there any behaviour script that when attached to a sprite can controlRob's way is the most straightforward, but you should also look in to>
> I want to try and create such a behaviour that would be along the lines of:
>
> on MouseUp me
> If condition is true then
> all other scripts for sprite(me.spriteNum) are functional
> else if condition is false then
> all other scripts for sprite(me.spriteNum) are non-functional
> end if
> end
>
"sprite(x).scriptInstanceList". That is a list of all of the current
behaviors. The advantage of taking scripts out of it or adding scripts to
it is that the other scripts don't have to have any code added to them.
-- Control other scripts on same sprite
property spritenum,allOtherScripts
on beginSprite me
allOtherScripts = duplicate(sprite(spritenum).scriptInstanceList)
myPos = getPos(allOtherScripts,me)
deleteAt(allOtherScripts,myPos)
end
on killScripts me
myPos = getPos(sprite(spritenum).scriptInstanceList,me)
cnt = count(sprite(spritenum).scriptInstanceList)
repeat with x = cnt down to 1
if x = myPos then
-- don't commit suicide
next repeat
else
sprite(spritenum).scriptInstanceList.deleteAt(x)
end if
end repeat
end
on restoreScripts me
repeat with instance in allOtherScripts
sprite(spritenum).scriptInstanceList.append(instan ce)
end repeat
end
Call from the message window or other code like
sendSprite 5,#killScripts
sendSprite 5,#restoreScripts
The control script will remain, but the other behaviors on the sprite will
be deleted.
Gretchen Macdowall
[url]http://www.updatestage.com/[/url]
Gretchen Macdowall Guest
-
Charles Parcell webforumsuser@macromedia.com #6
Re: scripts that control other scripts
Sounds like you want to dig into scriptInstanceList. You would actually attach and remove scripts for a sprite rather than turn them on or off.
Hope this helps
Charles Parcell
Team Macromedia Volunteer for Director MX
-----------------------
Posted via Web Forums
Charles Parcell webforumsuser@macromedia.com Guest
-
hairybobby webforumsuser@macromedia.com #7
Re: scripts that control other scripts
hi KiFi
you say you want to have several behaviors and one of the behaviors will control the behavior of another. well I kinda see what you mean. the obvious solution would be to build the lingo all in one behavior but this will work.
behavior one
property spn, flagg
on beginsprite me
spn=me.spritenum
flagg=1
end
on mouseup me
sprite(spn).flagg=random(1,2)
end
behavior two
property spn,flagg
on beginsprite me
spn=me.spritenum
end
on exitframe me
if sprite(spn).flagg=1 then
--do something here
end if
end
the basic point here being that if you want to set or retrieve a property from a different behavior youi just use the lingo
sprite(2).proppa=2 -- this sets the value
and this retrieves the value
if sprite(2).proppa =1 then
with proppa being the name of the property you wish to set and sprite 2 the number of the sprite with the behavior attached to it
HAIRYBOBBY - why didn't I choose a really cool name like the vulcanpimp
[url]http://www.geocities.com/hairybobby2000[/url]
new vector shape behaviors here
[url]http://www.geocities.com/hairybobby2000/vertexhome.html[/url]
hairybobby webforumsuser@macromedia.com Guest
-
kiaoraFiona webforumsuser@macromedia.com #8
Re: scripts that control other scripts
thank you very much, the scriptInstanceList is very helpful. Though it took me a while to figure out it can only be accessed at run time!
The new behaviour that controls the other scripts on the sprite is going to be placed on a number of different sprites. IS there a command in lingo that returns a list of all the sprites that have this behaviour attached. Would it be something to do with the scriptInstancList?
thanks very much
Fiona
kiaoraFiona webforumsuser@macromedia.com Guest
-
Charles Parcell webforumsuser@macromedia.com #9
Re: scripts that control other scripts
No, there is no spriteInstanceList to see which sprites have a specific Behavior. But it is pretty easy to make one. Just setup a global variable called spriteInstanceList = [] in your on startMovie
Than as you add the script to different sprites, have it also increment or decrement to that list. You would add the sprite number or something else useful to the list.
Hope this helps.
Charles Parcell
Team Macromedia Volunteer for Director MX
----
Web Forums
----
Feature Request & Bug Form
Charles Parcell webforumsuser@macromedia.com Guest



Reply With Quote

