balliztik1 Posted September 1, 2009 Author Share Posted September 1, 2009 This fix applies to all releases of EE that contain custom menus.This isn't really a fix so much as a way around an annoyance with the current Custom Menu arrays. As it is, when calling a custom label, button, or picture onto your menu, the client checks the index number versus the upper bounds of the array. While this works if you specifically call the elements in order, the client will crash if you do not. Here's how I worked around that.Somewhere in the client source (I chose modGeneral), add this function:```Public Function IsInArray(CtrlArray As Variant, Index As Integer) As Boolean On Error Resume Next Dim x As String x = CtrlArray(Index).name If Err.Number = 0 Then IsInArray = TrueEnd Function```This is a function I found [here](http://www.vbforums.com/showthread.php?t=180280), and Edneeis should be credited for it, not me. It checks if the control array exists by means of trapping errors. This way, you can pinpoint if the element you are trying to create exists rather than assuming so based on the UBound.Now, simply replace the following lines (from the client's modHandleData) with the new function:``` If CustomIndex > frmCustom1.picCustom.UBound Then Load frmCustom1.picCustom(CustomIndex) End If```Becomes:``` If Not IsInArray(frmCustom1.picCustom, CInt(CustomIndex)) Then Load frmCustom1.picCustom(CustomIndex) End If```Do this for text boxes, labels, and pictures.Now, you can create your elements in whatever order you desire without fear of client crashing. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted September 1, 2009 Share Posted September 1, 2009 I feel so happy, thank you! :azn: Link to comment Share on other sites More sharing options...
balliztik1 Posted September 1, 2009 Author Share Posted September 1, 2009 @Ã…ÃÂüiÑÂôζ:> I feel so happy, thank you! :azn:That makes two of us. I had the hardest time testing out my first custom menu script. xD Now it's done. =D Link to comment Share on other sites More sharing options...
Zamin Posted September 1, 2009 Share Posted September 1, 2009 This edit is purly server right? I mean, both these edits are done on the server side, or client? Sorry. Link to comment Share on other sites More sharing options...
damian666 Posted September 1, 2009 Share Posted September 1, 2009 client mate, because the handling of custom menu's is client sided ^^Damian666 Link to comment Share on other sites More sharing options...
balliztik1 Posted September 1, 2009 Author Share Posted September 1, 2009 Oops, forgot to specify. I'll edit the main post. Link to comment Share on other sites More sharing options...
Zamin Posted September 2, 2009 Share Posted September 2, 2009 AWESOME!!!!!! Custom menu's with no error!!! Thanks a billion :)Although I did have to put spaces here and there. Code psoted above is kinda all together.RX: OnErrorResumeNextShould be: On Error Resume NextRight? Just saying if someone with no VB knowledge wants to add this edit.Anyways, thanks once again. You just saved my life. ;) Link to comment Share on other sites More sharing options...
balliztik1 Posted September 2, 2009 Author Share Posted September 2, 2009 @Zamin:> AWESOME!!!!!! Custom menu's with no error!!! Thanks a billion :)> > Although I did have to put spaces here and there. Code psoted above is kinda all together.> RX: OnErrorResumeNext> Should be: On Error Resume Next> > Right? Just saying if someone with no VB knowledge wants to add this edit.> > Anyways, thanks once again. You just saved my life. ;)Hmmm…it looks all together to me. I copied and pasted it and it was fine. Link to comment Share on other sites More sharing options...
Zamin Posted September 2, 2009 Share Posted September 2, 2009 Then its just me then. lolAnyways, for the third time. Awesome edit. Probably the most useful one in this entire database. xD Link to comment Share on other sites More sharing options...
killerloader Posted December 31, 2009 Share Posted December 31, 2009 i search for If CustomIndex > frmCustom1.picCustom.UBound Then Load frmCustom1.picCustom(CustomIndex) End Ifin modHandleData.basbut it cannot be found?????????????? Link to comment Share on other sites More sharing options...
razorjin Posted January 23, 2010 Share Posted January 23, 2010 i cant find that custom bla bla bla! where can i find it.did i do something wrong.i followed all the instructions correctly Link to comment Share on other sites More sharing options...
Sealbreaker Posted January 23, 2010 Share Posted January 23, 2010 thank you so much! :kiss:AWESOME!!!-seal Link to comment Share on other sites More sharing options...
Toxikr3 Posted January 30, 2010 Share Posted January 30, 2010 EDIT: HM….. I posted in wrong post -_-Please move this to the Quest Log + Quest Script post please.... weird...Hi, I have tried this with 2.8 and for some reason it will not work.I did the array fix and followed the tutorial but it won't work.I try to press PG Down and nothing pops up. I have checked the hot script and I have this```' Executes when a hotkey is pressed client-side.Sub HotScript(Index, KeyID) Select Case KeyID ' Executes when any player presses the PageUp key. Case 1 ' Executes when any player presses the Delete key. Case 2 ' Executes when players press the End key. Case 3 ' Executes when players press the PageDown key. Case 4'***********************Begin Quest Log***********************Dim QuestCountDim QuestYCoordDim IndexCountDim QuestQuestCount = 1QuestYCoord = 50IndexCount = 1Call CustomMenuClose(Index)Call CustomMenuShow(Index, "QuestLog", "\GUI\CUSTOM\QuestExtra\QuestLog.gif", 1)Call CustomMenuLabel(Index, 0, "Close!", 150, 280, 8, 4, 0, 40, 15) Do While QuestCount <= Int(GetVar("\Scripts\Quests\QuestSystem.ini", "QUESTS", "Amount")) Quest = GetVar("Scripts\Quests\QuestDatabase\" & GetPlayerName(Index) & ".ini", "QUESTS", "Quest" & QuestCount) If Quest = 1 Then Call CustomMenuPicture(Index, IndexCount, "\GUI\CUSTOM\QuestExtra\Quest" & QuestCount & "Accepted.gif", 3, QuestYCoord) QuestYCoord = QuestYCoord + 25 ElseIf Quest = 2 Then Call CustomMenuPicture(Index, IndexCount+1, "\GUI\CUSTOM\QuestExtra\Quest" & QuestCount & "Completed.gif", 3, QuestYCoord) QuestYCoord = QuestYCoord + 25 End If IndexCount = IndexCount + 2 QuestCount = QuestCount + 1 LoopExit Sub'***********************End Quest Log*********************** End SelectEnd Sub```This shouldn't even be connect to other stuff right? Just the popng up of the menu?Also when I type /questreset name numberIt says this command doesn't exists```' Executed whenever a slash command is sent to the server.Sub Commands(Index) Dim TextSay Dim PlayerID Dim MapNum ' Get the command and arguments from the cache. TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index)) ' Split the command into an array. All arguments are seperated by spaces. TextSay = Split(TextSay) Select Case TextSay(0) Case "/testscripts" Call TestMain(Index) Exit Sub Case "/help" Call PlayerMsg(Index, "Social Commands:", WHITE) Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE) Call PlayerMsg(Index, "-msghere = Emote Message", WHITE) Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE) Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE) Exit Sub Case "/calladmins" If GetPlayerAccess(Index) = 0 Then Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN) Else Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN) End If Exit Sub Case "/admin" If GetPlayerAccess(Index) > 0 Then Call PlayerMsg(Index, "Social Commands:", WHITE) Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE) Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE) Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE) End If Exit Sub Case "/warpmeto" If GetPlayerAccess(Index) > 0 Then PlayerID = FindPlayer(TextSay(1)) If PlayerID > 0 Then Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID)) Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN) Else Call PlayerMsg(Index, "Player is not online.", WHITE) End If End If Exit Sub Case "/warptome" If GetPlayerAccess(Index) > 0 Then PlayerID = FindPlayer(TextSay(1)) If PlayerID > 0 Then Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index)) Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN) Else Call PlayerMsg(Index, "Player is not online.", WHITE) End If End If Exit Sub Case "/warpto" If GetPlayerAccess(Index) > 0 Then MapNum = TextSay(1) If MapNum > 0 And MapNum <= MAX_MAPS Then Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index)) Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE) Else Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED) End If End If Exit Sub'***********************Begin Quest***********************Case "/questreset" If GetPlayerAccess(Index) >= 5 Then Dim QuestCount Dim PlayerName Dim QuestName Dim CheckName QuestCount = 1 PlayerName = TextSay(1) QuestName = Lcase(TextSay(2)) CheckName = QuestReset(index, PlayerName) If CheckName = "EndOfFile" Then Call PlayerMsg(Index, "The player '" & PlayerName & "' does not exit!", RED) Exit Sub ElseIf QuestName = "all" Then Do While QuestCount <= Int(GetVar("\Scripts\Quests\QuestSystem.ini", "QUESTS", "Amount")) Call PutVar("\Scripts\Quests\QuestDatabase\" & PlayerName & ".ini", "QUESTS", "Quest" & QuestCount, 0) QuestCount = QuestCount + 1 Loop Call PlayerMsg(Index, "All quests for player " & PlayerName & " has been reset.", BLACK) ElseIf Int(QuestName) > Int(GetVar("\Scripts\Quests\QuestSystem.ini", "QUESTS", "Amount")) OR Int(QuestName) = 0 Then Call PlayerMsg(Index, "Quest" & QuestName & " does not exist. Perhaps check the 'Amount' of your total quests set in QuestSystem.ini", RED) Else Call PutVar("\Scripts\Quests\QuestDatabase\" & PlayerName & ".ini", "QUESTS", "Quest" & QuestName, 0) Call PlayerMsg(Index, "Quest" & QuestName & " for player " & PlayerName & " has been reset.", BLACK) End If Else Call PlayerMsg(Index, "You do not have enough access to use this command.", BRIGHTGREEN) End IfExit Sub'***********************End Quest*********************** End Select Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)End Sub```I think I have done everything right… :(Help please-Toxikr3 Link to comment Share on other sites More sharing options...
furtzown Posted August 21, 2010 Share Posted August 21, 2010 im so noob with visual basic and I really want to fix it :( could some1 please send me a fixed client.exe please!!or at least tell me what i gotta do with this =/> Do this for text boxes, labels, and pictures. Link to comment Share on other sites More sharing options...
furtzown Posted August 21, 2010 Share Posted August 21, 2010 please? :P 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