Cancel

Understanding saving a .ini configs from .ini into Varables used in conjunction

16 posts in this topic

#1 ·  Posted

Okay so first off id just like to say that i am an AMATEUR who has learned everything through YouTube Tutorials and reading the help menu so for give my naivety trying to explane what exactly im looking to do. With that said, I am trying to have a series of loop that repeat to the specific input variables saved before the execution of each loop

So Window Opens

Input 1  ;;number of cycles you wish to do

Input 2  ;;number of times Part A is done

Input3  ;;number of times Part B is done

 

So if i put Input1 = 5 & Input2 = 15 & Input3 = 2, Then the loop should start doing   Input1""Input2x15,Input3x2"x5

Heres the what i got so far(The Problem could be as simple as bad programing from me but thats why im here asking to learn)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Input1 = IniRead("ini.ini", "Config", "", "2")
Global $Input2 = IniRead("ini.ini", "Config", "", "2")
Global $Input3 = IniRead("ini.ini", "Config", "", "2")

Global $Example = GUICreate("Example", 164, 178, -1, -1)
Global $Input1 = GUICtrlCreateInput("", 24, 8, 121, 21)
Global $Input2 = GUICtrlCreateInput("", 24, 40, 121, 21)
Global $Input3 = GUICtrlCreateInput("", 24, 72, 121, 21)
Global $Save = GUICtrlCreateButton("Save", 40, 104, 75, 25)
Global $Start = GUICtrlCreateButton("Start", 40, 136, 75, 25)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $Save
            Input1()
            Input2()
            Input3()
            MsgBox(0, "Config", "Your Settings Where Saved", 5)

         Case $Start
            Do
               Task()
               $Input1 -= 1
            Until $Input1 = 0

    EndSwitch
WEnd

Func Task()
   MsgBox(0, "Task", "Task",3)
   Do
      Part_A()
      $Input2 += 1
   Until $Input2 = 5
   Do
      Part_B()
      $Input3 += 1
   Until $Input3 = 2
EndFunc

Func Part_A()
   MsgBox(0, "Part A", "Part A",3)
EndFunc

Func Part_B()
   MsgBox(0, "Part B", "Part B",3)
EndFunc

Func Input1()
   $Read = GUICtrlRead($Input1)
   IniWrite("Expample.ini","Config","Input1",$read)
EndFunc

Func Input2()
   $Read = GUICtrlRead($Input2)
   IniWrite("Expample.ini","Config","Input2",$read)
EndFunc

Func Input3()
   $Read = GUICtrlRead($Input3)
   IniWrite("Expample.ini","Config","Input3",$read)
EndFunc

TestTest.au3

Share this post


Link to post
Share on other sites



#2 ·  Posted

so i want to be able to Change Input 1 = ??? Input 2 = ??? Input3 = ??? hit Save, then Hit start Input1() will start then Input2() x (Input2 = ???) then Input3() x (Input3 = ???) then repeat x(input1 = ???)

Share this post


Link to post
Share on other sites

#3 ·  Posted

Try:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aInput[4]
$aInput[0] = 3
$aInput[1] = IniRead("Example.ini", "Config", "Input1", "1")
$aInput[2] = IniRead("Example.ini", "Config", "Input2", "2")
$aInput[3] = IniRead("Example.ini", "Config", "Input3", "3")

Global $Example = GUICreate("Example", 164, 178, -1, -1)
Global $idInput1 = GUICtrlCreateInput($aInput[1], 24, 8, 121, 21)
Global $idInput2 = GUICtrlCreateInput($aInput[2], 24, 40, 121, 21)
Global $idInput3 = GUICtrlCreateInput($aInput[3], 24, 72, 121, 21)
Global $Save = GUICtrlCreateButton("Save", 40, 104, 75, 25)
Global $Start = GUICtrlCreateButton("Start", 40, 136, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Save
            _AddInput()
            MsgBox(0, "Config", "Your Settings Where Saved", 5)
        Case $Start
            For $i = 1 To $aInput[1]
                Task("Part A", $aInput[2])
            Next
            For $i = 1 To $aInput[1]
                Task("Part B", $aInput[3])
            Next
    EndSwitch
WEnd

Func Task($sTask, $iTask)
    MsgBox(0, $sTask, $sTask & " - Starting: " & $i & " Of " & $aInput[1],3)
    For $j = 1 To $iTask
        MsgBox(0,$sTask, $sTask & " - " & $j & " Of " & $iTask)
    Next
EndFunc

Func _AddInput()
    $aInput[1] = Number(GUICtrlRead($idInput1))
    $aInput[2] = Number(GUICtrlRead($idInput2))
    $aInput[3] = Number(GUICtrlRead($idInput3))
    IniWrite("Example.ini","Config","Input1", $aInput[1])
    IniWrite("Example.ini","Config","Input2", $aInput[2])
    IniWrite("Example.ini","Config","Input3", $aInput[3])
EndFunc

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

@Subz That is really great but it runs (Input2xInput2)xInput1 then (input3xInput3)xinput1

i need it to run (Input2xInput2 Then input3xInput3)xInput1

Share this post


Link to post
Share on other sites

#5 ·  Posted

i figured out how to switch it up to work the way i needed thank you so freaking much this helps me out 1000% and got me past my biggest wall

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aInput[4]
$aInput[0] = 3
$aInput[1] = IniRead("Example.ini", "Config", "Input1", "1")
$aInput[2] = IniRead("Example.ini", "Config", "Input2", "2")
$aInput[3] = IniRead("Example.ini", "Config", "Input3", "3")

Global $Example = GUICreate("Example", 164, 178, -1, -1)
Global $idInput1 = GUICtrlCreateInput($aInput[1], 24, 8, 121, 21)
Global $idInput2 = GUICtrlCreateInput($aInput[2], 24, 40, 121, 21)
Global $idInput3 = GUICtrlCreateInput($aInput[3], 24, 72, 121, 21)
Global $Save = GUICtrlCreateButton("Save", 40, 104, 75, 25)
Global $Start = GUICtrlCreateButton("Start", 40, 136, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Save
            _AddInput()
            MsgBox(0, "Config", "Your Settings Where Saved", 5)
        Case $Start
            For $i = 1 To $aInput[1]
                Task("Part A", $aInput[2])
                Task("Part B", $aInput[3])
             Next
             Exit
    EndSwitch
WEnd

Func Task($sTask, $iTask)
    MsgBox(0, $sTask, $sTask & " - Starting: " & $i & " Of " & $aInput[1],3)
    For $j = 1 To $iTask
        MsgBox(0,$sTask, $sTask & " - " & $j & " Of " & $iTask)
    Next
EndFunc

Func _AddInput()

 yet

Share this post


Link to post
Share on other sites

#6 ·  Posted

You could also use:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aInput[4]
$aInput[0] = 3
$aInput[1] = IniRead("Example.ini", "Config", "Input1", "1")
$aInput[2] = IniRead("Example.ini", "Config", "Input2", "2")
$aInput[3] = IniRead("Example.ini", "Config", "Input3", "3")

Global $Example = GUICreate("Example", 164, 178, -1, -1)
Global $idInput1 = GUICtrlCreateInput($aInput[1], 24, 8, 121, 21)
Global $idInput2 = GUICtrlCreateInput($aInput[2], 24, 40, 121, 21)
Global $idInput3 = GUICtrlCreateInput($aInput[3], 24, 72, 121, 21)
Global $Save = GUICtrlCreateButton("Save", 40, 104, 75, 25)
Global $Start = GUICtrlCreateButton("Start", 40, 136, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Save
            _AddInput()
            MsgBox(0, "Config", "Your Settings Where Saved", 5)
        Case $Start
            For $i = 1 To $aInput[1]
                Task()
            Next
    EndSwitch
WEnd

Func Task($sTask, $iTask)
    MsgBox(0, $sTask, $sTask & " - Starting: " & $i & " Of " & $aInput[1],3)
    For $j = 1 To $aInput[2]
        MsgBox(0, "Part A", "Part A - " & $j & " Of " & $aInput[2])
    Next
    For $j = 1 To $aInput[3]
        MsgBox(0, "Part B", "Part B - " & $j & " Of " & $aInput[3])
    Next
EndFunc

Func _AddInput()
    $aInput[1] = Number(GUICtrlRead($idInput1))
    $aInput[2] = Number(GUICtrlRead($idInput2))
    $aInput[3] = Number(GUICtrlRead($idInput3))
    IniWrite("Example.ini","Config","Input1", $aInput[1])
    IniWrite("Example.ini","Config","Input2", $aInput[2])
    IniWrite("Example.ini","Config","Input3", $aInput[3])
EndFunc

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

How would you convert this same code process into button pressing in a program just so i can understand the differences?

it would open notepad type pewpew(xInput2[2])bangbang(xInput[3])x(Input[4])?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $aInput[4]
$aInput[0] = 3
$aInput[1] = IniRead("Example.ini", "Config", "Input1", "1")
$aInput[2] = IniRead("Example.ini", "Config", "Input2", "2")
$aInput[3] = IniRead("Example.ini", "Config", "Input3", "3")

Global $Example = GUICreate("Example", 164, 178, -1, -1)
Global $idInput1 = GUICtrlCreateInput($aInput[1], 24, 8, 121, 21)
Global $idInput2 = GUICtrlCreateInput($aInput[2], 24, 40, 121, 21)
Global $idInput3 = GUICtrlCreateInput($aInput[3], 24, 72, 121, 21)
Global $Save = GUICtrlCreateButton("Save", 40, 104, 75, 25)
Global $Start = GUICtrlCreateButton("Start", 40, 136, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Save
            _AddInput()
            MsgBox(0, "Config", "Your Settings Where Saved", 5)
         Case $Start
            StartNotepad()
            WinMove("Untitled - Notepad","",0,0)
            Use_Weapon()
            Use_Weapon_Sound()
             Exit
    EndSwitch
 WEnd

Func StartNotepad()
   Run("Notepad.exe")
EndFunc

Func Use_Weapon($sTask, $iTask)
   For $j = 1 To $iTask
      Send("PewPew"$sTask, $sTask & " - Starting: " & $i & " Of " & $aInput[1],3)
      Next
EndFunc

Func Use_Weapon_Sound($sTask, $iTask)
   For $j = 1 To $iTask
       Send("BangBang"$sTask, $sTask & " - Starting: " & $i & " Of " & $aInput[1],3)
       Next
EndFunc

 Func Task($sTask, $iTask)
    MsgBox(0, $sTask, $sTask & " - Starting: " & $i & " Of " & $aInput[1],3)
    For $j = 1 To $iTask
        MsgBox(0,$sTask, $sTask & " - " & $j & " Of " & $iTask)
    Next
EndFunc

Func _AddInput()
   $aInput[1] = Number(GUICtrlRead($idInput1))
    $aInput[2] = Number(GUICtrlRead($idInput2))
    $aInput[3] = Number(GUICtrlRead($idInput3))
    IniWrite("Example.ini","Config","Input1", $aInput[1])
    IniWrite("Example.ini","Config","Input2", $aInput[2])
    IniWrite("Example.ini","Config","Input3", $aInput[3])
EndFunc

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

Cancel, please don't PM me, I saw your post above when you posted it but it now appears that this is for game automation which is against Forum rules which is why I haven't responded.  Moderators are likely to lock this thread so sorry I'm unable to help any further.

Share this post


Link to post
Share on other sites

#9 ·  Posted

well sorry for PMing you i did not mean to offend. 2nd this is NOT for a game interface and the first set of script you helped me with is exactly what i needed, and was only asking how to convert it into button pressing for knowledge of proper programming and not understanding how the ($task) worked and the difference to get the same concept to do a different action and apologize for using gaming automation terms to express my thoughts on  converting the functions.

Share this post


Link to post
Share on other sites

#10 ·  Posted

if i wanted a bot for a game id download one that already works there everywhere

Share this post


Link to post
Share on other sites

#11 ·  Posted

If a moderator allows the thread to continue I'll be happy to respond, although your last PM doesn't help matters.

Quote

This is currently how im running my cycles in the program

Cycle_Action(100)

Func Cycle_Action($count)
   For $i += 1 To $count
   Cut_Tree(50)
   Cut_Into_Lumber(5)
   Sell_Lumber(1)
   Next
EndFunc

Func Sell_Lumber($count)
   For $z = 1 To $count
   Send("{9 down}")
   Sleep(200)
   Send("{9 up}")
   Sleep(1300);;Cooldown of action;;;
   Next
EndFunc

Func Cut_Tree($count)
   For $x = 1 To $count
      Send("{7 down}")
      Sleep(200)
      Send("{7 up}")
      Sleep(1300);;Cooldown of action;;;
   Next
EndFunc

Func Cut_Into_Lumber($count)
   For $x = 1 To $count
      Send("{3 down}")
      Sleep(200)
      Send("{3 up}")
      Sleep(1300);;Cooldown of action;;;
   Next
EndFunc

Share this post


Link to post
Share on other sites

#12 ·  Posted

and at the time of sending 

Cycle_Action(100)

i had not seen 

1 hour ago, Subz said:

Cancel, please don't PM me, I saw your post above when you posted it but it now appears that this is for game automation which is against Forum rules which is why I haven't responded.  Moderators are likely to lock this thread so sorry I'm unable to help any further.

And i now understand i hit 2 things Forum rules 

A. 

5. Do not PM other users asking for support - that is why the forum exists, so post there instead.

B.

  • Launching, automation or script interaction with games or game servers, regardless of the game.

And again i apologize game automation is not my intention i merely was using it for an example of understanding the script process used in a different form

 

Share this post


Link to post
Share on other sites

#13 ·  Posted

And Subz if you do look at ur time stamps for all the pm's they are before this post

28 minutes ago, Cancel said:

well sorry for PMing you i did not mean to offend. 2nd this is NOT for a game interface and the first set of script you helped me with is exactly what i needed, and was only asking how to convert it into button pressing for knowledge of proper programming and not understanding how the ($task) worked and the difference to get the same concept to do a different action and apologize for using gaming automation terms to express my thoughts on  converting the functions.

Share this post


Link to post
Share on other sites

#14 ·  Posted

Hi Cancel

No problem I wasn't offended by you PMing me, it's just that I've recently had my knuckles rapped by the moderators for unintentionally assisting people that ended up wanted the code for game automation, as mentioned if a moderator comments here that it's ok to continue with the thread, I'll be happy to assist you further.

Share this post


Link to post
Share on other sites

#15 ·  Posted

I completely understand i just making sure i don't hurt my ability to get answers in the future because i didn't even realize the way my mind grabbed the the concept and verbally interpenetrate it in term's i thought would be easy to understand unaware its Frowned Upon to use in game automation and i just didn't know how to state ({xInput2[2]}x{Input[3]})x(Input[4]) in a visual way with tittle's and clearly separate command Input this many time and do that input this many times and repeat input this many times using ???() and how they work together to do the action. I only used the game concept of cutting logs (Which i made up because my kids playing Minecraft next to me at the time) cause it was the first way my brain grab the thought for me to get across for what i was looking to learn to write the same script func as the code already established in a different way with a different result.

Share this post


Link to post
Share on other sites

#16 ·  Posted

16 hours ago, Subz said:

it's just that I've recently had my knuckles rapped by the moderators for unintentionally assisting people that ended up wanted the code for game automation, as mentioned if a moderator comments here that it's ok to continue with the thread, I'll be happy to assist you further.

mmm "Knuckels Rapped"   We just informed you not to assist threads that are against our Forum Rules.
Since you seem to have a reason to doubt this one too and ask for a Mod to judge, I simply take the easy way out and lock this thread.

@Cancel, PM me in case you feel I am totally wrong but you better have a good case or else don't bother. ;)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.