Hi guys,
asking help again, difficult to stap over from Flash 5 to Dir... syntax is bit 
confusing to me...

in short i have a 7 models + a moving one, i first indicate if the moving one is in 
range of one of the 7 objects then if the distance is really short, I remove it from 
the
world. The first script i made for 1 works just fine  (thanks again to Brian and James 
for their great help!!)
now, because they are 7 i want to loop this script 7 times. That's where i get some 
syntax problems.
At start movie i have globals, it1 to it7 set to 1, those are the vars that i use to 
see if the items are in world or not, when removed i set them to 0.
item1 to item7 are the names of the 7 models i want to detect/delete.

So far, so good. this script base on moving model "ChassisM" and item 1 works 
perfectly.

  if it1 = 1 then
    detect = (balls.model ("item1").transform.position - balls.model 
("ChassisM").transform.position).magnitude
    if detect <= 1500 then
      set the text of member "detecttxt" to "You are in range of object 1! go get it!!"
      the visible of sprite 19 = true
    else
      set the text of member "detecttxt" to " "
      set the text of member "rangetxt" to " "
      the visible of sprite 19 = false
    end if
  end if
  if detect1 <= 120 and it1 = 1 then
    balls.model ("item3").removeFromWorld()
    it1 = 0
    puppetsound 1, "touchitem"
    set the text of member "detecttxt" to " "
    set the text of member "rangetxt" to " "
    the visible of sprite 19 = false
    set the memberNum of sprite 23 to 85
  end if

now, this where i have some synthax problems...
on the second line , i think director see's this as a string instead of a number
same for line 2, 3, 4, 14, 16.  I need a sort of Number("it"&counter) synthax i 
think....

repeat with counter = 1 to 7
    if "it"&counter = 1 then
      "detect"&counter = (balls.model ("item"&counter).transform.position - 
balls.model ("ChassisM").transform.position).magnitude
      if "detect"&counter <= 1500 then
        set the text of member "detecttxt" to "You are in range of object "&& counter 
&&"! go get it!!"
        the visible of sprite 19 = true
      else
        set the text of member "detecttxt" to " "
        set the text of member "rangetxt" to " "
        the visible of sprite 19 = false
      end if
    end if

    if detect&counter <= 120 and "it"&counter != 1 then
      balls.model ("item"&counter).removeFromWorld()
      "it"&counter = 0
      puppetsound 1, "touchitem"
      set the text of member "detecttxt" to " "
      set the text of member "rangetxt" to " "
      the visible of sprite 19 = false
      set the memberNum of sprite 21 to 85
    end if
  end repeat

Anyone?

Fabrice


--
Zuidzijde reclamebureau
http://www.zuidzijde.nl


[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!]

Reply via email to