Jump to content

Help Debugging please


Recommended Posts

#include "GUIConstants.au3"
#region viewer info
$ver = "1.0"
#endregion
$winwidth = @DesktopWidth - 4
$winheight = @DesktopHeight - 70
$es = BitOr($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)
$win = GUICreate("PindleGod Viewer v"& $ver, $winwidth, $winheight, 1, 1)
$edit = GUICtrlCreateEdit("[" & @hour & ":" & @min & ":" & @sec & "]: PindleGod Viewer Started.", 1, 1, $winwidth / 2, $winheight - 25, $es)
$start = GuiCtrlCreateMenu("&Start")
$newrun = GuiCtrlCreateMenuItem("&New &Run", $start)
$restart = GuiCtrlCreateMenuItem("&Restart", $start)
$end = GuiCtrlCreateMenu("&End")
$crun = GUICtrlCreateMenuitem("&Current &Run", $end)
$pindl = GUICtrlCreateMenuitem("&PindleGod", $end)
$group1 = GuiCtrlCreateGroup("Information", $winwidth / 2 + 5, 1, $winwidth / 2 - 10, $winheight / 2)
$group2 = GuiCtrlCreateGroup("Status", $winwidth / 2 + 5, $winheight / 2 + 5, $winwidth / 2 - 10, $winheight / 2 - 30)
#region Information
GuiCtrlCreateLabel("Account name: ", $winwidth / 2 + 10, 20, 75, 20)
$accountinput = GUICtrlCreateInput("Loading...", $winwidth / 2 + 90, 20, 90, 20)
GuiCtrlSetState($accountinput, $GUI_DISABLE)
$editaccount = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 20, 70, 20)
#endregion
GuiSetState()
_EditAppendText($edit, "Welcome to PindleGod©'s Viewer!")
_EditAppendText($edit, "If you find any bugs, please report them to pindlegod@yahoo.com")
While 1
   $account = IniRead("Config.ini", "Information", "Username", "Null")
   GuiCtrlSetData($accountinput, $account)
   $msg = GUIGetMsg()
   Select
   Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
   Case $msg = $newrun
      _EditAppendText($edit, "Current Run ended")
      _EditAppendText($edit, "Waiting for 3 seconds to create new game due to flood control.")
      Sleep(3000)
      _EditAppendText($edit, "New Run began")
   Case $msg = $crun
      _EditAppendText($edit, "Current Run Ended")
   Case $msg = $restart
      $confirm = Msgbox(4, "Confirm", "Are you sure you wish to restart PindleGod? (If you are in the middle of a run, it will be canceled)")
      If $confirm = 6 Then
         Run(@ScriptDir & "\restart.exe")
         Exit
      EndIf
   Case $msg = $editaccount
      GuiCtrlSetState($accountinput, $GUI_ENABLE)
      GuiCtrlSetState($editaccount, $GUI_DISABLE)
      $newaccount = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 20, 50, 20)
      Do
         $msg = GUIGetMsg()
      Until $msg = $newaccount
      $newaccountname = GUIRead($accountinput)
      IniWrite("Config.ini", "Information", "Username", $newaccountname)
      GuiCtrlDelete($newaccount)
      GuiCtrlSetState($editaccount, $GUI_ENABLE)
      GuiCtrlSetState($accountinput, $GUI_DISABLE)
   Case $msg = $pindl
      $confirmexit = MsgBox(4, "Confirm", "Are you sure you would like to exit PindleGod viewer?")
      If $confirmexit = 6 Then
         Exit
      EndIf
   EndSelect
WEnd
Func _EditAppendText($editname, $data)
   $a = GuiRead($editname)
   GuiCtrlSetData($editname, $a & @CRLF & "[" & @hour & ":" & @min & ":" & @sec & "]: " & $data)
EndFunc

Whenever the edit updates it writes all the extra information like 4 times, try clicking Start -> New Run

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

- changed the function _EditAppendText a bit

#include "GUIConstants.au3"
#region viewer info
$ver = "1.0"
#endregion
$winwidth = @DesktopWidth - 4
$winheight = @DesktopHeight - 70
$es = BitOr($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY)
$win = GUICreate("PindleGod Viewer v"& $ver, $winwidth, $winheight, 1, 1)
$edit = GUICtrlCreateEdit("[" & @hour & ":" & @min & ":" & @sec & "]: PindleGod Viewer Started.", 1, 1, $winwidth / 2, $winheight - 25, $es)
$start = GuiCtrlCreateMenu("&Start")
$newrun = GuiCtrlCreateMenuItem("&New &Run", $start)
$restart = GuiCtrlCreateMenuItem("&Restart", $start)
$end = GuiCtrlCreateMenu("&End")
$crun = GUICtrlCreateMenuitem("&Current &Run", $end)
$pindl = GUICtrlCreateMenuitem("&PindleGod", $end)
$group1 = GuiCtrlCreateGroup("Information", $winwidth / 2 + 5, 1, $winwidth / 2 - 10, $winheight / 2)
$group2 = GuiCtrlCreateGroup("Status", $winwidth / 2 + 5, $winheight / 2 + 5, $winwidth / 2 - 10, $winheight / 2 - 30)
#region Information
GuiCtrlCreateLabel("Account name: ", $winwidth / 2 + 10, 20, 75, 20)
$accountinput = GUICtrlCreateInput("Loading...", $winwidth / 2 + 90, 20, 90, 20)
GuiCtrlSetState($accountinput, $GUI_DISABLE)
$editaccount = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 20, 70, 20)
#endregion
GuiSetState()
_EditAppendText($edit, "Welcome to PindleGod©'s Viewer!")
_EditAppendText($edit, "If you find any bugs, please report them to pindlegod@yahoo.com")
While 1
  $account = IniRead("Config.ini", "Information", "Username", "Null")
  GuiCtrlSetData($accountinput, $account)
  $msg = GUIGetMsg()
  Select
  Case $msg = $GUI_EVENT_CLOSE
     ExitLoop
  Case $msg = $newrun
     _EditAppendText($edit, "Current Run ended")
     _EditAppendText($edit, "Waiting for 3 seconds to create new game due to flood control.")
     Sleep(3000)
     _EditAppendText($edit, "New Run began")
  Case $msg = $crun
     _EditAppendText($edit, "Current Run Ended")
  Case $msg = $restart
     $confirm = Msgbox(4, "Confirm", "Are you sure you wish to restart PindleGod? (If you are in the middle of a run, it will be canceled)")
     If $confirm = 6 Then
        Run(@ScriptDir & "\restart.exe")
        Exit
     EndIf
  Case $msg = $editaccount
     GuiCtrlSetState($accountinput, $GUI_ENABLE)
     GuiCtrlSetState($editaccount, $GUI_DISABLE)
     $newaccount = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 20, 50, 20)
     Do
        $msg = GUIGetMsg()
     Until $msg = $newaccount
     $newaccountname = GUIRead($accountinput)
     IniWrite("Config.ini", "Information", "Username", $newaccountname)
     GuiCtrlDelete($newaccount)
     GuiCtrlSetState($editaccount, $GUI_ENABLE)
     GuiCtrlSetState($accountinput, $GUI_DISABLE)
  Case $msg = $pindl
     $confirmexit = MsgBox(4, "Confirm", "Are you sure you would like to exit PindleGod viewer?")
     If $confirmexit = 6 Then
        Exit
     EndIf
  EndSelect
WEnd
Func _EditAppendText($editname, $data)
 ;$a = GuiRead($editname)
  GuiCtrlSetData($editname, "[" & @hour & ":" & @min & ":" & @sec & "]: " & $data & @CRLF)
EndFunc
Link to comment
Share on other sites

Well I made this script on a different computer, and it worked, but to my suprise on this computer it's very different. Picture shown below (Just from clicking Start -> New Run):

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

I think it's just adding the data to the end of the Edit before deleting it.

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Whenever the edit updates it writes all the extra information like 4 times

I think the default mode of GUICtlrlSetData is changed between versions.

And you have different versions installed on the computers.

So this is false now GUICtrlSetData replaces the previous content on default.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...