|
You last visited: Today at 02:50
Advertisement
IF from GUI input?
Discussion on IF from GUI input? within the AutoIt forum part of the Coders Den category.
05/23/2013, 18:15
|
#1
|
elite*gold: 0
Join Date: May 2013
Posts: 3
Received Thanks: 0
|
IF from GUI input?
Hi started coding autoit yesterday and created a small project for a game I play.
The GUI works fine but the IF statement does not seem to read the inputs correctly. What have I done wrong? Take in mind I started yesterday so if things could be explained that would be great. Thanks for your time
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{END}", "Terminate")
#Region ### START Koda GUI section ### Form=
$craftool = GUICreate("SWG Crafting Script", 319, 206, 438, 229)
GUISetBkColor(0xBFCDDB)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193)
GUICtrlSetBkColor(-1, 0x3399FF)
$Input1 = GUICtrlCreateInput("", 152, 32, 137, 21)
$Input2 = GUICtrlCreateInput("", 152, 72, 137, 21)
$Output = GUICtrlCreateInput("", 152, 112, 137, 21)
$Button3 = GUICtrlCreateButton("Calculate", 112, 144, 81, 33)
$Label1 = GUICtrlCreateLabel("Xerco's SWG Crafting Script v0.3", 16, 16, 161, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label2 = GUICtrlCreateLabel("Input Crafting Exp per Item", 16, 40, 129, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label3 = GUICtrlCreateLabel("Max Skill Experiance", 16, 72, 102, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label4 = GUICtrlCreateLabel("Items Left To Craft", 16, 112, 114, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $timesCraft, $itemExp , $maxExp, $data3, $ReadT1, $ReadT2, $peakExp, $timesCraft, $macro
While 1
$peakExp = $maxExp * 1.5
$nMsg = GUIGetMsg()
$ReadI1 = GUICtrlRead($Input1)
$ReadI2 = GUICtrlRead($Input2)
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Input1
$itemExp = GUICtrlRead($Input1)
GUICtrlSetData($Input1, $itemExp)
Case $Input2
$maxExp = GUICtrlRead($Input2)
GUICtrlSetData($Input2, $maxExp)
Case $Button3
$timesCraft = GUICtrlRead($Output)
GUICtrlSetData($Output, $peakExp / $itemExp)
If $macro < 7 And $timesCraft > 0 Then
WinActivate("SwgClient", "")
Send($macro)
Sleep(2000)
MouseClick ( "left" , 160, 290, 2 )
Sleep(2000)
MouseClick ( "left" , 160, 290, 4 )
Sleep(2000)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
$timesCraft = $timesCraft - 1
$macro = $macro + 1
If $macro < 7 Then
$macro = 1
EndIf
EndIf
EndSwitch
WEnd
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func Terminate()
Exit 0
EndFunc
|
|
|
05/23/2013, 20:21
|
#2
|
elite*gold: 0
Join Date: Nov 2011
Posts: 1,448
Received Thanks: 1,257
|
Quote:
Originally Posted by Shiw
While 1
$peakExp = $maxExp * 1.5
$nMsg = GUIGetMsg()
$ReadI1 = GUICtrlRead($Input1)
$ReadI2 = GUICtrlRead($Input2)
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Input1
$itemExp = GUICtrlRead($Input1)
GUICtrlSetData($Input1, $itemExp)
Case $Input2
$maxExp = GUICtrlRead($Input2)
GUICtrlSetData($Input2, $maxExp)
Case $Button3
$timesCraft = GUICtrlRead($Output)
GUICtrlSetData($Output, $peakExp / $itemExp)
|
It seems that you give Input1 and Input 2 the order to SetData themself..
You can make new Buttons like $Button1 and $Button2 to SetData Input1 and Input2.
Type 1
Code:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{END}", "Terminate")
#Region ### START Koda GUI section ### Form=
$craftool = GUICreate("SWG Crafting Script", 319, 206, 438, 229)
GUISetBkColor(0xBFCDDB)
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 297, 193)
GUICtrlSetBkColor(-1, 0x3399FF)
$Input1 = GUICtrlCreateInput("", 152, 32, 137, 21)
$Input2 = GUICtrlCreateInput("", 152, 72, 137, 21)
$Output = GUICtrlCreateInput("", 152, 112, 137, 21)
$Button3 = GUICtrlCreateButton("Calculate", 112, 144, 81, 33)
$Label1 = GUICtrlCreateLabel("Xerco's SWG Crafting Script v0.3", 16, 16, 161, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label2 = GUICtrlCreateLabel("Input Crafting Exp per Item", 16, 40, 129, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label3 = GUICtrlCreateLabel("Max Skill Experiance", 16, 72, 102, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
$Label4 = GUICtrlCreateLabel("Items Left To Craft", 16, 112, 114, 17)
GUICtrlSetBkColor(-1, 0xBFCDDB)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Button1", 24, 152, 75, 25)
$Button2 = GUICtrlCreateButton("Button2", 216, 152, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $timesCraft, $itemExp , $maxExp, $data3, $ReadT1, $ReadT2, $peakExp, $timesCraft, $macro
While 1
$peakExp = $maxExp * 1.5
$nMsg = GUIGetMsg()
$ReadI1 = GUICtrlRead($Input1)
$ReadI2 = GUICtrlRead($Input2)
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$itemExp = GUICtrlRead($Input1)
GUICtrlSetData($Input1, $itemExp)
Case $Button2
$maxExp = GUICtrlRead($Input2)
GUICtrlSetData($Input2, $maxExp)
Case $Button3
$timesCraft = GUICtrlRead($Output)
GUICtrlSetData($Output, $peakExp / $itemExp)
If $macro < 7 And $timesCraft > 0 Then
WinActivate("SwgClient", "")
Send($macro)
Sleep(2000)
MouseClick ( "left" , 160, 290, 2 )
Sleep(2000)
MouseClick ( "left" , 160, 290, 4 )
Sleep(2000)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
Sleep(500)
Send("{ESC}")
$timesCraft = $timesCraft - 1
$macro = $macro + 1
If $macro < 7 Then
$macro = 1
EndIf
EndIf
EndSwitch
WEnd
Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc
Func Terminate()
Exit 0
EndFunc
Hope its like you want it..
MfG
Kilroy.
|
|
|
05/23/2013, 22:28
|
#3
|
elite*gold: 0
Join Date: May 2013
Posts: 3
Received Thanks: 0
|
Ahh ok yeah I understand what went wrong. New to autoit and first time iv played around with a GUI ever.
The
Code:
If $macro < 7 And $timesCraft > 0 Then
does not seem to work even when the var $timesCraft has a greater number then 0. I also realised each time it completes the loop it resets the values as they are recalculated each time. How should I go about keeping the loop going but not recalculating the input 1 and input 2 values.
Each time the macro completes it should $timesCraft = $timesCraft - 1 until > 0
|
|
|
05/23/2013, 23:10
|
#4
|
elite*gold: 1445
Join Date: Sep 2011
Posts: 199
Received Thanks: 177
|
press f1 in scite and search for following functions:
do until
for next
maybe this will help u
|
|
|
05/23/2013, 23:56
|
#5
|
elite*gold: 0
Join Date: May 2013
Posts: 3
Received Thanks: 0
|
Quote:
Originally Posted by #System
press f1 in scite and search for following functions:
do until
for next
maybe this will help u
|
So many statements lol, thanks for pointing this out looks like what I was looking for.
Il post back with updated script.
|
|
|
 |
Similar Threads
|
input box as an image like php input boxes
03/22/2012 - AutoIt - 2 Replies
is it posible to do that?
like... -> use image -> and put input box as image in gui
so u can enter text in the image but u wont see this crappy input white box :)
as i tryed and searched i dont think but maybe someone has figured it out
|
What is Input??
04/15/2011 - S4 League Hacks, Bots, Cheats & Exploits - 4 Replies
What is Input??:confused::confused:
|
Need some input please
07/10/2009 - Dekaron Private Server - 9 Replies
OKay guys i got my client packed but i only have 2 problems:
The loading map screen for deathlands is white and blank. also the minimap is blank. At first my mobs were pink but i reinstalled the textures and it fixed it. I reinstallled the files from data/texture/minimap and the loading one in texture/ui/game/loading.
Wondering if anyone else might have an idea
EDIT:: Its all new maps but they worked fine in unpacked mode same textures and etc
...
|
GUI Run (input...)
05/12/2008 - Guild Wars - 30 Replies
Hallo,
ich mal wieder mit ne Frage. Und zwar habe ich eine Func _path() erstellt welche die Aufgabe hat den user auf zu fordern den Pfad zum GuildWars verzeichniss an zu geben.
Die func klappt auch ohne Probleme, aber ich möchte es halt so das wenn der User dann start drückt das GuildWars startet von dem Verzeichniss aus wo der User sein GuildWars Installiert hat.
Die Func sieht so aus....
func _path()
MsgBox ( 0, "GuildWars Path", "Befor the bot can do autologin you have to...
|
All times are GMT +1. The time now is 02:50.
|
|