Results 1 to 10 of 10

Thread: Need help with strings

  1. #1
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default Need help with strings

    Hey everyone. I have a problem with strings:

    Code:
    text, levelString: String;
    
    levelString:= 'Str';
    text:= levelString+' XP/H: '+IntToStr(XPHour);
    I get this error: Type mismatch at line X.
    The problem is with levelString. XPHour is integer.
    How can I concatenate them?

    Thanks in advance,
    hunt3rx3
    Last edited by Shatterhand; 02-20-2012 at 08:27 PM.

  2. #2
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

  3. #3
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    wat variable type XPhour?

  4. #4
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by x[Warrior]x3500 View Post
    wat variable type XPhour?
    Its integer. The problem is with levelString. Sorry I edited post.

  5. #5
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Use IntToStr()

    or

    ToStr()

  6. #6
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    Use IntToStr()

    or

    ToStr()
    The problem is with levelString. ToStr(levelString) wont work either.

  7. #7
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    levelString: String;

    Put that under variable again.

    var
    levelString: String;
    text: text;
    XPHour: integer;

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  8. #8
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    This compiles fine, the error must be somewhere else.

    Simba Code:
    program new;

    var
      text, levelString : string;
      XPHour : Integer;

    begin
      levelString:= 'Str';
      text:= levelString+' XP/H: '+IntToStr(XPHour);
    end.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  9. #9
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by Kyle Undefined View Post
    This compiles fine, the error must be somewhere else.

    Simba Code:
    program new;

    var
      text, levelString : string;
      XPHour : Integer;

    begin
      levelString:= 'Str';
      text:= levelString+' XP/H: '+IntToStr(XPHour);
    end.
    You are right. The problem was: XPHour was Extended, but rounded. I thought if its rounded, then its like Integer...
    Changed IntToStr to FloatToStr.
    Thanks anyway.
    Last edited by Shatterhand; 02-20-2012 at 10:25 PM.

  10. #10
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    Quote Originally Posted by hunt3rx3 View Post
    You are right. The problem was: XPHour was Extended, but rounded. Changed IntToStr to FloatToStr.
    Thanks anyway.
    Lol you kept saying LevelString had the problem. Was beating my self the last 20 mins for the answer!

    Anyway, thanks kyle for helping him anyway.

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

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
  •