Well, I'm helping ramadash with this on another forum and I ran into a problem. When you use GUIRegisterMsg to call a function remotely from another script, the other script can't continue to run until the function(that was remotely called) ends. Maybe the scripts would explain better.
Here's the script that calls the function in the other script remotely:
$CMD_Msgbox_stats = 10000
$CMD_Quit = 10001
$CMDWindow = WinGetHandle("mmBotCommander")
$life = 34735
$mana = 1345
RemoteFunc($CMDWindow, $CMD_Msgbox_stats, $life, $mana)
MsgBox(0,"Hey","blah")
RemoteFunc($CMDWindow, $CMD_Quit)
Func RemoteFunc($window, $functionID, $wparam = 0, $lparam = 0)
$dll = DllOpen("user32.dll")
DllCall($dll, "none", "SendMessage","hwnd", $window, _
"int", $functionID, "long", $wparam, "long", $lparam)
EndFunc
This is the main script. This is how I'd like it to be but it doesn't function like I want:
#include <GUIConstants.au3>
$CMD_Msgbox_stats = 10000
$CMD_Quit = 10001
Global $s = 0, $l, $m
$mygui = GuiCreate("mmBotCommander",1,1)
GUIRegisterMsg($CMD_Msgbox_stats, "Msgboxstats")
GUIRegisterMsg($CMD_Quit, "Quit")
While 1
Sleep(10)
WEnd
Func Msgboxstats($hWndGUI, $MsgID, $life, $mana)
MsgBox(0,"mmBot","Health: " & Number($life) & " Mana: " & Number($mana))
EndFunc
Func Quit()
Exit
EndFunc
This is want I ended up doing to get the functionality I wanted but to have more than one function would be more than just a little sloppy:
#include <GUIConstants.au3>
$CMD_Msgbox_stats = 10000
$CMD_Quit = 10001
Global $s = 0, $l, $m
$mygui = GuiCreate("mmBotCommander",1,1)
GUIRegisterMsg($CMD_Msgbox_stats, "Msgboxstats")
GUIRegisterMsg($CMD_Quit, "Quit")
While 1
Sleep(10)
If $s = 1 Then
$s = 0
MsgBox(0,"mmBot","Health: " & Number($l) & " Mana: " & Number($m))
EndIf
WEnd
Func Msgboxstats($hWndGUI, $MsgID, $life, $mana)
$s = 1
$l = $life
$m = $mana
;MsgBox(0,"mmBot","Health: " & Number($life) & " Mana: " & Number($mana))
EndFunc
Func Quit()
Exit
EndFunc
Maybe that makes enough sense. If not, ask away. Keep in mind, this is more of a proof of concept of what we want to do, it's not a portion of the finished product.