Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Direct TTS (Text to speech)
Push Dial-Alphamania
Get Least Common Denominator
MPEG Xtra Simple Control
Go To The Frame - Blog about Lingo
Shockwave Stand Alone Installer
MasterApp
SmoothMove ActiveX
Parse CSV File
SiteSearch Indexer
 

 

 

Behavior Sprite Recorder

Added on 8/23/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: TommiBdckgren

Drop on a sprite, make it move with keyframes or script, and (allmost all) of what it did (like position, member, blend etc.) gets recorded in a field. Play with Sprite player behavior.

property inum, pobjectListH, pobjectListV,ptimer
property beginhunt,x,pobjectListrot,deletelast1,deletelast2,deletelast3
property deletelast4,deletelast5,deletelast6,deletelast7,deletelast8,deletelast9,deletelast10,deletelast11
property pblendlist,pmemberlist,pskewlist,pinklist,psizeHlist,psizeVlist,prectlist,pquadlist,newfield


on beginSprite me
  
  inum = the spritenum of me -- this is me
  
  -------------------------------------------------------------------
  -- Creates a default field for data if no fields within cast.
  -------------------------------------------------------------------
  if x="Data record 1"=False then
    pass
  else
    if x="Data record 1"=true then newfield = new(#field)
    newfield.name = "Data record one"
    member("Data record one").font= "Arial"
    member("Data record one").fontsize= 10
    member("Data record one").alignment="left"
    member("Data record one").lineheight=10
  end if
  -------- ***
  
  
  --------------------------------------------------------------
  -- Empty the field to record in and mark where to record what
  --------------------------------------------------------------
  
  put "The horisontal movements" into line 1 of field (x)
  put "" into line 2 of field (x)
  put "The vertical movements"into line 4 of field (x)
  put "" into line 5 of field (x)
  put "The sprite rotation" into line 7 of field (x)
  put "" into line 8 of field (x)
  put "The sprite blend" into line 10 of field (x)
  put "" into line 11 of field (x)
  put "The sprite member" into line 13 of field (x)
  put "" into line 14 of field (x)
  put "The sprite skew" into line 16 of field (x)
  put "" into line 17 of field (x)
  put "The sprite ink" into line 19 of field (x)
  put "" into line 20 of field (x)
  put "The sprite size horisontal" into line 22 of field (x)
  put "" into line 23 of field (x)
  put "The sprite size vertical" into line 25 of field (x)
  put "" into line 26 of field (x)
  put "The sprite rect " into line 28 of field (x)
  put "" into line 29 of field (x)
  -- put "The sprite quad " into line 31 of field (x)
  ---put "" into line 32 of field (x)
  put "This data was recorded :" &&the abbreviated date && ". Can be played with - Sprite player -."into line 34 of field (x)
  put "Remember that if you do not have the castmembers in the same cast places as where they where when recorded, errors will accure."into line 35 of field (x)
  put "This recorder records currently the following things: Horisontal and  vertical position, rotation, blend, member, skew, ink, width, height and rect. Other transforms are not recorded."into line 36 of field (x)
  put "This is a open script, so use it as you please. If you find out a way to get the Quad thing inside the script to work (so that the player understands to read it) please email (tommi.backgren@tothepoint.fi)."into line 37 of field (x)
  put "The Quad recording would let me skip the width,height and rect parts in the script, i hope."into line 38 of field (x)
  ---------- ***
  
  
  -----------------------------------------
  -- Create empty lists
  -----------------------------------------
  pobjectListH = []
  pobjectListV = []
  pobjectListrot = []
  pblendlist = []
  pmemberlist = []
  pskewlist = []
  pinklist = []
  psizeHlist= []
  psizeVlist= []
  prectlist=[]
  --pquadlist=[]
  ----------------- ***
  
  
  -------------------------------------------------------
  -- put a little bit of data into field to warm it up...
  -------------------------------------------------------
  append pobjectListH, the loch of sprite (inum)
  append pobjectListV, the locV of sprite (inum)
  append pobjectListrot, the rotation of sprite (inum)
  append pblendlist, the blend of sprite (inum)
  append pmemberlist, the membernum of sprite (inum)
  append pskewlist, the skew of sprite (inum)
  append pinklist, the ink of sprite (inum)
  append psizeHlist, the width of sprite (inum)
  append psizeVlist, the height of sprite (inum)
  append prectlist, the rect of sprite (inum)
  --append pquadlist, the quad of sprite (inum)
  
  ------- ***
  
  ------------------------------
  -- start timer for exitframe
  ------------------------------
  set pTimer = the ticks
  
  --------- ***
  
end beginSprite


on exitframe

  ------------------------------------------------------------
  -- See if you can start to record data and if so then do it.
  ------------------------------------------------------------
  if the ticks - pTimer > beginhunt then
    recordme
  end if
  --------- ***
end



on recordme me

  ------------------------------------
  -- the real recording in progress.
  ------------------------------------
  append pobjectListH, the loch of sprite (inum)
  append pobjectListV, the locV of sprite (inum)
  append pobjectListrot, the rotation of sprite (inum)
  append pblendlist, the blend of sprite (inum)
  append pmemberlist, the membernum of sprite (inum)
  append pskewlist, the skew of sprite (inum)
  append pinklist, the ink of sprite (inum)
  append psizeHlist, the width of sprite (inum)
  append psizeVlist, the height of sprite (inum)
  append prectlist, the rect of sprite (inum)
  --append pquadlist, the quad of sprite (inum)

  --------- ***


  -------------------------------------
  -- put record data into data field
  ------------------------------------
  put pobjectListH into line 2 of field (x)
  put pobjectListV into line 5 of field (x)
  put pobjectListrot into line 8 of field (x)
  put pblendlist into line 11 of field (x)
  put pmemberlist into line 14 of field (x)
  put pskewlist into line 17 of field (x)
  put pinklist into line 20 of field (x)
  put psizeHlist into line 23 of field (x)
  put psizeVlist into line 26 of field (x)
  put prectlist into line 29 of field (x)
  --put pquadlist into line 32 of field (x)

  --------- ***

  ------------------------------------------------------
  -- remove unwanted characters from beginnings of lists
  ------------------------------------------------------
  put "" into char 1 of word 1 of line 2 of field (x)
  put "" into char 1 of word 1 of line 5 of field (x)
  put "" into char 1 of word 1 of line 8 of field (x)
  put "" into char 1 of word 1 of line 11 of field (x)
  put "" into char 1 of word 1 of line 14 of field (x)
  put "" into char 1 of word 1 of line 17 of field (x)
  put "" into char 1 of word 1 of line 20 of field (x)
  put "" into char 1 of word 1 of line 23 of field (x)
  put "" into char 1 of word 1 of line 26 of field (x)
  put "" into char 1 of word 1 of line 29 of field (x)
  --put "" into char 1 of word 1 of line 32 of field (x)
  ------ ***

  -------------------------------------------------
  -- Seek for the last unwanted renegade character
  -------------------------------------------------
  put the number of chars in line 2 of field (x)into deletelast
  put the number of chars in line 5 of field (x)into deletelast2
  put the number of chars in line 8 of field (x)into deletelast3
  put the number of chars in line 11 of field (x)into deletelast4
  put the number of chars in line 14 of field (x)into deletelast5
  put the number of chars in line 17 of field (x)into deletelast6
  put the number of chars in line 20 of field (x)into deletelast7
  put the number of chars in line 23 of field (x)into deletelast8
  put the number of chars in line 26 of field (x)into deletelast9
  put the number of chars in line 29 of field (x)into deletelast10
  -- put the number of chars in line 32 of field (x)into deletelast11

  ----- ***

  ---------------------------------------
  -- found the bastard and erased him...
  ---------------------------------------
  put "" into char deletelast of line.2 of field (x)
  put "" into char deletelast2 of line 5 of field (x)
  put "" into char deletelast3 of line 8 of field (x)
  put "" into char deletelast4 of line 11 of field (x)
  put "" into char deletelast5 of line 14 of field (x)
  put "" into char deletelast6 of line 17 of field (x)
  put "" into char deletelast7 of line 20 of field (x)
  put "" into char deletelast8 of line 23 of field (x)
  put "" into char deletelast9 of line 26 of field (x)
  put "" into char deletelast10 of line 29 of field (x)
  --put "" into char deletelast11 of line 32 of field (x)

  ---------- ***

end record me


on getPropertyDescriptionList
      set description = [:]
  addProp description,#x, [#default:"Data record 1", #format:#field, #comment:"Put record data into wich field"]
  addProp description,#beginhunt, [#default:180, #format:#integer,#range:[#min:0, #max:999], #comment:"How long to wait (in ticks) before beginning recording?"]
  return description
end

on getbehaviordescription
  return " Records changes in sprite ( member, position,blend,ink,rotation,skew,width,height etc.) and places the recorded data into a field."&return& " The recorded data can be played with the -Sprite player- behavior. Drop on a sprite. Free to use, if modified please send a copy of the modified script to (tommi.backgren@tothepoint.fi)"
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail