Results 1 to 16 of 16

Thread: Cast is having issues

  1. #1
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default Cast is having issues

    Alright, Cast no longer seems to work. I've tried it with multiple different spells and it always returns false (and doesn't do anything but change to the magic tab), even if the spell can be cast.

    I'm using the OpenDev Repository.

  2. #2
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Edit it then
    I'll check it out later

    T~M

  3. #3
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Would this be due to the new style of the magic interface? With the new way of laying out spells?

  4. #4
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Edit sorry read wrong

    T~M
    Last edited by Dynamite; 05-21-2009 at 04:31 AM.

  5. #5
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes. Would fix it, but stuck up with other sheite ;/

  6. #6
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    I'll get on to it . In another 16 hrs - because of sleep.

  7. #7
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    I think we're going to have to start adding a new method of spell casting.

    Look at the include:

    SCAR Code:
    function Cast(Spell: string): Boolean;
    var
      spArr: TStringArray;
      spNo, X, Y, II, CTS: Integer;
      B: TBox;
      Lum, H, S, L: Extended;
      colArr: TIntegerArray;
    begin
      case (Lowercase(Spell)) of
        'home teleport': Spell := 'lumbridge home teleport';
        'bolt enchantment': Spell := 'enchant crossbow bolt';
        'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
        'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
        'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
        'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
        'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
        'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
      end;
      spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
        'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
        'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'bounty locate', 'telekinetic grab',
        'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
        'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
        'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
        'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
        'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
        'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
        'teleother camelot'];
      Spell := Lowercase(Spell);
      if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
        spNo := StrToInt(Spell) - 1
      else
      if (not(InStrArrEx(Spell, spArr, spNo))) then
      begin
        srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
        Exit;
      end;

      if (GetCurrentTab <> 7) then
      begin
        GameTab(7);
        Wait(500 + Random(500));
      end;
      B.X1 := spNo mod 7 * 24 + 560;
      B.Y1 := spNo div 7 * 24 + 217;
      B.X2 := B.X1 + 23;
      B.Y2 := B.Y1 + 23;
      if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
      FixSpells;
     
      colArr := GetColors(TPAFromBox(B));
      ClearSameIntegers(colArr);
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.72, 1.05);
      for II := 0 to High(colArr) do
      begin
        if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
        ColorToHSL(colArr[II], H, S, L);
        Lum := MaxE(Lum, L);
      end;
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(CTS);
      Result := (Lum > 20.0);
      if (Result) then
      begin
        MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
        Wait(500 + Random(500));
      end;
     
    end;

    It only runs on coords, and with the new system, it probably has different coords than the new system. I'll see what I can do.

  8. #8
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    I know what to do, I have an Idea on how to tackle this - It can be done with making a grid of boxes based on some vars so if the boxes change all you do is specify a new start co-ord.


    Btw have you checked that B.X1 etc are right? Because if you change those then it might fix it

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I found the problem! Bounty Locate has been removed!

    Here is a fixed version:
    SCAR Code:
    function Cast(Spell: string): Boolean;
    var
      spArr: TStringArray;
      spNo, X, Y, II, CTS: Integer;
      B: TBox;
      Lum, H, S, L: Extended;
      colArr: TIntegerArray;
    begin
      case (Lowercase(Spell)) of
        'home teleport': Spell := 'lumbridge home teleport';
        'bolt enchantment': Spell := 'enchant crossbow bolt';
        'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
        'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
        'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
        'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
        'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
        'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
      end;
      spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
        'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
        'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
        'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
        'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
        'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
        'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
        'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
        'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
        'teleother camelot'];
      Spell := Lowercase(Spell);
      if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
        spNo := StrToInt(Spell) - 1
      else
      if (not(InStrArrEx(Spell, spArr, spNo))) then
      begin
        srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
        Exit;
      end;

      if (GetCurrentTab <> 7) then
      begin
        GameTab(7);
        Wait(500 + Random(500));
      end;
      B.X1 := spNo mod 7 * 24 + 560;
      B.Y1 := spNo div 7 * 24 + 217;
      B.X2 := B.X1 + 23;
      B.Y2 := B.Y1 + 23;
      if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
      FixSpells;
     
      colArr := GetColors(TPAFromBox(B));
      ClearSameIntegers(colArr);
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.72, 1.05);
      for II := 0 to High(colArr) do
      begin
        if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
        ColorToHSL(colArr[II], H, S, L);
        Lum := MaxE(Lum, L);
      end;
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(CTS);
      Result := (Lum > 20.0);
      if (Result) then
      begin
        MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
        Wait(500 + Random(500));
      end;
     
    end;

  10. #10
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    What about support for the different ways of organising the spells? I'll see if I can make it change to the default method after gametab(7) is called.

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

    Default

    I already made a spell organizer... Though nobody paid attention: http://www.villavu.com/forum/showthread.php?t=43392


  12. #12
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Then surely you'd just:

    SCAR Code:
    Function GetMagicsSort: Integer;
    Var
      I : Integer;
      Pnts : TPointArray;
    Begin
      GameTab(7);
      Wait(150 + Random(100));
      Pnts := [Point(678, 443), Point(697, 443), Point(716, 443)];
      For I := 0 To 2 Do
        If GetColor(Pnts[i].X, Pnts[i].Y) <> 7038086 Then
        Begin
          Result := I + 1;
          Exit;
        End;
    End;
       
    Procedure SortMagics(Order : Integer);
    Var
      X : Integer;
    Begin
      If Not InIntArray([1, 2, 3], Order) Then
        Exit;
      X := 659 + (19 * Order);
      GameTab(7);
      MouseBox(X, 443, X + 12, 458, 1);
    End;

    function Cast(Spell: string): Boolean;
    var
      spArr: TStringArray;
      spNo, X, Y, II, CTS: Integer;
      B: TBox;
      Lum, H, S, L: Extended;
      colArr: TIntegerArray;
    begin
      case (Lowercase(Spell)) of
        'home teleport': Spell := 'lumbridge home teleport';
        'bolt enchantment': Spell := 'enchant crossbow bolt';
        'enchant level 1 jewelry': Spell := 'lvl-1 enchant';
        'enchant level 2 jewelry': Spell := 'lvl-2 enchant';
        'enchant level 3 jewelry': Spell := 'lvl-3 enchant';
        'enchant level 4 jewelry': Spell := 'lvl-4 enchant';
        'enchant level 5 jewelry': Spell := 'lvl-5 enchant';
        'enchant level 6 jewelry': Spell := 'lvl-6 enchant';
      end;
      spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
        'earth strike', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
        'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
        'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
        'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
        'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
        'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
        'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
        'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'teleother falador', 'teleport block', 'lvl-6 enchant',
        'teleother camelot'];
      Spell := Lowercase(Spell);
      if (GetNumbers(Spell) = Spell) and (InRange(StrToIntDef(GetNumbers(Spell), -1), 1, Length(spArr))) then
        spNo := StrToInt(Spell) - 1
      else
      if (not(InStrArrEx(Spell, spArr, spNo))) then
      begin
        srl_Warn('Cast', 'Invalid Spell Name/Number: ''' + Spell + '''', warn_AllVersions);
        Exit;
      end;

      if (GetCurrentTab <> 7) then
      begin
        GameTab(7);
        Wait(500 + Random(500));
      end;
      SortMagics(1);
      B.X1 := spNo mod 7 * 24 + 560;
      B.Y1 := spNo div 7 * 24 + 217;
      B.X2 := B.X1 + 23;
      B.Y2 := B.Y1 + 23;
      if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
      FixSpells;
     
      colArr := GetColors(TPAFromBox(B));
      ClearSameIntegers(colArr);
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.72, 1.05);
      for II := 0 to High(colArr) do
      begin
        if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
        ColorToHSL(colArr[II], H, S, L);
        Lum := MaxE(Lum, L);
      end;
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(CTS);
      Result := (Lum > 20.0);
      if (Result) then
      begin
        MouseBox(B.X1, B.Y1, B.X2, B.Y2, 1);
        Wait(500 + Random(500));
      end;
     
    end;

    No?

  13. #13
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Richard View Post
    What about support for the different ways of organising the spells? I'll see if I can make it change to the default method after gametab(7) is called.
    SCAR Code:
    FixSpells;

    Handle thats ^.

    Seems like the problem was with a spell getting removed as senrath found. Any other changes that need to be addressed?

    Oh and btw this function has only been out since Rev 32. So no "old system/new system" incompatibilities.

  14. #14
    Join Date
    Feb 2009
    Location
    Philipines
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Read this.

  15. #15
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Dark Arcana View Post
    Read this.
    Meh thats not even updated. I assume you're refering to the other Cast bug which isn't the one thats the problem here.

    Speaking of which I've commited a fix to the open dev repos. Thanks senrath!.
    Last edited by ZephyrsFury; 05-21-2009 at 03:44 PM.

  16. #16
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Glad I could help.

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
  •