Results 1 to 9 of 9

Thread: Decimals in Simba?

  1. #1
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default Decimals in Simba?

    For a progress report, I need to multiply something by a decimal to get an amount of xp/h. The only problem is the xp/item (bones) is 4.5 I kept getting a type mismatch error until I thought "maybe it was the decimal". I changed 4.5 to 4 and it worked. Now I just want to know if there is a way to get it to multiply 4.5 . The only thing I can think of is this: X(4 + (1/2))
    Any other ideas?

    With decimals (doesn't work):
    Simba Code:
    WriteLn('~XP earned:' + IntToStr(Bones *4.5) + '(' + IntToStr(XPPH) + ' P/H)~');

    With fractions (works):
    Simba Code:
    WriteLn('~XP earned:' + IntToStr(Bones * (4 + (1/2))) + '(' + IntToStr(XPPH) + ' P/H)~');

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Replace IntToStr with ToStr.

    also fractions don't work since it will round the answer.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Replace IntToStr with ToStr.

    also fractions don't work since it will round the answer.
    Ah thank you , int does mean integer after all doesn't it. Will it round it with ToStr?

  4. #4
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    with decimals you have to use extended instead of integer.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  5. #5
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    with decimals you have to use extended instead of integer.
    is it ExtToStr?

  6. #6
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    FloatToStr

    Edit: Ninja'd a Jedi.
    Edit2: Also want to wipe my mind?! Just while your at it.
    Last edited by Kasi; 10-08-2012 at 06:35 PM.

  7. #7
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    StrtoFloat and FloattoStr

    Ninja'd Thinking of wiping the post with my jedi powers.
    Last edited by BraK; 10-08-2012 at 06:34 PM.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  8. #8
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Thanks both of you

  9. #9
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    IntToStr(Round(Bones *4.5))
    Working on: Tithe Farmer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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