A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Loop problem

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Location
    NekoCity
    Posts
    21

    Unhappy Loop problem

    I probably made some dumb mistake with the loop. I can't find whats wrong though (loops hate me).
    PHP Code:
    //set up passive abilitys
    var passive:Array = [counter,
    reflect,
    reflect2,
    hpdrain,
    mpdrain,
    atkhp,
    atkmp,
    damagemp,
    hitmp,
    ulthp,
    ultmp,
    mpusehp,
    ultusehp,
    ultusemp,
    poisonheal,
    bleedheal,
    guard,
    atkdebuff,
    atk2debuff,
    defdebuff,
    def2debuff,
    spddebuff,
    evddebuff,
    accdebuff,
    poison,
    bleed,
    burn,
    freeze,
    stun,
    sleep,
    silence,
    death,
    autoatk,
    autoatk2,
    autodef,
    autodef2,
    autospd,
    autoevd,
    autoacc,
    autoregen,
    poisonproof,
    bleedproof,
    burnproof,
    freezeproof,
    stunproof,
    sleepproof,
    silenceproof,
    deathproof,
    ultboost,
    hpdamagescale,
    mpdamagescale,
    ultdamagescale]
    function 
    statcalc:void{
        for (var 
    a:uint 15a++){
            for (var 
    b:uint 0passive.length 1b++){
                var 
    "p"+a+"pass"+passive[b]=0
            
    }
            var 
    "p"+1a+"hpmax":uint = (number("p"+1a+"atk")+number("p"+1a+"matk")+number("p"+1a+"def")+number("p"+1a+"mdef")+number("p"+1a+"spd")+number("p"+1a+"evd")+number("p"+1a+"acc"))
        }


  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    What exactly are you trying to do?

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Location
    NekoCity
    Posts
    21
    Quote Originally Posted by ilike2 View Post
    What exactly are you trying to do?
    the part within the function arent working and I think the function might be the problem

    This is the main concern
    PHP Code:
    function statcalc:void{
        for (var 
    a:uint 15a++){
            for (var 
    b:uint 0passive.length 1b++){
                var 
    "p"+a+"pass"+passive[b]=0
            
    }
            var 
    "p"+1a+"hpmax":uint = (number("p"+1a+"atk")+number("p"+1a+"matk")+number("p"+1a+"def")+number("p"+1a+"mdef")+number("p"+1a+"spd")+number("p"+1a+"evd")+number("p"+1a+"acc"))
        }

    The rest is a bit redundant
    Last edited by Neko303; 07-18-2010 at 09:27 AM. Reason: typo

  4. #4
    Junior Member
    Join Date
    Jan 2010
    Location
    NekoCity
    Posts
    21
    solved most of them
    PHP Code:
    function statcalc():void{
        for (var 
    a:uint 15a++){
            for (var 
    b:uint 0passive.length 1b++){
                var 
    "p"+a+"pass"+passive[b]:uint=0
            
    }
            var 
    "p"+a+"hpmax":uint undefined
        
    }

    I just get this now
    1084: Syntax error: expecting identifier before p. var "p"+a+"pass"+passive[b]:uint=0
    1084: Syntax error: expecting identifier before p. var "p"+a+"hpmax":uint = undefined
    Last edited by Neko303; 07-18-2010 at 09:51 AM.

  5. #5
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    That's no wonder you're getting this type of errors.

    You cannot put string after a keyword var.

    This is an illegal line:
    Actionscript Code:
    var "p"+a+"hpmax":uint = undefined

    It would be easier to say what's wrong if we knew exactly what you want from this loop..

    Maybe you meant to say:
    Actionscript Code:
    trace("p"+a+"hpmax");
    ?
    Last edited by caseyryan; 07-18-2010 at 12:39 PM.

  6. #6
    Junior Member
    Join Date
    Jan 2010
    Location
    NekoCity
    Posts
    21
    Im trying to set up a variable not trace something D:

    P.S. I should mention I already fixed the loop

Tags for this Thread

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center