troglodite Posted July 4, 2013 Author Share Posted July 4, 2013 Ok so… sometimes, when I enter to a house (with a warp tile), the client crashes!And gives me that line of code:```If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) Then```I searched into this site forum and there are other people with the same problem, and I only saw 1 solution to it, [in that thread](http://www.eclipseorigins.com/community/index.php?/topic/132706-engine-crashes-on-warpoccasionally/?hl=%2Bisdirblocked%28map.tile%28getplayerx%28myindex%29%2C+%2Bgetplayery%28myindex%29%29.dirblock%2C+%2Bdirection+%2Bthen), the last post made by **escfoe2** And I added it, and when I run the client with VB, my client do not crashes; BUT when I simply run the client.exe with double click… CRASHES!So I think that this solution does not work at all...Can somebody help me with that?? PLEASEI am really frustrated about this error! Its VERY annoying :(This is my actual CheckDirection function```Function CheckDirection(ByVal Direction As Byte) As BooleanDim x As LongDim y As LongDim i As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler CheckDirection = False ' check directional blocking If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) Then CheckDirection = True Exit Function End If Select Case Direction Case DIR_UP x = GetPlayerX(MyIndex) y = GetPlayerY(MyIndex) - 1 Case DIR_DOWN x = GetPlayerX(MyIndex) y = GetPlayerY(MyIndex) + 1 Case DIR_LEFT x = GetPlayerX(MyIndex) - 1 y = GetPlayerY(MyIndex) Case DIR_RIGHT x = GetPlayerX(MyIndex) + 1 y = GetPlayerY(MyIndex) End Select ' Check to see if the map tile is blocked or not If Map.Tile(x, y).Type = TILE_TYPE_BLOCKED Then CheckDirection = True Exit Function End If ' Check to see if the map tile is tree or not If Map.Tile(x, y).Type = TILE_TYPE_RESOURCE Then CheckDirection = True Exit Function End If ' Check to see if the key door is open or not If Map.Tile(x, y).Type = TILE_TYPE_KEY Then ' This actually checks if its open or not If TempTile(x, y).DoorOpen = NO Then CheckDirection = True Exit Function End If End If ' Check to see if a player is already on that tile For i = 1 To Player_HighIndex If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then If GetPlayerX(i) = x Then If GetPlayerY(i) = y Then CheckDirection = True Exit Function End If End If End If Next i ' Check to see if a npc is already on that tile For i = 1 To Npc_HighIndex If MapNpc(i).num > 0 Then If MapNpc(i).x = x Then If MapNpc(i).y = y Then CheckDirection = True Exit Function End If End If End If Next ' Error handler Exit Functionerrorhandler: HandleError "checkDirection", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit FunctionEnd Function```Thx for reading anyway :) Link to comment Share on other sites More sharing options...
abhi2011 Posted July 4, 2013 Share Posted July 4, 2013 The name of the error? The error number? The value of the variables? Link to comment Share on other sites More sharing options...
troglodite Posted July 4, 2013 Author Share Posted July 4, 2013 > The name of the error? The error number? The value of the variables?Run Time Error 9 - Subscript out of rangeMyIndex = 1Direction = 2**CheckDirection**= FalseWhere must be TrueI think: If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) Then **CheckDirection** = True Exit Function End IfIn the map where I enter there are some blocks, but far away from the entry… like 10 tiles far awaythx for collaboration Abhi :) Link to comment Share on other sites More sharing options...
abhi2011 Posted July 5, 2013 Share Posted July 5, 2013 ~~The line~~~~ CheckDirection = True~~~~has the error?~~Hover over each var. Tell us the var which has the value of Subscript Out of Range. Link to comment Share on other sites More sharing options...
troglodite Posted July 5, 2013 Author Share Posted July 5, 2013 I found that!MapNpc(i).num = MapNpc(i).x = MapNpc(i).y = From:``` ' Check to see if a npc is already on that tile For i = 1 To Npc_HighIndex If MapNpc(i).num > 0 Then If MapNpc(i).x = x Then If MapNpc(i).y = y Then CheckDirection = True Exit Function End If End If End If Next``` Link to comment Share on other sites More sharing options...
abhi2011 Posted July 5, 2013 Share Posted July 5, 2013 I meant from within the line of code that errors. Link to comment Share on other sites More sharing options...
troglodite Posted July 5, 2013 Author Share Posted July 5, 2013 > I meant from within the line of code that errors.If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) ThenMyIndex = 1Direction = 2that??:huh: Link to comment Share on other sites More sharing options...
troglodite Posted July 11, 2013 Author Share Posted July 11, 2013 A friend made a fix and I think it works, because I get no more this bug using warpsI paste this``` If Map.MaxX < GetPlayerX(MyIndex) Or Map.MaxY < GetPlayerY(MyIndex) Then Exit Function End If```Just below this```Function CheckDirection(ByVal Direction As Byte) As BooleanDim x As LongDim y As LongDim i As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler CheckDirection = False```If somebody have this problem, try this fix :)credits goes to my friend Joan! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now