Is it currently possible for reflection to detect obstacles when walking a path?
Is it currently possible for reflection to detect obstacles when walking a path?
Derp yes. Google A-Star algorithm and input it into RS context.
New Hooks:
Simba Code:{ 207 Hooks Found By Cheddys Beautiful Updater }
const
ReflectionRevision = '52';
{* BoundaryObject - 9 Hooks *}
BoundaryObject = 'ch';
BoundaryObject_AlternativeOrientation = 'r';
BoundaryObject_AlternativeOrientation_Multiplier = -1409784601;
BoundaryObject_BackupRenderable = 'k';
BoundaryObject_Flags = 'n';
BoundaryObject_Flags_Multiplier = -811434849;
BoundaryObject_Hash = 'b';
BoundaryObject_Hash_Multiplier = -107201215;
BoundaryObject_Orientation = 'z';
BoundaryObject_Orientation_Multiplier = 89571079;
BoundaryObject_Plane = 'j';
BoundaryObject_Plane_Multiplier = -1895237785;
BoundaryObject_Renderable = 'e';
BoundaryObject_Get_X = 'y';
BoundaryObject_Get_X_Multiplier = 1920246735;
BoundaryObject_Get_Y = 'h';
BoundaryObject_Get_Y_Multiplier = 688028895;
{* Cache - 3 Hooks *}
Cache = 'fq';
Cache_CacheableNode = 'j';
Cache_HashTable = 'h';
Cache_Queue = 'r';
{* CacheableNode - 2 Hooks *}
CacheableNode = 'fe';
CacheableNode_Next = 'cd';
CacheableNode_Previous = 'ch';
{* Canvas - 1 Hooks *}
Canvas = 'ds';
Canvas_Component = 'j';
{* Actor - 18 Hooks *}
Actor = 'ag';
Actor_Animation = 'as';
Actor_Animation_Multiplier = 346868905;
Actor_CombatCycle = 'ay';
Actor_CombatCycle_Multiplier = -631709259;
Actor_Health = 'am';
Actor_Health_Multiplier = 1935778589;
Actor_HitCycles = 'aa';
Actor_HitDamages = 'ad';
Actor_HitTypes = 'at';
Actor_Interacting = 'au';
Actor_Interacting_Multiplier = 718341389;
Actor_MaxHealth = 'az';
Actor_MaxHealth_Multiplier = -1034371255;
Actor_Orientation = 'ba';
Actor_Orientation_Multiplier = -866281573;
Actor_ActiveText = 'ag';
Actor_PositionOffset = 'l';
Actor_PositionOffset_Multiplier = -862303680;
Actor_PathLength = 'bu';
Actor_PathLength_Multiplier = -1936525339;
Actor_PathTraversed = 'bc';
Actor_PathX = 'by';
Actor_PathY = 'bn';
Actor_LocalX = 'm';
Actor_LocalX_Multiplier = -1283739801;
Actor_LocalY = 'v';
Actor_LocalY_Multiplier = -1308082377;
Actor_isInSequence = 'p';
{* ClassData - 3 Hooks *}
ClassData = 'gx';
ClassData_Bytes = 'b';
ClassData_Fields = 'r';
ClassData_Methods = 'k';
{* Client - 48 Hooks *}
Client = 'client';
Client_BaseX = 'e.ce';
Client_BaseX_Multiplier = 640915389;
Client_BaseY = 'client.cu';
Client_BaseY_Multiplier = -2112689689;
Client_CameraPitch = 'cw.fi';
Client_CameraPitch_Multiplier = -1301731629;
Client_CameraX = 'dg.fs';
Client_CameraX_Multiplier = -541413329;
Client_CameraY = 'ca.ft';
Client_CameraY_Multiplier = 573960223;
Client_CameraYaw = 'n.fd';
Client_CameraYaw_Multiplier = -1715187017;
Client_CameraZ = 'g.fz';
Client_CameraZ_Multiplier = 1053895939;
Client_CollisionMaps = 'client.w';
Client_Levels = 'client.hn';
Client_Run_Energy = 'client.ji';
Client_Run_Energy_Multiplier = 1630043583;
Client_Experiences = 'client.ha';
Client_LoopCycle = 'client.d';
Client_LoopCycle_Multiplier = 1836037131;
Client_Login_State = 'client.t';
Client_Login_State_Multiplier = -1546172329;
Client_GroundItems = 'client.he';
Client_NPCs = 'client.bc';
Client_Player = 'client.hj';
Client_Players = 'client.gd';
Client_LoginState = 'al.ag';
Client_LoginState_Multiplier = -1436864683;
Client_CompassAngle = 'client.fx';
Client_CompassAngle_Multiplier = -1116838697;
Client_Map_Offset = 'client.df';
Client_Map_Offset_Multiplier = -986795503;
Client_Map_Scale = 'client.dj';
Client_Map_Scale_Multiplier = -1158978579;
Client_Real_Levels = 'client.hx';
Client_MenuActions = 'client.ip';
Client_MenuCount = 'client.ia';
Client_MenuCount_Multiplier = -1031396587;
Client_MenuHeight = 'fz.iv';
Client_MenuHeight_Multiplier = 408425289;
Client_MenuOptions = 'client.is';
Client_MenuWidth = 'af.ir';
Client_MenuWidth_Multiplier = -1702543585;
Client_MenuX = 'co.hs';
Client_MenuX_Multiplier = 1064434231;
Client_MenuY = 'av.hg';
Client_MenuY_Multiplier = 1472619701;
Client_ReflectionMouseX = 'dp.r';
Client_ReflectionMouseX_Multiplier = 2049707531;
Client_ReflectionMouseY = 'dp.e';
Client_ReflectionMouseY_Multiplier = 506036497;
Client_NPCIndices = 'client.bv';
Client_Password = 'al.aq';
Client_Plane = 'cb.hi';
Client_Plane_Multiplier = -1434897979;
Client_Settings = 'ea.z';
Client_Region = 'bb.dr';
Client_GroundHeights = 'e.j';
Client_GroundSettings = 'e.z';
Client_Username = 'al.aw';
Client_Weight = 'client.ja';
Client_Weight_Multiplier = 764550633;
Client_WidgetHeights = 'client.lm';
Client_WidgetNodeTable = 'client.jv';
Client_WidgetPositionsX = 'client.lc';
Client_WidgetPositionsY = 'client.ly';
Client_Widgets = 'em.j';
Client_WidgetSettings = 'ea.y';
Client_WidgetWidths = 'client.la';
Client_isMenuOpen = 'client.hb';
{* CollisionMap - 5 Hooks *}
CollisionMap = 'gn';
CollisionMap_Flags = 'ai';
CollisionMap_Height = 'aj';
CollisionMap_Height_Multiplier = -752880557;
CollisionMap_OffsetX = 'al';
CollisionMap_OffsetX_Multiplier = -2115422721;
CollisionMap_OffsetY = 'af';
CollisionMap_OffsetY_Multiplier = 428578929;
CollisionMap_Width = 'x';
CollisionMap_Width_Multiplier = -843855967;
{* FloorDecorationObject - 6 Hooks *}
FloorDecorationObject = 'co';
FloorDecorationObject_Flags = 'e';
FloorDecorationObject_Flags_Multiplier = 1674008273;
FloorDecorationObject_Hash = 'r';
FloorDecorationObject_Hash_Multiplier = -62010579;
FloorDecorationObject_Plane = 'j';
FloorDecorationObject_Plane_Multiplier = -2029055535;
FloorDecorationObject_Renderable = 'z';
FloorDecorationObject_Get_X = 'y';
FloorDecorationObject_Get_X_Multiplier = 1987689607;
FloorDecorationObject_Get_Y = 'h';
FloorDecorationObject_Get_Y_Multiplier = -344449963;
{* HashTable - 2 Hooks *}
HashTable = 'fo';
HashTable_Nodes = 'z';
HashTable_Size = 'j';
HashTable_Size_Multiplier = 1;
{* Item - 2 Hooks *}
Item = 'w';
Item_ID = 'j';
Item_ID_Multiplier = -1208979173;
Item_StackSize = 'z';
Item_StackSize_Multiplier = 460384345;
{* ItemDefinition - 9 Hooks *}
ItemDefinition = 'au';
ItemDefinition_GroundActions = 'l';
ItemDefinition_ModelColours = 'f';
ItemDefinition_ModelSizeX = 'ay';
ItemDefinition_ModelSizeX_Multiplier = 836976809;
ItemDefinition_ModelSizeY = 'am';
ItemDefinition_ModelSizeY_Multiplier = 1785188107;
ItemDefinition_ModelSizeZ = 'az';
ItemDefinition_ModelSizeZ_Multiplier = 1752736447;
ItemDefinition_Name = 'a';
ItemDefinition_NewModelColours = 'o';
ItemDefinition_InventoryActions = 'w';
ItemDefinition_isMembers = 'p';
{* ItemLayer - 8 Hooks *}
ItemLayer = 'ct';
ItemLayer_BottomRenderable = 'z';
ItemLayer_Height = 'b';
ItemLayer_Height_Multiplier = 1041807905;
ItemLayer_ID = 'k';
ItemLayer_ID_Multiplier = -851268015;
ItemLayer_MiddleRenderable = 'r';
ItemLayer_Plane = 'j';
ItemLayer_Plane_Multiplier = -1875046189;
ItemLayer_TopRenderable = 'e';
ItemLayer_X = 'y';
ItemLayer_X_Multiplier = -1476370387;
ItemLayer_Y = 'h';
ItemLayer_Y_Multiplier = 1489080997;
{* LinkedList - 2 Hooks *}
LinkedList = 'fa';
LinkedList_Head = 'j';
LinkedList_Tail = 'z';
{* Model - 11 Hooks *}
Model = 'cl';
Model_IndicesLength = 'n';
Model_IndicesLength_Multiplier = 1;
Model_IndicesX = 'a';
Model_IndicesY = 'q';
Model_IndicesZ = 'i';
Model_TexturedIndicesX = 'f';
Model_TexturedIndicesY = 'o';
Model_TexturedIndicesZ = 't';
Model_VerticesLength = 'r';
Model_VerticesLength_Multiplier = 1;
Model_VerticesX = 'e';
Model_VerticesY = 'k';
Model_VerticesZ = 'b';
{* ReflectionMouse - 0 Hooks *}
ReflectionMouse = 'dp';
{* Node - 3 Hooks *}
Node = 'gb';
Node_Next = 'ef';
Node_Previous = 'ej';
Node_UID = 'df';
{* NPC - 1 Hooks *}
NPC = 'ai';
NPC_Definition = 'j';
{* NPCDefinition - 4 Hooks *}
NPCDefinition = 'an';
NPCDefinition_Actions = 'v';
NPCDefinition_ID = 'r';
NPCDefinition_ID_Multiplier = -563242523;
NPCDefinition_Level = 'p';
NPCDefinition_Level_Multiplier = -545532659;
NPCDefinition_Name = 'e';
{* ObjectDefinition - 2 Hooks *}
ObjectDefinition = 'av';
ObjectDefinition_Actions = 'af';
ObjectDefinition_Name = 'i';
{* Player - 2 Hooks *}
Player = 'y';
Player_Model = 'f';
Player_Name = 'j';
{* Queue - 1 Hooks *}
Queue = 'fy';
Queue_Head = 'j';
{* Region - 2 Hooks *}
Region = 'cc';
Region_SceneObjects = 'n';
Region_SceneTiles = 'e';
{* Renderable - 1 Hooks *}
Renderable = 'bv';
Renderable_Height = 'cc';
Renderable_Height_Multiplier = -1694915813;
{* WorldObject - 12 Hooks *}
WorldObject = 'cz';
WorldObject_Flags = 'o';
WorldObject_Flags_Multiplier = 2142440351;
WorldObject_Hash = 'f';
WorldObject_Hash_Multiplier = -1448524597;
WorldObject_OffsetX = 'b';
WorldObject_OffsetX_Multiplier = -1773120761;
WorldObject_OffsetY = 'a';
WorldObject_OffsetY_Multiplier = 2041037581;
WorldObject_Orientation = 'e';
WorldObject_Orientation_Multiplier = -940565287;
WorldObject_Plane = 'j';
WorldObject_Plane_Multiplier = -1061781103;
WorldObject_RelativeX = 'k';
WorldObject_RelativeX_Multiplier = -1895767987;
WorldObject_RelativeY = 'n';
WorldObject_RelativeY_Multiplier = -246789625;
WorldObject_Renderable = 'z';
WorldObject_Get_X = 'h';
WorldObject_Get_X_Multiplier = -1521310019;
WorldObject_Get_Y = 'r';
WorldObject_Get_Y_Multiplier = 1563783995;
WorldObject_Height = 'y';
WorldObject_Height_Multiplier = -1852292595;
{* Stream - 2 Hooks *}
Stream = 'de';
Stream_Offset = 'z';
Stream_Offset_Multiplier = -326030699;
Stream_Payload = 'j';
{* StringStorage - 0 Hooks *}
StringStorage = 'eq';
{* SceneTile - 8 Hooks *}
SceneTile = 'ca';
SceneTile_BoundaryObject = 'k';
SceneTile_FloorDecorationObject = 'n';
SceneTile_ItemLayer = 'a';
SceneTile_Plane = 'z';
SceneTile_Plane_Multiplier = -811609317;
SceneTile_WorldObjects = 'i';
SceneTile_WallObject = 'b';
SceneTile_X = 'y';
SceneTile_X_Multiplier = -52645999;
SceneTile_Y = 'h';
SceneTile_Y_Multiplier = -1881681223;
{* WallObject - 11 Hooks *}
WallObject = 'cb';
WallObject_BackupRenderable = 'n';
WallObject_Flags = 'q';
WallObject_Flags_Multiplier = -2025564059;
WallObject_Height = 'r';
WallObject_Height_Multiplier = 314372237;
WallObject_Hash = 'a';
WallObject_Hash_Multiplier = -2032013177;
WallObject_Orientation = 'z';
WallObject_Orientation_Multiplier = -1962180045;
WallObject_Plane = 'j';
WallObject_Plane_Multiplier = 1322146753;
WallObject_RelativeX = 'e';
WallObject_RelativeX_Multiplier = -1087159463;
WallObject_RelativeY = 'k';
WallObject_RelativeY_Multiplier = 1972772869;
WallObject_Renderable = 'b';
WallObject_X = 'y';
WallObject_X_Multiplier = 1067256453;
WallObject_Y = 'h';
WallObject_Y_Multiplier = 918945475;
{* Widget - 28 Hooks *}
Widget = 'em';
Widget_Actions = 'bu';
Widget_ActionType = 'ar';
Widget_ActionType_Multiplier = -2114217435;
Widget_BorderThickness = 'at';
Widget_BorderThickness_Multiplier = 1508056151;
Widget_BoundsIndex = 'dp';
Widget_BoundsIndex_Multiplier = 1967481091;
Widget_Children = 'dm';
Widget_GetItems = 'dl';
Widget_Height = 'u';
Widget_Height_Multiplier = 1561540347;
Widget_GetID = 'f';
Widget_GetID_Multiplier = 1835939729;
Widget_Index = 'o';
Widget_Index_Multiplier = 944922441;
Widget_ItemID = 'dc';
Widget_ItemID_Multiplier = -1973759017;
Widget_ItemStack = 'da';
Widget_ItemStack_Multiplier = -1319886779;
Widget_Name = 'dd';
Widget_Opcodes = 'dk';
Widget_Parent = 'by';
Widget_ParentID = 'p';
Widget_ParentID_Multiplier = 1754166169;
Widget_RelativeX = 'y';
Widget_RelativeX_Multiplier = 2129553153;
Widget_RelativeY = 'm';
Widget_RelativeY_Multiplier = 786087633;
Widget_ScrollX = 'w';
Widget_ScrollX_Multiplier = -405712701;
Widget_ScrollY = 'x';
Widget_ScrollY_Multiplier = -1401783281;
Widget_SpritesX = 'bw';
Widget_SpritesY = 'bo';
Widget_GetStackSizes = 'dr';
Widget_Text = 'bf';
Widget_Type = 'at';
Widget_Type_Multiplier = 1508056151;
Widget_Width = 'v';
Widget_Width_Multiplier = 1887184409;
Widget_X = 'g';
Widget_X_Multiplier = 1271518477;
Widget_Y = 's';
Widget_Y_Multiplier = -1124070965;
Widget_isHidden = 'l';
{* WidgetNode - 1 Hooks *}
WidgetNode = 'h';
WidgetNode_ID = 'j';
WidgetNode_ID_Multiplier = 393106341;
My Java implementation of A-Star:
And the A-Star node:Code:package com.cheddy.bot.api; import java.awt.Point; import java.util.ArrayList; import java.util.Collections; public class AStar { static final int BLOCKED = 1; static final int NON_WALKABLE = 256; static final int BLOCKED_WEST = 128; static final int BLOCKED_EAST = 8; static final int BLOCKED_NORTH = 2; static final int BLOCKED_SOUTH = 32; public static Path generatePath(Client client, Point finish, boolean finishOnPoint) throws TileUnreacheableException{ return new Path(client, generateShortestPath(client, client.getMyPlayer().getPosition().get2DLocalCoord(), new Point(finish.x - client.getBaseX(), finish.y - client.getBaseY()) , finishOnPoint)); } public static int getFlags(Client client, Point position){ int[][] map = client.getLocalFlags(); if(map == null){ return -1; } if(position.x > map.length|| position.y > map[0].length){ return -1; } return map[position.x][position.y]; } private static Point[] generateShortestPath(Client client, Point start, Point finish, boolean finishOnPoint) throws TileUnreacheableException{ int[][] map = client.getLocalFlags(); if(map == null){ return null; } if(start.x > map.length || finish.x > map.length || start.y > map[0].length || finish.y > map[0].length || start.x < 0 || start.y < 0 || finish.x < 0 || finish.y < 0){ return null; } if(!isWalkable(map[finish.x][finish.y]) && finishOnPoint){ System.out.println("Destination is unwalkable"); return null; } ArrayList<AStarNode> openList = new ArrayList<AStarNode>(); ArrayList<AStarNode> closedList = new ArrayList<AStarNode>(); for(int i = 0; i < map.length; i++){ for(int i1 = 0; i1 < map.length; i1++){ if(!isWalkable(map[i][i1])){ AStarNode n = new AStarNode(null, i, i1, map[i][i1], finish, map, finishOnPoint); closedList.add(n); } } } openList.add(new AStarNode(null, start.x, start.y, map[start.x][start.y], finish, map, finishOnPoint)); while (openList.size() > 0){ Collections.sort(openList); AStarNode current = openList.get(0); if(current.x == finish.x && current.y == finish.y || (current.x + 1 == finish.x && current.y == finish.y && !finishOnPoint) || (current.x - 1 == finish.x && current.y == finish.y && !finishOnPoint) || (current.x == finish.x && current.y + 1 == finish.y && !finishOnPoint) || (current.x == finish.x && current.y - 1 == finish.y && !finishOnPoint)){ return retracePath(client, current); } openList = current.getNeighbours(openList, closedList); openList.remove(current); closedList.add(current); } System.out.println("No Path!"); throw new TileUnreacheableException(); } private static Point[] retracePath(Client client,AStarNode current) { int baseX = client.getBaseX(); int baseY = client.getBaseY(); ArrayList<Point> points = new ArrayList<Point>(); points.add(new Point(current.x + baseX, current.y + baseY)); while(current.parent != null){ current = current.parent; points.add(new Point(current.x + baseX, current.y + baseY)); } Point[] p = new Point[points.size()]; p = points.toArray(p); return p; } @SuppressWarnings("unused") private static Point[] reverseArray(Point[] arr){ if(arr == null){ return null; } for(int i = 0; i < arr.length / 2; i++) { Point temp = arr[i]; arr[i] = arr[arr.length - i - 1]; arr[arr.length - i - 1] = temp; } return arr; } public static boolean isWalkable(int flag){ return (flag & (NON_WALKABLE)) == 0; } public static boolean isNotBlockedNorth(int flag, int flag2){ if(!isWalkable(flag2)){ return false; } return (flag & BLOCKED_NORTH) == 0; } public static boolean isNotBlockedWest(int flag, int flag2){ if(!isWalkable(flag2)){ return false; } return (flag & BLOCKED_WEST) == 0; } public static boolean isNotBlockedEast(int flag, int flag2){ if(!isWalkable(flag2)){ return false; } return (flag & BLOCKED_EAST) == 0; } public static boolean isNotBlockedSouth(int flag, int flag2){ if(!isWalkable(flag2)){ return false; } return (flag & BLOCKED_SOUTH) == 0; } public static boolean isNotBlockedSouthWest(int northeast, int northwest, int southeast, int southwest){ return ((southwest & (NON_WALKABLE | BLOCKED)) == 0) && ((northeast & (NON_WALKABLE | BLOCKED | BLOCKED_WEST)) == 0) && ((northeast & (NON_WALKABLE | BLOCKED | BLOCKED_SOUTH)) == 0) && ((northwest & (NON_WALKABLE | BLOCKED | BLOCKED_SOUTH)) == 0) && ((southeast & (NON_WALKABLE | BLOCKED | BLOCKED_WEST)) == 0); } public static boolean isNotBlockedSouthEast(int northwest, int northeast, int southwest, int southeast){ return ((southeast & (NON_WALKABLE | BLOCKED)) == 0) && ((northwest & (NON_WALKABLE | BLOCKED | BLOCKED_EAST)) == 0) && ((northwest & (NON_WALKABLE | BLOCKED | BLOCKED_SOUTH)) == 0) && ((northeast & (NON_WALKABLE | BLOCKED | BLOCKED_SOUTH)) == 0) && ((southwest & (NON_WALKABLE | BLOCKED | BLOCKED_EAST)) == 0); } public static boolean isNotBlockedNorthEast(int southwest, int southeast, int northwest, int northeast){ return ((northeast & (NON_WALKABLE | BLOCKED)) == 0) && ((southwest & (NON_WALKABLE | BLOCKED | BLOCKED_EAST)) == 0) && ((southwest & (NON_WALKABLE | BLOCKED | BLOCKED_NORTH)) == 0) && ((southeast & (NON_WALKABLE | BLOCKED | BLOCKED_NORTH)) == 0) && ((northwest & (NON_WALKABLE | BLOCKED | BLOCKED_EAST)) == 0); } public static boolean isNotBlockedNorthWest(int southeast, int southwest, int northeast, int northwest){ return ((northwest & (NON_WALKABLE | BLOCKED)) == 0) && ((southeast & (NON_WALKABLE | BLOCKED | BLOCKED_WEST)) == 0) && ((southeast & (NON_WALKABLE | BLOCKED | BLOCKED_NORTH)) == 0) && ((southwest & (NON_WALKABLE | BLOCKED | BLOCKED_NORTH)) == 0) && ((northeast & (NON_WALKABLE | BLOCKED | BLOCKED_WEST)) == 0); } }
Code:package com.cheddy.bot.api; import java.awt.Point; import java.util.ArrayList; public class AStarNode implements Comparable<AStarNode>{ int f,g,h,x,y,flags; AStarNode parent; Point finish; int[][] map; boolean fop; public AStarNode(AStarNode parent, int x, int y, int flags, Point finish, int[][] map, boolean finishOnPoint) { this.parent = parent; this.x = x; this.y = y; this.flags = flags; if(parent != null){ if(parent.x != x && parent.y != y){ this.g = parent.g + 14; }else{ this.g = parent.g + 10; } }else{ this.g = 0; } this.h = (Math.abs(x - finish.x) + Math.abs(y - finish.y)); this.f = h + g; this.finish = finish; this.map = map; this.flags = map[x][y]; this.fop = finishOnPoint; } @Override public int compareTo(AStarNode o) { return this.f - o.f; } public final ArrayList<AStarNode> getNeighbours(final ArrayList<AStarNode> arrayOpen, final ArrayList<AStarNode> arrayClosed){ if(x - 1 > -1){ if(AStar.isNotBlockedWest(flags, map[x - 1][y])){ AStarNode n = new AStarNode(this, x - 1, y, map[x - 1][y], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } if(x + 1 < map.length){ if(AStar.isNotBlockedEast(flags, map[x + 1][y])){ AStarNode n = new AStarNode(this, x + 1, y, map[x + 1][y], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } if(y - 1 > -1){ if(AStar.isNotBlockedSouth(flags, map[x][y - 1])){ AStarNode n = new AStarNode(this, x, y - 1, map[x][y - 1], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } if(y + 1 < map[x].length){ if(AStar.isNotBlockedNorth(flags, map[x][y + 1])){ AStarNode n = new AStarNode(this, x, y + 1, map[x][y + 1], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } ////// if(x - 1 > -1 && y - 1 > -1){ AStarNode n; if(AStar.isNotBlockedSouth(flags, map[x][y - 1]) && AStar.isNotBlockedSouth(map[x - 1][y], map[x - 1][y - 1]) && AStar.isNotBlockedWest(flags, map[x - 1][y]) && AStar.isNotBlockedWest(map[x][y - 1], map[x - 1][y - 1])){ n = new AStarNode(this, x - 1, y - 1, map[x - 1][y - 1], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } if(x + 1 < map.length && y + 1 < map[x].length){ AStarNode n; if(AStar.isNotBlockedNorth(flags, map[x][y + 1]) && AStar.isNotBlockedNorth(map[x + 1][y], map[x + 1][y + 1]) && AStar.isNotBlockedEast(flags, map[x + 1][y]) && AStar.isNotBlockedEast(map[x][y + 1], map[x + 1][y + 1])){ n = new AStarNode(this, x + 1, y + 1, map[x + 1][y + 1], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } if(y - 1 > -1 && x + 1 < map.length){ AStarNode n; if(AStar.isNotBlockedSouth(flags, map[x][y - 1]) && AStar.isNotBlockedSouth(map[x + 1][y], map[x + 1][y - 1]) && AStar.isNotBlockedEast(flags, map[x + 1][y]) && AStar.isNotBlockedEast(map[x][y - 1], map[x + 1][y - 1])){ n = new AStarNode(this, x + 1, y - 1, map[x + 1][y - 1], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } if(x - 1 > -1 && y + 1 < map[x].length){ AStarNode n; if(AStar.isNotBlockedNorth(flags, map[x][y + 1]) && AStar.isNotBlockedNorth(map[x - 1][y], map[x - 1][y + 1]) && AStar.isNotBlockedWest(flags, map[x - 1][y]) && AStar.isNotBlockedWest(map[x][y + 1], map[x - 1][y + 1])){ n = new AStarNode(this, x - 1, y + 1, map[x - 1][y + 1], finish, map, fop); if(listNotContain(n, arrayOpen, arrayClosed)){ arrayOpen.add(n); } } } return arrayOpen; } private static boolean listNotContain(AStarNode node, final ArrayList<AStarNode> arrayOpen, final ArrayList<AStarNode> arrayClosed){ for(AStarNode n : arrayOpen){ if(n.x == node.x && n.y == node.y){ return false; } } for(AStarNode n : arrayClosed){ if(n.x == node.x && n.y == node.y){ return false; } } return true; } }
getting
the line of the errorError: divide by Zero at line 165
The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap]
Simba Code:function R_GetMaxHealth: extended;
var
Me: Integer;
begin
Me := SmartGetFieldObject(SmartCurrentTarget, 0, client_player);
Result := (SmartGetFieldInt(SmartCurrentTarget, me, Actor_maxHealth) * Actor_maxHealth_Multiplier);
SmartFreeObject(SmartCurrentTarget, me);
end;
(*
R_GetHealthPercent
~~~~~~~~~~~
.. code-block:: pascal
function R_GetHealthPercent: integer;
Returns the Current health percentage of player.
.. note::
by elfyyy
*)
<------------------------- ERROR HERRE ------------------>
function R_GetHealthPercent: extended;
begin
if R_GetHealth = 0 then
begin
Result := 100;
exit;
end;
Result := Round((R_GetHealth / R_GetMaxHealth) * 100);
end;
piece of code where it happens:
Simba Code:Writeln(R_GetHealth);
if(R_GetHealthPercent < 75)then // probably from this
begin
if((R_InvCount) = 1)then
exit;
//GOBANK - - - --
Edit: appearently this error stops after the first combat happened with someone/something.
Last edited by Tickyy; 06-29-2014 at 07:28 PM.
You could probably check gameobjects and wall/boundary objects for some simple obstacle detection..
Thanks to everyone for supporting Reflection We hope you are all having fun!
Great work reporting issues, We'll do our best to fix everything in a timely fashion.
The solvers in F_Randoms rely on 2 custom hooks which have been written into the script (so they are probably outdated).. These hooks are hard to add to the updater b/c I need to know what they were for multiple revisions and they're not listed at JH. I also wanted to see if we could use existing hooks for some kinda unique count on a character model (I saw a java bot only counting the X verticies to do this)
Update:
Modified R_GetMaxHealth to use the skill array (max_health hook might be obsolete b/c it was correct). Works correctly.
Added an extra failsafe to R_GetHealthPercent anyway..
New function R_RotateCameraToTile(Tile: Tpoint): Boolean;
Last edited by Krazy_Meerkat; 06-30-2014 at 04:14 AM.
I wrote that kind of functionality for, I think it was @Tickyy; maybe he could share it since I didn't save it.
There used to be something meaningful here.
Something still isn't right with the hooks. How can I find which is I being used and wrong?
Solar from RiD.
Well then @Frement is wrong i wasn't that person he thought he talked to, we actually did talk a little in irc, but not about npc's... at least that is what i remember.
Edit: well describe the problem more in detail and maybe, we can work on it together.
Last edited by Tickyy; 06-30-2014 at 01:44 PM.
Last bot I worked on we created a model checksum that you could find any in game entity using instead of it's id. It worked something along the lines of: for every vertices add the x, y and z together. Then for each of the summations add the previous one with a few bitwise operators. Then turn the final number to a hex string. If I can find the code we used I'll post it.
Edit:
trianglesX, trianglesY, trianglesZ were badly named fields containing the vertices. I can't guarantee how persistant this will be across different client instances but it seemed to work in testing.Code:private void calculateChecksum() { int[] vertices = new int[trianglesX.length]; for (int i = 0; i < trianglesX.length; i++) { vertices[i] = trianglesX[i] + trianglesZ[i] + trianglesY[i]; } if (vertices.length != 0) { long sum = vertices[0]; long tmp; for (int i = 1; i < trianglesX.length; i++) { tmp = vertices[i]; tmp = (sum >> 29) + tmp; tmp = (sum >> 17) + tmp; sum = (sum << 3) ^ tmp; } checksum = sum; } }
Last edited by Cov; 06-30-2014 at 04:43 PM.
Loving the new angle functions like R_RotateCameraToTile and R_MakeCompass, but is it possible to have the srl function SetAngle(); into reflection, it can really speed up things as the SetAngle(0); function just holds down the the up key for 2.5 seconds.
Heres a nice function I made
Simba Code:function R_TryMakeTileOnMS(tile:TPoint;time:integer;reset:boolean):boolean;
var FailSafeTime : integer;
ResetAngle, ResetHeight : extended;
begin
if(reset)then begin
ResetAngle := R_GetMinimapAngleDeg;
ResetHeight := R_GetCameraZ;
end;
markTime(FailSafeTime);
while((TimeFromMark(FailSafeTime) < time) and (not PointInBox(R_TileToMS(tile), MSBox))) do begin
R_RotateCameraToTile(tile);
if(not PointInBox(R_TileToMS(tile), MSBox)) then begin
keyDown(VK_Down);
sleep(100+random(50));
keyUp(VK_Down);
end;
end;
if(PointInBox(R_TileToMS(tile), MSBox))then begin
Result := true;
end else begin
Result := false;
end;
if(reset)then begin
R_MakeCompass(ResetAngle);
markTime(FailSafeTime);
while((TimeFromMark(FailSafeTime) < time) and (abs(R_GetCameraZ - ResetHeight) > 100))do begin
keyDown(VK_Up);
sleep(100+random(50));
keyUp(VK_Up);
end;
end;
end;
It'll try and make the tile appear on the mainscreen. It'll return true if it found the tile. You can also reset your compass angle and height.
https://github.com/Brandon-T/GLX/blo.../Math.cpp#L251
Same algo?
Not sure if that algo will be ideal in Simba though. A model can have tons of vertices and the amount of calls you might have to make to get them all could be a lot to ask SMART for?
Last edited by Brandon; 07-01-2014 at 12:25 AM.
I am Ggzz..
Hackintosher
Frement and I tried to get some npc model info from smart yesterday and it's not looking good.. Frement found that, for the npcs, their model is returned from a method using the Index/NpcID as arguments.. So b/c they use a method and not a variable, we don't have access to it
That being said.. There are TransformIds which we can access.. I'll try and add some new hooks to the updater later on today (and update the broken ones).. It can be a lengthy process..
Welcome Cov and thanks Are you the same Cov from JH?
Last edited by Krazy_Meerkat; 07-01-2014 at 06:26 AM.
Aye looks to be the same, I think @_Rick stuck it in our model code so would have to ask him where he got it from. On the lower definition models of osrs I don't think it would be all that much work, with 5-6 npc's on screen at the same time it wasn't doing all that much work and you only really have to call it once per model. It was the centroid and concave hull stuff that we had for the models that was probably a tad strenuous for a java based bot.
Thanks and yeh I'm the same Cov from JH.
I've not really delved into the source all that much, but surely it's not too hard to invoke a method using reflection. You should be able to handle the model object then?
Every time I try to run a script that uses reflections, I get the following error:
Exception in Script: Operator expected at line 394, column 26 in file "C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba"
You will have to re-download the include from here: https://code.google.com/p/osrreflection/source/browse/ if you're having this problem.. Just fixed the missing operators although not too sure why only you had this problem with R_InPolygon..
Does anyone have problems with R_Walkpath when you start it in the middle of the path? Sometimes it will walk towards the opposite direction of the destination first, and sometimes it couldn't find path.
Aye seems to be the same algo, I'd have to ask _Rick where he got it from though as he was the one that put it in. I think with osrs it would be fine because the models don't have many faces/vertices and you never really see more than 7-8 npc's on screen at once, that and you would only have to get the checksum once.
Can't you add in the ability to invoke methods in SMART? Shouldn't be all that hard?
Thanks! Yes I am that Cov
I was having problems with 'R_SortNPCs(R_GetNpcs(NpcID));' because it'll return nothing for an array even though there very well it should return something.
An easy fix was using R_GetAllNpcs and filter that array out.
EDIT: wait. Im getting nothing with R_GetAllNPCs now... It only works after I restart the script...
Now after a reset...
This seems like its occurring once you try R_GetAllNpcs, leave the area and try it again.
Thanks ineedbot, I'll take a look at it now.. The way it was originally set up was so that you could leave the area, come back and the npc's would still be in the array.
Edit: Ok I've found some problems with it.. Elfyyy had changed the way R_LoadNpcIndexEx works when he added R_GetAllNpcs so that no new Npc's would be added to the localindex.. The problem is fixed now.. Be aware that if you're using R_GetAllNpcs, there will always be a lag spike (because no npc has been specified, it will refresh the whole array).
Last edited by Krazy_Meerkat; 07-03-2014 at 09:33 AM.
After the update, R_FindNormalRandoms takes one or two seconds to check for randoms, making scripts run slower when it is in a loop.
indeed, and it does false detections, it says that it has detected the frog random, without actually happening or frog being near, meaning that the last changes you've made @Krazy_Meerkat about the npc's wasn't a good idea..
There are currently 2 users browsing this thread. (0 members and 2 guests)