Please Help (Dynamic Text)

Discussion in 'Scripting/Addon Discussion' started by KrisiS, Dec 9, 2015.

  1. KrisiS

    KrisiS Member

    Joined:
    Aug 17, 2013
    Messages:
    89
    Likes Received:
    1
    Please help me to fix this script.

    This Works:
    Code:
    if (ExileClientPlayerScore >0 && ExileClientPlayerScore <2499) then {
        titleText ["", "PLAIN DOWN"];
        ["<br /><br /><t color='#ff0000' align='left'>RANK:</t><t align='left'> 0/10 (<t color='#FFFF00'>Bambi</t>) </t><br /><t color='#5882FA' align='left'>Next Rank:</t><t align='left'> 1/10 (<t color='#FFFF00'>Recruit</t>) Cost</t><t color='#40FF00' align='left'> 2.5k</t><t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\rank\exile.paa'</t>",0,0.9,15,0] spawn bis_fnc_dynamictext;
        } else {
      
        if (ExileClientPlayerScore >2500 && ExileClientPlayerScore <9999) then {
        titleText ["", "PLAIN DOWN"];
        ["<br /><br /><t color='#ff0000' align='left'>RANK:</t><t align='left'> 2/10 (<t color='#FFFF00'>Recruit</t>) </t><br /><t color='#5882FA' align='left'>Next Rank:</t><t align='left'> 3/10 (<t color='#FFFF00'>Private</t>) Cost</t><t color='#40FF00' align='left'> 2.5k</t><t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\rank\exile.paa'</t>",0,0.9,15,0] spawn bis_fnc_dynamictext;
        }
        

    but this does not work:
    Code:
    if (ExileClientPlayerScore >0 && ExileClientPlayerScore <2499) then {
        titleText ["", "PLAIN DOWN"];
        ["<br /><br /><t color='#ff0000' align='left'>RANK:</t><t align='left'> 0/10 (<t color='#FFFF00'>Bambi</t>) </t><br /><t color='#5882FA' align='left'>Next Rank:</t><t align='left'> 1/10 (<t color='#FFFF00'>Recruit</t>) Cost</t><t color='#40FF00' align='left'> 2.5k</t><t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\rank\exile.paa'</t>",0,0.9,15,0] spawn bis_fnc_dynamictext;
        } else {
      
        if (ExileClientPlayerScore >2500 && ExileClientPlayerScore <9999) then {
        titleText ["", "PLAIN DOWN"];
        ["<br /><br /><t color='#ff0000' align='left'>RANK:</t><t align='left'> 2/10 (<t color='#FFFF00'>Recruit</t>) </t><br /><t color='#5882FA' align='left'>Next Rank:</t><t align='left'> 3/10 (<t color='#FFFF00'>Private</t>) Cost</t><t color='#40FF00' align='left'> 2.5k</t><t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\rank\exile.paa'</t>",0,0.9,15,0] spawn bis_fnc_dynamictext;
        } else {
      
        if (ExileClientPlayerScore >10000 && ExileClientPlayerScore <19999) then {
        titleText ["", "PLAIN DOWN"];
        ["<br /><br /><t color='#ff0000' align='left'>RANK:</t><t align='left'> 3/10 (<t color='#FFFF00'>Veteran</t>) </t><br /><t color='#5882FA' align='left'>Next Rank:</t><t align='left'> 4/10 (<t color='#FFFF00'>Soldier</t>) Cost</t><t color='#40FF00' align='left'> 2.5k</t><t shadow='1' shadowColor='#000000' color='%15'><img size='1.0' shadowColor='#000000' image='addons\rank\exile.paa'</t>",0,0.9,15,0] spawn bis_fnc_dynamictext;
        }
      
        };
    I have 10 groups to add, can you please help me to get this working..

    Many thanks in advance :)
     
    Last edited: Dec 9, 2015
  2. KrisiS

    KrisiS Member

    Joined:
    Aug 17, 2013
    Messages:
    89
    Likes Received:
    1
    Working now, :)
     
  3. ShootingBlanks

    ShootingBlanks OpenDayZ Guru!

    Joined:
    Mar 31, 2013
    Messages:
    2,422
    Likes Received:
    336
    Your welcome :D ... you had a hosed up else clause. many if's and elses will do that which is why there is a switch statement. We can use it like this with a switch true so it executes and then compares multiple cases. I dont know, maybe its not more concise than multiple if statements but I think its easier to read ...
    Code:
    switch (true) do {
         case (ExileclientPlayerScore < 2499):
                 {
                  //text output goes here
                  };
         case (ExileClientPlayerScore >2500 && ExileClientPlayerScore <9999):
                 {
                  //text output goes here
                  };
         case (ExileClientPlayerScore >10000 && ExileClientPlayerScore <19999):
                 {
                  //text output goes here
                  };
    };
    
     
  4. KrisiS

    KrisiS Member

    Joined:
    Aug 17, 2013
    Messages:
    89
    Likes Received:
    1
    Thank your friend, that's perfect :)
    You're a gentleman !
     

Share This Page