help me with repeat while

Ask a Question related to Macromedia Director 3D, Design and Development.

  1. #1

    Default help me with repeat while

    Hi!

    Shouldn't this work;

    repeat while J < 4

    t[J] = member("w3d").newTexture("B[J]",#fromCastMember,member("B[J]"))

    end repeat

    it doesn't

    thx

    Pelleyoo Guest

  2. Similar Questions and Discussions

    1. repeat
      I used to play certain games on Shockwave but now when I want to play them it says that I need a media player or a shockwave player. I click to...
    2. background-repeat: repeat-x in HTML? Please help!
      I want to have a "centered page" look full screen...I have made them using layers and CSS but if I need it to work in most browsers how do I do the...
    3. Repeat Header??
      Hi, Can I repeat the datagrid header every X rows??? Regards Eval
    4. repeat while...
      I'm having difficulty with a repeat loop in some movie controls. When I press the rewind button and the movieTime reaches 0, it goes back to the...
    5. help with 'repeat'- if I need to(?)
      Hi, I am using buddy api to get a list of pc drives: set dl = baDiskList(), then I want to see which of the drives is a cd-rom. If I look at the dl...
  3. #2

    Default Re: help me with repeat while

    you'd need to type your string (assuming B[J] is a string...) and increment
    your J:



    repeat while J < 4
    t[J] =
    member("w3d").newTexture(string(B[J]),#fromCastMember,member(string(B[J])))
    J = J + 1
    end repeat

    tedalde2 Guest

  4. #3

    Default Re: help me with repeat while

    tedalde2's got it. By puting "B[J]", your making it look for a member named
    "B[J]" and make a texture from it called "B[J]". You want it to look for the
    actual contents of B[J]....So don't use the quotes.

    Also, you can replace your first line with:

    repeat with J = 1 to 4

    Then you don't have to increment J, it will do it automatically

    extol Guest

  5. #4

    Default Re: help me with repeat while

    I'm the same person as Pelleyoo, I'm kinda' scytzofrien.

    What I want to do is to add a new texture with the name "B1" from the
    castmember "B1" and then automaticly create a texture with the name "B2" from
    the castmember "B2". and then the same from "B3" and "B4".

    What you guys suggested didn't work for this.
    Do you have another suggestion for this.

    thanks!



    T?rd Guest

  6. #5

    Default Re: help me with repeat while

    [q]Originally posted by: T?rd
    I'm the same person as Pelleyoo, I'm kinda' scytzofrien.[/q]

    Ha ha ha. This was good one !

    p.s.



    t = []
    repeat with j = 1 to 4
    t[j] = member("w3d_name").newTexture("B"&j, #fromCastMember, member("B"&j))
    end repeat

    necromanthus Guest

  7. #6

    Default Re: help me with repeat while

    Now im Pelleyoo again. Thank god for that.

    Im sorry I have to tell you, nectromantus, that it didn't work. A new texture
    aint created..for some reason, B1 becomes an floating number, and the debugger
    just says "Void". :/ whats wrong? Do I have to convert it to a string or
    something?

    Thanks on beforehaqnd

    Pelleyoo Guest

  8. #7

    Default Re: help me with repeat while

    [q]Originally posted by: Pelleyoo
    Im sorry I have to tell you, nectromantus, that it didn't work. A new texture
    aint created..for some reason, B1 becomes an floating number, and the debugger
    just says "Void". :/ whats wrong? Do I have to convert it to a string or
    something?[/q]

    It works fine for me.
    You have to launch it on beginSprite(me).
    p.s.
    Who is nectromantus ?
    ha ha ha


    necromanthus Guest

  9. #8

    Default Re: help me with repeat while

    We did that. Please help, something is cp as we say in sweden...
    Pelleyoo Guest

  10. #9

    Default Re: help me with repeat while

    [q]Originally posted by: Pelleyoo
    We did that. Please help, something is cp as we say in sweden...[/q]

    on beginSprite(me)
    t = []
    repeat with j = 1 to 4
    t[j] = member("w3d_name").newTexture("B"&j, #fromCastMember, member("B"&j))
    end repeat
    end

    Put the above piece of LINGO in a frame script.
    That frame must contain the W3D member (as sprite).
    And finally, I hope you're a Director MX2004 user ...


    necromanthus Guest

  11. #10

    Default Re: help me with repeat while

    YES thats exactly what we did. Only sausages can talk, In a world were animals are running anarchy. Peace.
    Pelleyoo Guest

  12. #11

    Default Re: help me with repeat while

    [q]Originally posted by: Pelleyoo
    YES thats exactly what we did. Only sausages can talk, In a world were animals
    are running anarchy. Peace.[/q]
    I can't figure out what are you doing wrong there ...
    If that place is damned or in case of paranormal activities, you have to work
    hard:

    global t1,t2,t3,t4

    on beginSprite(me)
    t1 = member("w3d_name").newTexture("B1", #fromCastMember, member("B1"))
    t2 = member("w3d_name").newTexture("B2", #fromCastMember, member("B2"))
    t3 = member("w3d_name").newTexture("B3", #fromCastMember, member("B3"))
    t4 = member("w3d_name").newTexture("B4", #fromCastMember, member("B4"))
    end

    I'm going now.
    You may rest in peace because for you repeat doesn't exist.




    necromanthus Guest

  13. #12

    Default Re: help me with repeat while

    ok thx


    Pelleyoo Guest

  14. #13

    Default Re: help me with repeat while

    Hejsan, Pellyoo. Vilken version om Direktor har du?
    extol Guest

  15. #14

    Default Re: help me with repeat while

    Director MX 2004 s?klart.

    Ass? jag blir s? frustrerad..n?t ?r helt klart mel med necromathus f?rslag.
    Det skapas liksom ingen ny textur som heter B1, det enda som h?nder ?r att T1
    till T4 blir variablar och B1 till B4 blir variablar, och det st?r bara "void"
    p? dom i debuggern. B1 till B4 ska ju inte bli variablar, s? n?t m?ste va fel.

    Om du l?ser det h?r, s? kan ja lova dig att du r?ddar min och t?rds kommande
    vecka =) Vi har projektarbete i skolan nu och ska va klara med det h?r spelet
    p? fredag. Alla smidiga l?sningar beh?vs om vi ska klara det...

    Pelleyoo Guest

  16. #15

    Default Re: help me with repeat while

    Pelleyoo,
    I did not understand your last post considering that I only know english, but
    did you resolve this problem yet? If not, then the reason why the code that was
    given to you from the other members is becuase part of the reason is from this
    line....

    repeat with j = 1 to 4

    when you do this, the varible j is an integer and not a string, and you cannot
    mix integers with a string. Therefore, when you call this...
    t[j] = member("w3d_name").newTexture("B"&j, #fromCastMember, member("B"&j))

    ... you are not getting the correct string because you are mixing a string
    with an integer varible j. To properly do this, you need to temporarlly convert
    j into a string like so....

    on beginSprite
    t = []
    repeat with j = 1 to 4
    t[j] = member("w3d_name").newTexture("B"&string(j), #fromCastMember,
    member("B"&string(j)))
    end repeat
    end beginSprite

    ... however, I am suppried you did not get a script error when you did it the
    way the others told you to do it, or did you get a script error?

    Roofy Guest

  17. #16

    Default Re: help me with repeat while

    [q]Originally posted by: Roofy
    when you do this, the varible j is an integer and not a string, and you cannot
    mix integers with a string. Therefore, when you call this...
    t[j] = member("w3d_name").newTexture("B"&j, #fromCastMember, member("B"&j))

    ... you are not getting the correct string because you are mixing a string
    with an integer varible j. [/q]

    False !
    ("B"&j) is always a string !
    It doesn't matter if b is an integer or a string.
    It's a matter of LINGO parser ...



    necromanthus Guest

  18. #17

    Default Re: help me with repeat while

    If Pelleyoo owns Director MX2004, i think his problem is bad names
    related.
    So ... replace the above script with this one:

    on beginSprite(me)
    t = []
    repeat with j = 1 to 4
    t[j] = member("w3d_name").newTexture("tx"&j, #fromCastMember, member("B"&j))
    end repeat
    end


    This method is used in [url]http://necromanthus.com/Games/ShockWave/warcraft.html[/url]
    and [url]http://necromanthus.com/Games/ShockWave/quake3.html[/url] ...

    necromanthus Guest

  19. #18

    Default Re: help me with repeat while

    Roofy - that makes sense. I know with Actionscript you can put "B" + j and
    it will automatically convert J to a string. So I had just assumed that Lingo
    did the conversion with "B" & j.

    Necromanthus, are you sure you don't have to use String(j)? Because I can't
    see any other reason that the code you supplied wouldn't work for Pelleyoo.

    extol Guest

  20. #19

    Default Re: help me with repeat while

    Hi!

    Now I'm T?rd again!

    I think we finally found the error in the script.

    When we add the overlay, we use this code:

    sprite(5).camera.addOverlay(t1, point(220, 220), 0)

    But when we create the list it doesn't create the variabels t1, t2 etc.?

    What is it we should write instead of "t1" ?

    This wouldn't be to hard, right?



    T?rd Guest

  21. #20

    Default Re: help me with repeat while

    Guys. I wanna thank you with all my heart. it works.

    You saved my week
    T?rd Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139