Results 1 to 9 of 9

Thread: What am i doing wrong?

  1. #1
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default What am i doing wrong?

    SCAR Code:
    Line 34: [Error] (26826:37): Invalid number of parameters in script
    SCAR Code:
    function FindLocation: string;
    begin
      case result of
        'bank' := (tileOnMM(Point())); <-- 34
        'alter' := (tileOnMM(Point()));
        'lost'  := ((not(tileOnMM(Point()))and(not(tileOnMM(Point())));
      end;
    end;
    Can't figure it out, most likely something stupid >.>

  2. #2
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You need a point in there..?

    Like
    SCAR Code:
    Point(13, 37)

  3. #3
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function FindLocation: string;
    begin
      case result of
        'bank' := (tileOnMM(Point(3242, 3334)));
        'alter':= (tileOnMM(Point(3543, 3432)));
        'lost' := ((not(tileOnMM(Point(2342, 2342)))and(not(tileOnMM(Point(2342, 2342))));
      end;
    end;
    SCAR Code:
    Line 34: [Error] (26826:8): colon (':') expected in script
    Put in bogus points, was going to get them later.

  4. #4
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    What you are trying to do just doesn't make sense.

    I think you want a string parameter for that case. Then for each part do, Result := TileOnMm();
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  5. #5
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    But i need it to return something so i wanted it to return 'bank' if it found the tileonMM

  6. #6
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Maybe do a series of if statements or be 1337 and use a for loop with a TPointArray and a TStringArray.

    Either way, just do a bunch of if statements:
    SCAR Code:
    if TileOnMS() then
      Result := 'this place'
    else
      if TileOnMS() then
        Result := 'that place';

    Know what I mean?
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  7. #7
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, thanks just wanted to make it smaller into a case >.> oh well thanks!

  8. #8
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    You should try using arrays and doing it that way then.

    Use the TPA for each point, then a String array for each corresponding location. Then use a for loop to cycle through.

    SCAR Code:
    for i := 0 to High(pts) do
      If TileOnMS(pts[i]) then
      Begin
        Result := strs[i];
        Break;
      End;
    end;

    p and strs are the arrays. Depending on how many options you have that would make it shorter.

    Hope you followed that, might have got ahead of you.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  9. #9
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay, you don't even set the result so that case will not work properly. And your result is not a boolean...it's a string.

    Edit: also, cases don't work like that. They are like this:
    SCAR Code:
    case something of
      'a' : doa;
      'b' : dob;
    end;

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
  •