Results 1 to 6 of 6

Thread: Loading a single DTM

  1. #1
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default Loading a single DTM

    Well I made a thread earlier, but deleted it because I though I had it sorted, but I don't.

    Here's the code first off:
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    var
      BronzeBar, IronBar, SteelBar, MithBar, AddyBar, RuneBar, Bars, x, y : Integer;

    const
      Bar = 'RuneBar'; //Valid arguments: BronzeBar ~ IronBar ~ SteelBar ~ MithBar ~
                      //                  AddyBar ~ RuneBar ~~ EXACTLY!
     

    procedure LoadDTMs;
    begin
      case (Bar) of
     0: begin
          BronzeBar := DTMFromString('78DA63FCC6C4C0F080910119C47A683370016' +
           '990E87F2060FC0C54730D550D44164602E95F40353708A8616466' +
           '60B84B40CD6FA0394F09A8F90254F39A809A674035CF08A879035' +
           '4F312558D818202AA9AE740350F0998F30EA8E6167E3500824016' +
           'C1');
          Bars:= BronzeBar;
        end;

     1: begin
          IronBar := DTMFromString('78DA8DD1D10A40500C06E0CD499294E4C6C39' +
           'D3B6F2E44A208B9C12F29AEFEB38BADB6AFB59A0646A457F94661' +
           'ADE4A877F744680853FECD337D336A02531393C234C46430ADC39' +
           'E819818662626825988119895181F662366F7442607331273C074' +
           'C418DC5339DC4C7E7A016EE916E1');
          Bars:= IronBar;
        end;

     2: begin
          SteelBar := DTMFromString('78DA63CC62666090646240061505F90C46409' +
           'A1188FF03016326508D20AA1A882C8C04D20540354204D45400D5' +
           '881350530A54234B404D2E508D2A0135494035CA04D4C402D5C81' +
           '1501307542343404D3211FE4A05AA5121220C9508A82904AA11C6' +
           'AF06006FA10CB2');
          Bars:= SteelBar;
        end;
       
     3: begin
          MithBar := DTMFromString('78DA638C64666078CDC8800CEC1D621924813' +
           '448F43F103082D43C465503918591403A01A8E6090135A94035CF' +
           '09A84904AAF94C404D3A50CD5B22D410B22B16A8E63B013501403' +
           '55F08A80905AAF946408D2F50CD7B22EC7A43845D04FC0500F093' +
           '15E9');
          Bars:= MithBar;
        end;
       
     4: begin
          AddyBar := DTMFromString('78DA636C67666078C7C8800C02D30219B8803' +
           '448F43F10303603D53C46550391859140BA03A8E60901357D4035' +
           'CF08A8990454F3820835AF09A8E906AAF94C849BBF1150534F849' +
           'A0ACC30C450530554F38508356F08A8A901AA7945849B9FE35703' +
           '00D5E11999');
          Bars:= AddyBar;
        end;
       
     5: begin
          RuneBar := DTMFromString('78DA63E4646660E0676240064179950C22409' +
           'A1188FF03012307500D3BAA1A882C8C04D2FC40355C04D48800D5' +
           'F01050230C542348400D1F508D1801356C40353204D4FC03CA4B1' +
           '250F313282F4E84397C04D4B000DDC3815F0D00FFE809A7');
          Bars:= RuneBar;
        end;
      end;
    end;

    procedure Test;
    begin
      if FindDTM(Bars, x, y, MIX1, MIY1, MIX2, MIY2) then
      MMouse(X, Y, 10, 10);
    end;


    begin
      SetupSRL;
      ActivateClient;
      LoadDTMs;
      Test;
    end.
    Most experienced scripters should probably be able to see what I'm trying to do, which is load a single DTM, depending on which bar the user wants, and names it to "Bars". However, when I run it, it compiles, but I get an error.
    Code:
    [Runtime Error] : Exception: Type Mismatch in line 14 in script D:\Program Files\SCAR 3.15b\SCAR 3.15\Scripts\My Scripts\Smither\Smither.scar
    Any help appreciated,
    ~Richard
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Const Bar is a string, in you case you are using it as an integer.
    SCAR Code:
    Case Lowercase(Bar) Of
      'bronze': ....
      etc
    End;


  3. #3
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cazax is probably right but for some reason this worked for me.

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    var
      BronzeBar, IronBar, SteelBar, MithBar, AddyBar, RuneBar, Bars, x, y : Integer;

    const
      BarToDo = 'RuneBar'; //Valid arguments: BronzeBar ~ IronBar ~ SteelBar ~ MithBar ~
                      //                  AddyBar ~ RuneBar ~~ EXACTLY!


    procedure LoadDTMs;
    begin
      if(not(LoggedIn))then Exit;
      case (BarToDo) of
     0: begin
          BronzeBar := DTMFromString('78DA63FCC6C4C0F080910119C47A683370016' +
           '990E87F2060FC0C54730D550D44164602E95F40353708A8616466' +
           '60B84B40CD6FA0394F09A8F90254F39A809A674035CF08A879035' +
           '4F312558D818202AA9AE740350F0998F30EA8E6167E3500824016' +
           'C1');
          Bars:= BronzeBar;
        end;

     1: begin
          IronBar := DTMFromString('78DA8DD1D10A40500C06E0CD499294E4C6C39' +
           'D3B6F2E44A208B9C12F29AEFEB38BADB6AFB59A0646A457F94661' +
           'ADE4A877F744680853FECD337D336A02531393C234C46430ADC39' +
           'E819818662626825988119895181F662366F7442607331273C074' +
           'C418DC5339DC4C7E7A016EE916E1');
          Bars:= IronBar;
        end;

     2: begin
          SteelBar := DTMFromString('78DA63CC62666090646240061505F90C46409' +
           'A1188FF03016326508D20AA1A882C8C04D20540354204D45400D5' +
           '881350530A54234B404D2E508D2A0135494035CA04D4C402D5C81' +
           '1501307542343404D3211FE4A05AA5121220C9508A82904AA11C6' +
           'AF06006FA10CB2');
          Bars:= SteelBar;
        end;

     3: begin
          MithBar := DTMFromString('78DA638C64666078CDC8800CEC1D621924813' +
           '448F43F103082D43C465503918591403A01A8E6090135A94035CF' +
           '09A84904AAF94C404D3A50CD5B22D410B22B16A8E63B013501403' +
           '55F08A80905AAF946408D2F50CD7B22EC7A43845D04FC0500F093' +
           '15E9');
          Bars:= MithBar;
        end;

     4: begin
          AddyBar := DTMFromString('78DA636C67666078C7C8800C02D30219B8803' +
           '448F43F10303603D53C46550391859140BA03A8E60901357D4035' +
           'CF08A8990454F3820835AF09A8E906AAF94C849BBF1150534F849' +
           'A0ACC30C450530554F38508356F08A8A901AA7945849B9FE35703' +
           '00D5E11999');
          Bars:= AddyBar;
        end;

     5: begin
          RuneBar := DTMFromString('78DA63E4646660E0676240064179950C22409' +
           'A1188FF03012307500D3BAA1A882C8C04D2FC40355C04D48800D5' +
           'F01050230C542348400D1F508D1801356C40353204D4FC03CA4B1' +
           '250F313282F4E84397C04D4B000DDC3815F0D00FFE809A7');
          Bars:= RuneBar;
        end;
      end;
    end;

    procedure Test;
    begin
      if(not(LoggedIn))then Exit;
      if FindDTM(Bars, x, y, MIX1, MIY1, MIX2, MIY2) then
      MMouse(X, Y, 10, 10);
    end;


    begin
      SetupSRL;
      ActivateClient;
      LoadDTMs;
      Test;
    end.

  4. #4
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    As Cazax said, the constant is a string. You cannot use it as an integer in the case.

    But, I was thinking that bars have the same shape and just different outlines, right? Make a dynamic DTM (DDTM), load it and set only the color of the mainpoint through a case.

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Oooh, thanks everyone. I'll have a quick read of some tutorials on DDTMs.

    EDIT: Cazax, I tried what you said, but I still get the error. Can you add into the code that I showed you what I need to add to make it work, please?

    EDIT2: Fixed the cases part, made a DDTM, had dinner, now going to test to DDTM...

    Thanks,
    Richard
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  6. #6
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    Well I've tested the DDTM, and it fails...miserably...Here's what I've got:
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    var
      Col, x, y, DDTM : Integer;
      MP : TDTMPointDef;
      SP : array [0..5] of TDTMPointDef;
      Skelly : TDTM;

    const
      Bar = 'Mith'; //Valid arguments: Bronze ~ Iron ~ Steel ~ Mith ~ Addy ~ Rune
               //                  Starting letters must be uppercase!


    procedure Colours;
    begin
      case (Bar) of
        'Bronze': Col:= 2902367;
        'Iron': Col:= 6052963;
        'Steel': Col:= 7237495;
        'Mith': Col:= 7359820;
        'Addy': Col:= 5268560;
        'Rune': Col:= 4209195;
      end;
    end;

    procedure BarDDTM;
    begin
      MP.x:= 20;
      MP.y:= 15;
      MP.areasize:= 1;
      MP.areashape:= 0;
      MP.color:= Col;
      MP.tolerance:= 20;

      SP[0].x:= 20;
      SP[0].y:= 6;
      SP[0].areasize:=1;
      SP[0].areashape:=0;
      SP[0].color:=65536;
      SP[0].tolerance:=30;

      SP[1].x:= 32;
      SP[1].y:= 10;
      SP[1].areasize:=1;
      SP[1].areashape:=0;
      SP[1].color:=65536;
      SP[1].tolerance:=30;

      SP[2].x:= 34;
      SP[2].y:= 25;
      SP[2].areasize:=1;
      SP[2].areashape:=0;
      SP[2].color:=65536;
      SP[2].tolerance:=30;

      SP[3].x:= 25;
      SP[3].y:= 25;
      SP[3].areasize:=1;
      SP[3].areashape:=0;
      SP[3].color:=65536;
      SP[3].tolerance:=30;

      SP[4].x:= 14;
      SP[4].y:= 24;
      SP[4].areasize:=1;
      SP[4].areashape:=0;
      SP[4].color:=65536;
      SP[4].tolerance:=30;
     
      SP[5].x:= 9;
      SP[5].y:= 17;
      SP[5].areasize:=1;
      SP[5].areashape:=0;
      SP[5].color:=65536;
      SP[5].tolerance:=30;

      Skelly.MainPoint:=MP;
      Skelly.SubPoints:=SP;
      DDTM:=AddDTM(Skelly);
    end;

    procedure Test;
    begin
      MouseSpeed:= 11 + Random(4);
      if FindDTM(DDTM, x,y, 0, 0, 166, 69) then
      begin
      WriteLn('oooo');
      MMouse(x,y,0,0);
      GetMousePos(x, y);
      WriteLn(inttostr(x)+' ' +inttostr(y));
      FreeDTM(DDTM);
      end;
    end;

    begin
      SetupSRL;
      Colours;
      BarDDTM;
      Test;
    end.

    Basically, what happens is, nothing...I press play, and the mouse just sits there. If anyone can points me in the right direction, I'll be very grateful. If I can't get this to work, then I'll just go back to using normal DTMs.

    I've got a picture of the bars in my inventory below for if you want to test it and be really helpful.



    Richard.

    EDIT: Sorry for double post. I forgot I'd posted last.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need help with a single variable...
    By Toterache in forum OSR Help
    Replies: 4
    Last Post: 01-16-2008, 08:32 PM
  2. why cant i get even single script work? :(
    By urakkistus in forum OSR Help
    Replies: 13
    Last Post: 05-05-2007, 05:03 PM

Posting Permissions

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