I'm still working at understanding this so my explanation is not that clear.
In the 1st movie I have the parent script.
property image, spriteNumber, currentPosition, stageBoundry, centerSpot,
usurpedImage, imageAddress
on takeShape me
set the image of me to the picture of member "vimage"
end
on goOnStage me, which
set spriteNumber to which
put the memberNum of sprite spriteNumber into imageAddress
put the picture of member imageAddress into usurpedImage
set the picture of member imageAddress to image
updateStage
end
on removeTraces me
set the picture of member imageAddress to usurpedImage
end
on new me
return me
end
on findHost me
go Movie "Host"
end
on adoptaSprite me, spriteNum
set the spriteNumber of me to spriteNum
end
on noteYourPosition me
put the loc of sprite spriteNumber into currentPosition
end
on whereAreYou me
put currentPosition
end
on moveRandom me
set moveAmount to point(0,0)
set switch to point(-1,1)
set direction to getAt(switch,random(2))
set the locH of moveAmount to random (50)*direction
set direction to getAt(switch,random(2))
set the locv of moveAmount to random (50)*direction
return moveAmount --This returns a horizontal and vertical move.
end
on getBearings me
set maxHorizontal to the stageRight-the stageLeft
set maxVertical to the stageBottom-the stageTop
set the stageBoundry of me to rect(0,0,maxHorizontal,maxVertical)
set the centerSpot of me to
point(integer(maxHorizontal/2),integer(maxVertical/2))
end
on makeALegalMove me
repeat while 1
set intendedMove to moveRandom(me)
set newPosition to the currentPosition of me+intendedMove
-- CHECK NEARNESS TO LEFT AND TOP OF STAGE
if the locH of newPosition<0 or the locV of newPosition<0 then next repeat
-- CHECK NEARNESS TO RIGHT OF STAGE
if the locH of newPosition>getAt(the stageboundry of me,3) then next repeat
-- CHECK NEARNESS TO BOTTOM OF STAGE
if the locV of newPosition>getAt(the stageboundry of me,4) then next repeat
-- CHECK NEARNESS TO CENTER
if(the locH of newPosition>the locH of the centerSpot of me-50) and
(the locH of newPosition<the locH of the centerSpot of me+50) and (the locV of
newPosition>the locV of the centerSpot of me-50) and (the locV of
newPosition<the locV of the centerSpot of me+50) then next repeat
-- IF THE NEW POSITION HAS NOT BEEN REJECTED
exit repeat
end repeat
-- SETS THE VIRUS TO THE NEW POSITION
set the loc of sprite the spriteNumber of me to newPosition
updateStage
-- PUTS THE NEW POSITION INTO THE OBJECTS MEMORY
set the currentPosition of me to newPosition
end
on startMoving me
repeat while mouseDown()=0
makeALegalMove me
end repeat
end
In this 1st movie I have button with this
on mouseUp
global virus
set virus to new(script "Virus Parent")
takeShape virus
end
After clicking this button I then go to "file" and open the second movie.
The second movie hase a button with this script.
on mouseUp
global virus
findhost virus
goOnStage virus, 8
getBearings virus
startMoving virus
removeTraces virus
end
When the button is click "findHost" sends you to a third movie where the rest
of the functions are excecuted on the sprite in channel 8 that has been taken
over by the "virus" object.
I had a problem with the "makeALegalMove" part of the parent script which was
back in the first movie but putting a breakpoint there didn't work. If I put
a breakpoint in the above button script it would only work if it was put at
"findHost virus" and then it would only go through it. After which the
debugger would be blank. Putting a breakpoint any lower had no effect. I
finally got it to work right but still none of the breakpoints were triggered.
It is my understanding that this is because the script is just in "memory" but
I was hoping there was a way to be able to step through it to find the problem.
thanks!
will
Tab Julius wrote:
> I'm not familiar with either the book or the example, but by "not in the
> movie" you mean you are running a movie in a window, then the answer is no,
> you cannot debug a movie in a window (MIAW).
>
> If you mean that you transfered (using 'go to movie') to another movie,
> then you physically can't be running a script in the movie you came from,
> so I don't know what you're talking about in that case.
>
> However from the description I almost wonder if you simply mean, go to a
> movie script. ??
>
> Maybe someone else more familiar with the example can say.
>
> - Tab
>
> At 08:10 PM 7/25/01 -0500, Will Mazurek wrote:
> >I am tring to learn OOPS programing using Peter Small's LINGO SORCERY
> >copywrite 1996.
> >In the 2nd chapter there is a demonstration where you start in a movie
> >called "workshop" that has the parent script and a button to make a
> >object called "virus". You then go to a movie called "isolated" where
> >you have a button called "move around" when it is clicked on it goes to
> >a movie called "host" where it replaces a sprite on the stage with the
> >"virus" object and moves it around the stage. I had a problem with it
> >and could not figure out how to debugg it. If i put a breakpoint back
> >in the parentscript in the 1st movie it was never tripped. even after I
> >got it to work it would not trip it.
> >
> >Is there a way to step through a parent script to debug it when you are
> >not in the movie that contains it?
> >
> >Thanks for any help!
> >
> >will
>
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
> email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
> Lingo-L is for learning and helping with programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]