Post Reply Home » Forums » MMO Forums » EverQuest 2 » EverQuest 2 Premium Discussions

Window buttons make script very unstable - wyv - help! : EverQuest 2 Premium Discussions

Posted: February 12th, 2005
richyrich
Ok - I was putting the finishing touches on the v1 of the EQ2Megabot buffbot and added a few buttons to help with some things you can do while the script is running and all heck broke loose! My script was crashing all over the place, to the desktop - very frustrating.

After several hours this morning tracking it down, it appears to be the buttons causing the issue, and as usual, when I find a problem, I try to simply it and reproduce it consistently, which I have.

Below is a very simple script, it just pops up a window with a counter and a Quit button. The Quit functionality is commented out as actually quitting doesn't show the issue.

Wyv - can you please run this script and see if you can find out what is making the buttons so unstable. To make it crash consistently, simply run the script, hit the Quit Button (which does nothing right now) a few times, then hit F1, F2, F1, F2, and shortly it will crash.

When I use these functions in EQ2MegaBot - the script crashes almost immediatly after you hit a button - not good.

I know it has something to do with the handler, but I have reviewed all sample code I can find from the site and it looks like I'm doing everything right.

If you don't ever hit the Quit button, everything is good, you can't make it crash. Seems to me like some memory error with the handler, but I'm stumped.

Here is the code:

Code: Register to unlock hidden link

Dim QuitNow

Sub StatusBar(sTxt)
	objStatusWindow.SetStatusBar(sTxt)
End Sub

Class QuitButtonHandlerClass
	Public Function Accepted(nID)
		StatusBar("QUITTING!!")
		'QuitNow = TRUE
	End Function
End Class

' =============================================================
' =============================================================

Class OutputStatusWindowClass

	Private bQuit
	Private Window  	'The Script Window
	Private StatusBar
	Private szSchema
	Private handler 	' Handles button press

	Private Sub Class_Initialize()
		szSchema = ""
		szSchema = szSchema & "<?xml version=""1.0""?>										" + vbCrlf 
		szSchema = szSchema & "<XML ID=""XUInterfaceDefinitionLanguage"">					" + vbCrlf 
		szSchema = szSchema & "  <Schema xmlns=""XUnleashedData"" xmlns:dt=""XUnleashedDataTypes""/>  " + vbCrlf 
		szSchema = szSchema & "  <Window>													" + vbCrlf 
		szSchema = szSchema & "    <Title>MessageBox</Title>								" + vbCrlf 
		szSchema = szSchema & "    <Left>500</Left>											" + vbCrlf 
		szSchema = szSchema & "    <Top>20</Top>											" + vbCrlf 
		szSchema = szSchema & "    <Height>100</Height>										" + vbCrlf 
		szSchema = szSchema & "    <Width>400</Width>										" + vbCrlf 
		szSchema = szSchema & "    <DrawBackground>TRUE</DrawBackground>					" + vbCrlf 
		szSchema = szSchema & "    <CloseBox>FALSE</CloseBox>								" + vbCrlf 
		szSchema = szSchema & "    <Container>												" + vbCrlf 
		szSchema = szSchema & "      <DefaultControlContainer>								" + vbCrlf 
		szSchema = szSchema & "    	<Control>												" + vbCrlf 
		szSchema = szSchema & "    	    <StaticText>										" + vbCrlf 
		szSchema = szSchema & "    			<Name>StatusBar</Name>							" + vbCrlf 
		szSchema = szSchema & "    			<Location>											" + vbCrlf 
		szSchema = szSchema & "    		  		<X>5</X>											" + vbCrlf 
		szSchema = szSchema & "    		  		<Y>40</Y>											" + vbCrlf 
		szSchema = szSchema & "    			</Location>											" + vbCrlf 
		szSchema = szSchema & "    			<Size>												" + vbCrlf 
		szSchema = szSchema & "    		  		<CX>390</CX>										" + vbCrlf 
		szSchema = szSchema & "    		  		<CY>40</CY>										" + vbCrlf 
		szSchema = szSchema & "    			</Size>												" + vbCrlf 
		szSchema = szSchema & "    			<Text>** Status Bar **</Text>								" + vbCrlf 
		szSchema = szSchema & "    	    </StaticText>										" + vbCrlf 
		szSchema = szSchema & "     	</Control>	    									" + vbCrlf 
		szSchema = szSchema & "    	<Control>												" + vbCrlf 
		szSchema = szSchema & "    	    <Button>											" + vbCrlf 
		szSchema = szSchema & "    		<Name>btnQuit</Name>									" + vbCrlf 
		szSchema = szSchema & "    		<Location>											" + vbCrlf 
		szSchema = szSchema & "    		  <X>340</X>											" + vbCrlf 
		szSchema = szSchema & "    		  <Y>55</Y>											" + vbCrlf 
		szSchema = szSchema & "    		</Location>											" + vbCrlf 
		szSchema = szSchema & "    		<Size>												" + vbCrlf 
		szSchema = szSchema & "    		  <CX>50</CX>										" + vbCrlf 
		szSchema = szSchema & "    		  <CY>16</CY>										" + vbCrlf 
		szSchema = szSchema & "    		</Size>												" + vbCrlf 
		szSchema = szSchema & "    		<Text>QUIT</Text>										" + vbCrlf 
		szSchema = szSchema & "    	    </Button>											" + vbCrlf 
		szSchema = szSchema & "     	</Control>	    									" + vbCrlf 
		szSchema = szSchema & "      </DefaultControlContainer>								" + vbCrlf 
		szSchema = szSchema & "    </Container>												" + vbCrlf 
		szSchema = szSchema & "    <Background>												" + vbCrlf 
		szSchema = szSchema & "      <SkinImage>Window-Background</SkinImage>				" + vbCrlf 
		szSchema = szSchema & "    </Background>											" + vbCrlf 
		szSchema = szSchema & "    <Moveable>TRUE</Moveable>								" + vbCrlf 
		szSchema = szSchema & "  </Window>													" + vbCrlf 
		szSchema = szSchema & "</XML>														" + vbCrlf 

		Set handler = New QuitButtonHandlerClass

		set Window = XUScriptPlugin.LoadWindow( szSchema )

		set bQuit = XUScriptPlugin.LoadControl( Window,"btnQuit")
		XUScriptPlugin.AddButtonHandler Window, "btnQuit", handler

		set StatusBar = XUScriptPlugin.LoadControl(Window,"StatusBar")

		Window.Title = "EQ2 MegaBot Info"

		'Show the window
		XUScriptPlugin.ActivateWindow Window
	End Sub

	Public Sub SetStatusBar(txt)
		StatusBar.Text = txt
	End Sub

	Private Sub Class_Terminate()
		Dim i

		XUScriptPlugin.RemoveButtonHandler Window, "btnQuit"

		XUScriptPlugin.UnloadControl bQuit
		XUScriptPlugin.UnloadControl StatusBar 
		XUScriptPlugin.DeActivateWindow Window
		XUScriptPlugin.UnloadWindow Window
		set handler=NOTHING

	end Sub

End Class

' =============================================================
' =============================================================
Dim i

QuitNow=FALSE
Set objStatusWindow = New OutputStatusWindowClass
i=1
Do While NOT QuitNow
	StatusBar("Loop: " & i)
	XUScriptHost.Sleep 1000
	i = i + 1
Loop
XUScriptHost.Sleep 2000
Set objStatusWindow = NOTHING


Thanks,
Rich
Posted: February 12th, 2005
User avatar
Premium
Total Posts:6718 Joined:2004
Couple of things.

If you DO NOT have the EQ2Crafter plugin installed, you will need to check the Compatibility mode checkbox.

If you DO HAVE the EQ2Crafter plugin installed, DO NOT check the compatiblity mode checkbox on the scripting plugin.


Did that help?

_________________
Use Search first, ask questions later!
Posted: February 12th, 2005
richyrich
ohhhh - I had no idea - I have ALWAYS been checking the compatilibily mode for EQ2... let me try it.
Posted: February 12th, 2005
richyrich
Nope - doesn't help - tried both ways - consistent crashing :-(
Posted: February 12th, 2005
User avatar
Premium
Total Posts:6718 Joined:2004
I could not get it to crash.


Do you have an AMD processor?

I'll try to test on my AMD machine here in a bit and see if it crashes there.

_________________
Use Search first, ask questions later!
Posted: February 12th, 2005
User avatar
Premium
Total Posts:6718 Joined:2004
If it makes any difference.

I have the EQ2Crafter installed.
NO check in the compatiblilty
No options checked EXCEPT alternate hooking and random filenames.

_________________
Use Search first, ask questions later!
Posted: February 13th, 2005
richyrich
Yes, I have an AMD - same options checked as you do :-(

I really wanted to add these buttons as having to stop the script, change the INI file, then restart is a pain in the arse! :-)
Posted: February 13th, 2005
richyrich
Ok - it's AMD :-(

I have 2 AMD boxes, 1 Intel.
BOTH AMD's crash consistently. Hit the Quit button, Hit F1, F2, F1, CRASH.

Can't make it crash on intel.

I will program the buttons using the Intel box, but would really love them to be fixed so it runs on an AMD as my fast machines are AMD, as I'm sure others are.

Any ideas here? Is 100% related to the handlers. If I don't add the handlers to the buttons, no issue.

Rich
Posted: February 13th, 2005
User avatar
Premium
Total Posts:6718 Joined:2004
Yep, and everybody always says how good AMD processors are. :P. Now look at them. All banged up and back of the bus.

Had to tease ya a little. hehe.

_________________
Use Search first, ask questions later!
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 27 guests
Post Reply