ini read/write and a 105 variable GUI

Ask gaming related questions
Geff T
Posts: 6
Joined: 07 May 2016, 15:16

ini read/write and a 105 variable GUI

09 May 2016, 17:42

i have been working on a game macro for a little while now , during which time my goals have moved as i see more that i could do .
i am now at the point where i need to save 3 sets (2 dropdownlist + a checkbox) of 35 data variables from a GUI .
reading the help and searching the forum has left me with a question ''how actualy do i get 105 variables to work with a single/pair ini read/write''
i am clearly missing a vital snipit of information needed to achive this .

once i can get the save buttonto do what it says on the tin i will have the same output read in at the start to give a ''settings save''
and as can be seen in the GUI i intend to make several of the more complex features ''self writing'' from info gleened by the GUI .

please help .

here is where i got to , with one change :- i have disabled the in-game only limit .

Code: Select all

; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; -------------- BASIC GUIDE TO HELP UNDERSTAND WHAT TO EDIT IN THIS MACRO ---------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - This macro is split into 5 SECTIONs, each seperated by a titled header looking like this ---
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 1 is the macro's global effect settings which never need changing ------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 2 -- HOT KEY ACTIVATION ------------------------------------------------------------
; ---- the key pressed to trigger a macro routine is followed by a double colon :: -------------
; ---- the next line is GOSUB then LOGIC CORE name , or it's a single instruction --------------
; ---- avoid setting an activation key to any key you might need for typing in game messages ! -
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 3 -- LOGIC CORE --------------------------------------------------------------------
; ---- there are realy only two things you MIGHT EVER want to change here ----------------------
; --------- both are in the block ( MAIN_USE ) and part of the ( IF ) statements ---------------
; ---- the number of charges used before changing which SCB are powered ( HSused ) -------------
; --------- if your SCB dont have 5 charges change the numbers after the = signs ---------------
; ---- where the if jumps to ( SCB_Set_One/Two ) depending on your SCB piarings ----------------
; --------- most change requirements are in the change powered cell banks section --------------
; ----------------------------------------------------------------------------------------------
; -- NOTE to use a SINGLE SCB to charge shields set SCB_Set_Two as SCB_Set_One -----------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 4 -- CHANGE POWERED CELL BANKS --- ( default is for 2 SCB used simaltainiously ) ---
; ---- this is the sequence of keypresses , so changes here are likely to be needed ------------
; ---- the target name after each GOSUB is a single action (press/click of a button/key) -------
; ---- actions have the same names as in game key bindings (main menu -> options -> controls) --
; ---- for repeted actions LOOP, X repetes the action below X times ----------------------------
; ---- dont change the sleep numbers they allow you HS and SCB enough time to fire in game -----
; ---- befor changing this section write down the exact sequence to manualy change SCB in game -
; ----------------------------------------------------------------------------------------------
; -- NOTE to use a SINGLE SCB to charge shields delete the marked lines and the lines inbetween 
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 5 -- IN GAME KEY BINDS -------------------------------------------------------------
; ---- each block of code is labeled to the right with the in game key bindings name -----------
; ---------- these are also in the same order as the in game key bindings are listed -----------
; ---------- there also the start of each block as it is the name used for GOSUB to find them --
; ---- before editing write down your bindings or add secondary binds in game to match these ---
; ---- each action has 2 referances in this script , press (down) and relese (up) --------------
; ---------- these referances are on the lines imediatly above and below the labels ------------
; ---- sorry but you cannot set these to a hotas action , for this set a secondary binding -----
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ---------- DEFAULT ACTION KEYS SET -----------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ------------- F1 = Charge Shields (and swap SCB if needed ) ----------------------------------
; ------------- F2 = Target Power Plant ( not 100% perfect but CZ friendly ) -------------------
; ------------- F3 = AUTO Chaff (On/Off) --------------------------------------- Fix for duel --
; --------------F4 = Request Docking -----------------------------------------------------------
; ------------- F5 = Reset Charges Used ( for when you re-arm ) --------------------------------
; ------------- F6 = Increase Charges Used -----------------------------------------------------
; ------------- F7 = Decrese charges Used ------------------------------------------------------
; ------------- F8 = Increase SCB Chains Used --------------------------------------------------
; ------------- F9 = Decrese SCB Chains Used ---------------------------------------------------
; -------------F10 = Configue ship loadout ------------------------------------ not connected --
; ------------ F11 = Show Key Guide ( On / Off ) -----------------------------------------------
; ------------ F12 = Show Usage Counts ( On / Off) ---------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ---------- DEFAULT KEYS BINDINGS USED --------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; -------------- O = Deploy Heat Sink {letter o , not the number 0) ----------------------------
; -------------- P = Use Shield Cell -----------------------------------------------------------
; -------------- C = Use Chaff Launcher --------------------------------------------------------
; -------------- Z = Target Panel --------------------------------------------------------------
; -------------- X = Systems Panel -------------------------------------------------------------
; ------------- UP = UI Panel UP ---------------------------------------------------------------
; ----------- DOWN = UI Panel Down -------------------------------------------------------------
; --------- INSERT = UI Panel Select -----------------------------------------------------------
; -------------- L = Next Panel Tab ------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; --------------------------------------------------- AND FINALY -------------------------------
; ----------------------------------------------------------------------------------------------
; ------------------------------------------ FOR THIS TO WORK AS INTENDED ----------------------
; ----------------------------------------------------------------------------------------------
; ---------------------------------------------------- YOU MUST --------------------------------
; ----------------------------------------------------------------------------------------------
; -------------------------------------------- for ALL of the SCB functions --------------------
; ----------------------------- highlight the top scb in the Systems Panel and exit the panel --
; ----------------------------------------------------------------------------------------------
; -------------------------------------------- for the target PP function ----------------------
; ----------------------------- move to the contacts tab in the Target Panel , exit the panel --
; ----------------------------- a target must also be locked when you activate this ------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------


#maxThreadsPerHotkey, 2
; ------ #IfWinActive, Elite - Dangerous (CLIENT) ------ disabled for testing
#NoEnv
setkeydelay, 30, 30
hsused = 0
SCBused = 0
tChaff:=0



; ---------------------------------------------------------
; ---------------------------------------------------------
; ------------------- HOT KEY ACTIVATION ------------------
; ---------------------------------------------------------
; ---------------------------------------------------------



F1::
 gosub MAIN_USE
return



F2::
 gosub POWER_PLANT
return



F3::
 gosub AUTOCHAFF
return


F4::
 gosub Target_Panel
 gosub Next_Panel_Tab
 gosub Next_Panel_Tab
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
return



F5::
 HSused = 0
 SCBused = 0
 gosub Equip_OSD
return



F6::
HSused ++
 gosub Equip_OSD
return



F7::
HSused --
 gosub Equip_OSD
return



F8::
SCBused ++
 gosub Equip_OSD
return



F9::
SCBused --
 gosub Equip_OSD
return



F10::
 gosub autoconfig
return


F11::
 gosub T_Key
return



F12::
 gosub T_OSD
return



; ---------------------------------------------------------
; ---------------------------------------------------------
; ----------------------- LOGIC CORE ----------------------
; ---------------------------------------------------------
; ---------------------------------------------------------



MAIN_USE:
 gosub Deploy_Heat_Sink
 Sleep, 1500
 gosub Use_Shield_Cell
HSused ++
 gosub Equip_OSD
 sleep, 10
if HSused = 5
 gosub SCB_Set_One
if HSused = 10
 gosub SCB_Set_One
if HSused = 15
 gosub SCB_Set_Two
return



POWER_PLANT:
 gosub Target_Panel
 gosub Next_Panel_Tab
loop, 6
 gosub UI_Panel_Up
 gosub UI_Panel_Select
 gosub Target_Panel
return



AUTOCHAFF:
 tChaff:=!tChaff
While (tChaff=1)
{
 gosub Use_Chaff_Launcher
 sleep, 15
 gosub Equip_OSD
 sleep, 500
 }
gosub Equip_OSD
return



T_Key:
 tKey := !tKey
 tOSD = 0
if tKey, 1
{
SysGet, width, 16
SplashTextOn, 200, 230, Key_Info, F1 = Charge Shields`nF2 = Target Power Plant`nF3 = AUTO Chaff`nF4 = Request Docking`nF5 = Reset Charges Used`nF6 = Increase Charges Used`nF7 = Decrese charges used`nF8 = Increase SCB used`nF9 = Decrease SCB used`nF10 = ship Setup menu`nF11 = This Key Guide`nF12 = Show Usage Counts.
WinMove, Key_Info, , ((width/2)-100), 15
}
else
SplashTextOff
return



T_OSD:
 tOSD := !tOSD
 tKey = 0
 gosub Equip_OSD
return



Equip_OSD:
if tChaff, 1
 AutoChaff = On
Else
 AutoChaff = Off
if tOSD, 1
{
SysGet, width, 16
SplashTextOn, 200, 60, Usage_Info, Shield Cells Used %HSused%`nSCB changes %SCBused%`nAuto Chaff %AutoChaff%`n.
WinMove, Usage_Info, , ((width/2)-100), 15
}
else
SplashTextOff
return



autoconfig:
Dropdownmodules = No More Moduels|Cargo Hatch|Chaff Launcher|Cockpit Canopy|Frame Shift Drive|Heat Sink Launcher|Life Support|Power Distributor|Power Plant|Sensors|Shield Booster|Shield Cell Bank|Shield Generator|Standard Docking Computer|Thrusters|Weapon ANY
DropdownSCBgroup = 0|1|2|3|4|5|6|7|8|9
Gui +AlwaysOnTop -caption
Gui, Add, Text, x52 y19 w90 h20 +Center, MODULES
Gui, Add, Text, x182 y9 w40 h30 +Center, SCB GROUP
Gui, Add, Text, x232 y19 w40 h20 +Center, COLD
Gui, Add, DropDownList, x22 y39 w150 h21 R16 vDDL1, %Dropdownmodules%
Gui, Add, DropDownList, x22 y59 w150 h21 R16 vDDL2, %Dropdownmodules%
Gui, Add, DropDownList, x22 y79 w150 h21 R16 vDDL3, %Dropdownmodules%
Gui, Add, DropDownList, x22 y99 w150 h21 R16 vDDL4, %Dropdownmodules%
Gui, Add, DropDownList, x22 y119 w150 h21 R16 vDDL5, %Dropdownmodules%
Gui, Add, DropDownList, x22 y149 w150 h21 R16 vDDL6, %Dropdownmodules%
Gui, Add, DropDownList, x22 y169 w150 h21 R16 vDDL7, %Dropdownmodules%
Gui, Add, DropDownList, x22 y189 w150 h21 R16 vDDL8, %Dropdownmodules%
Gui, Add, DropDownList, x22 y209 w150 h21 R16 vDDL9, %Dropdownmodules%
Gui, Add, DropDownList, x22 y229 w150 h21 R16 vDDL10, %Dropdownmodules%
Gui, Add, DropDownList, x22 y259 w150 h21 R16 vDDL11, %Dropdownmodules%
Gui, Add, DropDownList, x22 y279 w150 h21 R16 vDDL12, %Dropdownmodules%
Gui, Add, DropDownList, x22 y299 w150 h21 R16 vDDL13, %Dropdownmodules%
Gui, Add, DropDownList, x22 y319 w150 h21 R16 vDDL14, %Dropdownmodules%
Gui, Add, DropDownList, x22 y339 w150 h21 R16 vDDL15, %Dropdownmodules%
Gui, Add, DropDownList, x22 y369 w150 h21 R16 vDDL16, %Dropdownmodules%
Gui, Add, DropDownList, x22 y389 w150 h21 R16 vDDL17, %Dropdownmodules%
Gui, Add, DropDownList, x22 y409 w150 h21 R16 vDDL18, %Dropdownmodules%
Gui, Add, DropDownList, x22 y429 w150 h21 R16 vDDL19, %Dropdownmodules%
Gui, Add, DropDownList, x22 y449 w150 h21 R16 vDDL20, %Dropdownmodules%
Gui, Add, DropDownList, x22 y479 w150 h21 R16 vDDL21, %Dropdownmodules%
Gui, Add, DropDownList, x22 y499 w150 h21 R16 vDDL22, %Dropdownmodules%
Gui, Add, DropDownList, x22 y519 w150 h21 R16 vDDL23, %Dropdownmodules%
Gui, Add, DropDownList, x22 y539 w150 h21 R16 vDDL24, %Dropdownmodules%
Gui, Add, DropDownList, x22 y559 w150 h21 R16 vDDL25, %Dropdownmodules%
Gui, Add, DropDownList, x22 y589 w150 h21 R16 vDDL26, %Dropdownmodules%
Gui, Add, DropDownList, x22 y609 w150 h21 R16 vDDL27, %Dropdownmodules%
Gui, Add, DropDownList, x22 y629 w150 h21 R16 vDDL28, %Dropdownmodules%
Gui, Add, DropDownList, x22 y649 w150 h21 R16 vDDL29, %Dropdownmodules%
Gui, Add, DropDownList, x22 y669 w150 h21 R16 vDDL30, %Dropdownmodules%
Gui, Add, DropDownList, x22 y699 w150 h21 R16 vDDL31, %Dropdownmodules%
Gui, Add, DropDownList, x22 y719 w150 h21 R16 vDDL32, %Dropdownmodules%
Gui, Add, DropDownList, x22 y739 w150 h21 R16 vDDL33, %Dropdownmodules%
Gui, Add, DropDownList, x22 y759 w150 h21 R16 vDDL34, %Dropdownmodules%
Gui, Add, DropDownList, x22 y779 w150 h21 R16 vDDL35, %Dropdownmodules%
Gui, Add, DropDownList, x182 y39 w40 h21 R10 vDDG1, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y59 w40 h21 R10 vDDG2, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y79 w40 h21 R10 vDDG3, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y99 w40 h21 R10 vDDG4, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y119 w40 h21 R10 vDDG5, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y149 w40 h21 R10 vDDG6, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y169 w40 h21 R10 vDDG7, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y189 w40 h21 R10 vDDG8, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y209 w40 h21 R10 vDDG9, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y229 w40 h21 R10 vDDG10, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y259 w40 h21 R10 vDDG11, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y279 w40 h21 R10 vDDG12, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y299 w40 h21 R10 vDDG13, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y319 w40 h21 R10 vDDG14, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y339 w40 h21 R10 vDDG15, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y369 w40 h21 R10 vDDG16, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y389 w40 h21 R10 vDDG17, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y409 w40 h21 R10 vDDG18, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y429 w40 h21 R10 vDDG19, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y449 w40 h21 R10 vDDG20, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y479 w40 h21 R10 vDDG21, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y499 w40 h21 R10 vDDG22, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y519 w40 h21 R10 vDDG23, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y539 w40 h21 R10 vDDG24, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y559 w40 h21 R10 vDDG25, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y589 w40 h21 R10 vDDG26, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y609 w40 h21 R10 vDDG27, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y629 w40 h21 R10 vDDG28, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y649 w40 h21 R10 vDDG29, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y669 w40 h21 R10 vDDG30, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y699 w40 h21 R10 vDDG31, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y719 w40 h21 R10 vDDG32, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y739 w40 h21 R10 vDDG33, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y759 w40 h21 R10 vDDG34, %DropdownSCBgroup%
Gui, Add, DropDownList, x182 y779 w40 h21 R10 vDDG35, %DropdownSCBgroup%
Gui, Add, CheckBox, x242 y39 w20 h20 vDDV1, 
Gui, Add, CheckBox, x242 y59 w20 h20 vDDV2, 
Gui, Add, CheckBox, x242 y79 w20 h20 vDDV3, 
Gui, Add, CheckBox, x242 y99 w20 h20 vDDV4, 
Gui, Add, CheckBox, x242 y119 w20 h20 vDDV5, 
Gui, Add, CheckBox, x242 y149 w20 h20 vDDV6, 
Gui, Add, CheckBox, x242 y169 w20 h20 vDDV7, 
Gui, Add, CheckBox, x242 y189 w20 h20 vDDV8, 
Gui, Add, CheckBox, x242 y209 w20 h20 vDDV9, 
Gui, Add, CheckBox, x242 y229 w20 h20 vDDV10, 
Gui, Add, CheckBox, x242 y259 w20 h20 vDDV11, 
Gui, Add, CheckBox, x242 y279 w20 h20 vDDV12, 
Gui, Add, CheckBox, x242 y299 w20 h20 vDDV13, 
Gui, Add, CheckBox, x242 y319 w20 h20 vDDV14, 
Gui, Add, CheckBox, x242 y339 w20 h20 vDDV15, 
Gui, Add, CheckBox, x242 y369 w20 h20 vDDV16, 
Gui, Add, CheckBox, x242 y389 w20 h20 vDDV17, 
Gui, Add, CheckBox, x242 y409 w20 h20 vDDV18, 
Gui, Add, CheckBox, x242 y429 w20 h20 vDDV19, 
Gui, Add, CheckBox, x242 y449 w20 h20 vDDV20, 
Gui, Add, CheckBox, x242 y479 w20 h20 vDDV21, 
Gui, Add, CheckBox, x242 y499 w20 h20 vDDV22, 
Gui, Add, CheckBox, x242 y519 w20 h20 vDDV23, 
Gui, Add, CheckBox, x242 y539 w20 h20 vDDV24, 
Gui, Add, CheckBox, x242 y559 w20 h20 vDDV25, 
Gui, Add, CheckBox, x242 y589 w20 h20 vDDV26, 
Gui, Add, CheckBox, x242 y609 w20 h20 vDDV27, 
Gui, Add, CheckBox, x242 y629 w20 h20 vDDV28, 
Gui, Add, CheckBox, x242 y649 w20 h20 vDDV29, 
Gui, Add, CheckBox, x242 y669 w20 h20 vDDV30, 
Gui, Add, CheckBox, x242 y699 w20 h20 vDDV31, 
Gui, Add, CheckBox, x242 y719 w20 h20 vDDV32, 
Gui, Add, CheckBox, x242 y739 w20 h20 vDDV33, 
Gui, Add, CheckBox, x242 y759 w20 h20 vDDV34, 
Gui, Add, CheckBox, x242 y779 w20 h20 vDDV35, 
Gui, Add, Text, x2 y809 w270 h190 +Center, MODULES`nSet your modules types in the order they appere in`nin the power management screen`n`nSCB GROUP`nSet the group and order for SCB use.`nThere is a maximum of 2 SCB's per group.`nSCB group 1 is the SCB you initialy have on.`nA zero value or non SCB modules are not automated in SCB group changes.`n`nCOLD`nSet which moduels you want to be powered down for Running Cold.
Gui, Add, Button, x22 y1009 w90 h30 gShipSetupSave, Save Settings
Gui, Add, Button, x162 y1009 w90 h30 gShipSetupDone, When finished click here
; Generated using SmartGUI Creator 4.0
Gui, Show, x190 y2 h1049 w293, New GUI Window
Return



ShipSetupSave:
 Gui, Submit, NoHide
return



ShipSetupDone:
 Gui, Submit, NoHide
 Gui, Destroy
return



; ---------------------------------------------------------
; ---------------------------------------------------------
; ---------------- CHANGE POWERED CELL BANKS --------------
; ---------------------------------------------------------
; ---------------------------------------------------------



SCB_Set_One:
 sleep, 8000
 gosub Systems_Panel
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 5 ; ----------------- for a SINGLE SCB delete FROM THIS LINE (INCLUSIVE)
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 6
 gosub UI_Panel_Up ; ------ for a SINGLE SCB delete TO THIS LINE (INCLUSIVE)
 gosub Systems_Panel
SCBused ++
 gosub Equip_OSD
return



SCB_Set_Two:
 sleep, 8000
 gosub Systems_Panel
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 4
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 4
 gosub UI_Panel_Up
 gosub Systems_Panel
SCBused ++
 gosub Equip_OSD
return



; ---------------------------------------------------------
; ---------------------------------------------------------
; --------------------- IN GAME KEY BINDS ----------------- 
; ---------------------------------------------------------
; ---------------------------------------------------------



Deploy_Heat_Sink:
Sleep, 10
Send, {O down}
sleep, 15 ; -------------------- Deploy Heat Sink
send, {O up}
Sleep, 10
return



Use_Shield_Cell:
sleep, 10
Send, {P down}
sleep, 15 ; --------------------- Use Shield Cell
send, {P up}
sleep, 10
return



Use_Chaff_Launcher:
Sleep, 10
Send, {C down}
sleep, 15 ; ------------------ Use_Chaff_Launcher
send, {C up}
Sleep, 10
return



Target_Panel:
Sleep, 10
Send, {Z down}
sleep, 15 ; ----------------------- Target Panel
send, {Z up}
Sleep, 600
return



Systems_Panel:
Sleep, 10
Send, {X down}
sleep, 15 ; ----------------------- Systems Panel
send, {X up}
Sleep, 900
return



UI_Panel_Up:
Sleep, 10
Send, {up down}
Sleep, 15 ; ------------------------- UI Panel Up
send, {up up}
Sleep, 10
return



UI_Panel_Down:
Sleep, 10
Send, {Down down}
Sleep, 15 ; ----------------------- UI Panel down
send, {Down up}
Sleep, 10
return



UI_Panel_Select:
Sleep, 10
Send, {Insert down}
Sleep, 15 ; --------------------- UI Panel Select
send, {Insert up}
Sleep, 10
return



Next_Panel_Tab:
Sleep, 10
Send, {L down}
Sleep, 15 ; ---------------------- Next Panel Tab
send, {L up}
Sleep, 10
return
Ty for at least looking
User avatar
Xtra
Posts: 1382
Joined: 02 Oct 2015, 12:15

Re: ini read/write and a 105 variable GUI

09 May 2016, 22:19

This should give you some ideas:

Code: Select all

; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; -------------- BASIC GUIDE TO HELP UNDERSTAND WHAT TO EDIT IN THIS MACRO ---------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - This macro is split into 5 SECTIONs, each seperated by a titled header looking like this ---
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 1 is the macro's global effect settings which never need changing ------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 2 -- HOT KEY ACTIVATION ------------------------------------------------------------
; ---- the key pressed to trigger a macro routine is followed by a double colon :: -------------
; ---- the next line is GOSUB then LOGIC CORE name , or it's a single instruction --------------
; ---- avoid setting an activation key to any key you might need for typing in game messages ! -
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 3 -- LOGIC CORE --------------------------------------------------------------------
; ---- there are realy only two things you MIGHT EVER want to change here ----------------------
; --------- both are in the block ( MAIN_USE ) and part of the ( IF ) statements ---------------
; ---- the number of charges used before changing which SCB are powered ( HSused ) -------------
; --------- if your SCB dont have 5 charges change the numbers after the = signs ---------------
; ---- where the if jumps to ( SCB_Set_One/Two ) depending on your SCB piarings ----------------
; --------- most change requirements are in the change powered cell banks section --------------
; ----------------------------------------------------------------------------------------------
; -- NOTE to use a SINGLE SCB to charge shields set SCB_Set_Two as SCB_Set_One -----------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 4 -- CHANGE POWERED CELL BANKS --- ( default is for 2 SCB used simaltainiously ) ---
; ---- this is the sequence of keypresses , so changes here are likely to be needed ------------
; ---- the target name after each GOSUB is a single action (press/click of a button/key) -------
; ---- actions have the same names as in game key bindings (main menu -> options -> controls) --
; ---- for repeted actions LOOP, X repetes the action below X times ----------------------------
; ---- dont change the sleep numbers they allow you HS and SCB enough time to fire in game -----
; ---- befor changing this section write down the exact sequence to manualy change SCB in game -
; ----------------------------------------------------------------------------------------------
; -- NOTE to use a SINGLE SCB to charge shields delete the marked lines and the lines inbetween 
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; - SECTION 5 -- IN GAME KEY BINDS -------------------------------------------------------------
; ---- each block of code is labeled to the right with the in game key bindings name -----------
; ---------- these are also in the same order as the in game key bindings are listed -----------
; ---------- there also the start of each block as it is the name used for GOSUB to find them --
; ---- before editing write down your bindings or add secondary binds in game to match these ---
; ---- each action has 2 referances in this script , press (down) and relese (up) --------------
; ---------- these referances are on the lines imediatly above and below the labels ------------
; ---- sorry but you cannot set these to a hotas action , for this set a secondary binding -----
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ---------- DEFAULT ACTION KEYS SET -----------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ------------- F1 = Charge Shields (and swap SCB if needed ) ----------------------------------
; ------------- F2 = Target Power Plant ( not 100% perfect but CZ friendly ) -------------------
; ------------- F3 = AUTO Chaff (On/Off) --------------------------------------- Fix for duel --
; --------------F4 = Request Docking -----------------------------------------------------------
; ------------- F5 = Reset Charges Used ( for when you re-arm ) --------------------------------
; ------------- F6 = Increase Charges Used -----------------------------------------------------
; ------------- F7 = Decrese charges Used ------------------------------------------------------
; ------------- F8 = Increase SCB Chains Used --------------------------------------------------
; ------------- F9 = Decrese SCB Chains Used ---------------------------------------------------
; -------------F10 = Configue ship loadout ------------------------------------ not connected --
; ------------ F11 = Show Key Guide ( On / Off ) -----------------------------------------------
; ------------ F12 = Show Usage Counts ( On / Off) ---------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ---------- DEFAULT KEYS BINDINGS USED --------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; -------------- O = Deploy Heat Sink {letter o , not the number 0) ----------------------------
; -------------- P = Use Shield Cell -----------------------------------------------------------
; -------------- C = Use Chaff Launcher --------------------------------------------------------
; -------------- Z = Target Panel --------------------------------------------------------------
; -------------- X = Systems Panel -------------------------------------------------------------
; ------------- UP = UI Panel UP ---------------------------------------------------------------
; ----------- DOWN = UI Panel Down -------------------------------------------------------------
; --------- INSERT = UI Panel Select -----------------------------------------------------------
; -------------- L = Next Panel Tab ------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; --------------------------------------------------- AND FINALY -------------------------------
; ----------------------------------------------------------------------------------------------
; ------------------------------------------ FOR THIS TO WORK AS INTENDED ----------------------
; ----------------------------------------------------------------------------------------------
; ---------------------------------------------------- YOU MUST --------------------------------
; ----------------------------------------------------------------------------------------------
; -------------------------------------------- for ALL of the SCB functions --------------------
; ----------------------------- highlight the top scb in the Systems Panel and exit the panel --
; ----------------------------------------------------------------------------------------------
; -------------------------------------------- for the target PP function ----------------------
; ----------------------------- move to the contacts tab in the Target Panel , exit the panel --
; ----------------------------- a target must also be locked when you activate this ------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
; ----------------------------------------------------------------------------------------------
 
 
#maxThreadsPerHotkey, 2
; ------ #IfWinActive, Elite - Dangerous (CLIENT) ------ disabled for testing
#NoEnv
setkeydelay, 30, 30
hsused = 0
SCBused = 0
tChaff:=0
 gosub, autoconfig
 
 
; ---------------------------------------------------------
; ---------------------------------------------------------
; ------------------- HOT KEY ACTIVATION ------------------
; ---------------------------------------------------------
; ---------------------------------------------------------
 
 
 
F1::
 gosub MAIN_USE
return
 
 
 
F2::
 gosub POWER_PLANT
return
 
 
 
F3::
 gosub AUTOCHAFF
return
 
 
F4::
 gosub Target_Panel
 gosub Next_Panel_Tab
 gosub Next_Panel_Tab
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
return
 
 
 
F5::
 HSused = 0
 SCBused = 0
 gosub Equip_OSD
return
 
 
 
F6::
HSused ++
 gosub Equip_OSD
return
 
 
 
F7::
HSused --
 gosub Equip_OSD
return
 
 
 
F8::
SCBused ++
 gosub Equip_OSD
return
 
 
 
F9::
SCBused --
 gosub Equip_OSD
return
 
 
 
F10::
 gosub autoconfig
return
 
 
F11::
 gosub T_Key
return
 
 
 
F12::
 gosub T_OSD
return
 
 
 
; ---------------------------------------------------------
; ---------------------------------------------------------
; ----------------------- LOGIC CORE ----------------------
; ---------------------------------------------------------
; ---------------------------------------------------------
 
 
 
MAIN_USE:
 gosub Deploy_Heat_Sink
 Sleep, 1500
 gosub Use_Shield_Cell
HSused ++
 gosub Equip_OSD
 sleep, 10
if HSused = 5
 gosub SCB_Set_One
if HSused = 10
 gosub SCB_Set_One
if HSused = 15
 gosub SCB_Set_Two
return
 
 
 
POWER_PLANT:
 gosub Target_Panel
 gosub Next_Panel_Tab
loop, 6
 gosub UI_Panel_Up
 gosub UI_Panel_Select
 gosub Target_Panel
return
 
 
 
AUTOCHAFF:
 tChaff:=!tChaff
While (tChaff=1)
{
 gosub Use_Chaff_Launcher
 sleep, 15
 gosub Equip_OSD
 sleep, 500
 }
gosub Equip_OSD
return
 
 
 
T_Key:
 tKey := !tKey
 tOSD = 0
if tKey, 1
{
SysGet, width, 16
SplashTextOn, 200, 230, Key_Info, F1 = Charge Shields`nF2 = Target Power Plant`nF3 = AUTO Chaff`nF4 = Request Docking`nF5 = Reset Charges Used`nF6 = Increase Charges Used`nF7 = Decrese charges used`nF8 = Increase SCB used`nF9 = Decrease SCB used`nF10 = ship Setup menu`nF11 = This Key Guide`nF12 = Show Usage Counts.
WinMove, Key_Info, , ((width/2)-100), 15
}
else
SplashTextOff
return
 
 
 
T_OSD:
 tOSD := !tOSD
 tKey = 0
 gosub Equip_OSD
return
 
 
 
Equip_OSD:
if tChaff, 1
 AutoChaff = On
Else
 AutoChaff = Off
if tOSD, 1
{
SysGet, width, 16
SplashTextOn, 200, 60, Usage_Info, Shield Cells Used %HSused%`nSCB changes %SCBused%`nAuto Chaff %AutoChaff%`n.
WinMove, Usage_Info, , ((width/2)-100), 15
}
else
SplashTextOff
return
 
 
 
autoconfig:
gosub, Loadini
Dropdownmodules = No More Moduels|Cargo Hatch|Chaff Launcher|Cockpit Canopy|Frame Shift Drive|Heat Sink Launcher|Life Support|Power Distributor|Power Plant|Sensors|Shield Booster|Shield Cell Bank|Shield Generator|Standard Docking Computer|Thrusters|Weapon ANY
DropdownSCBgroup = 0|1|2|3|4|5|6|7|8|9
Gui +AlwaysOnTop -caption
Gui, Add, Text, x52 y19 w90 h20 +Center, MODULES
Gui, Add, Text, x182 y9 w40 h30 +Center, SCB GROUP
Gui, Add, Text, x232 y19 w40 h20 +Center, COLD
posY := 19
Loop, 35
{
	posY += 20
	Gui, Add, DropDownList, x22 y%posY% w150 h21 R16 vDDL%A_Index%, %Dropdownmodules%
	GuiControl, ChooseString, DDL%A_Index%, % DDL%A_Index%
	Gui, Add, DropDownList, x182 y%posY% w40 h21 R10 vDDG%A_Index%, %DropdownSCBgroup%
	GuiControl, ChooseString, DDG%A_Index%, % DDG%A_Index%
	isCheck := DDV%A_Index%
	Gui, Add, CheckBox, x242 y%posY% w20 h20 vDDV%A_Index% Checked%isCheck%,
}
Gui, Add, Text, x2 y809 w270 h190 +Center, MODULES`nSet your modules types in the order they appere in`nin the power management screen`n`nSCB GROUP`nSet the group and order for SCB use.`nThere is a maximum of 2 SCB's per group.`nSCB group 1 is the SCB you initialy have on.`nA zero value or non SCB modules are not automated in SCB group changes.`n`nCOLD`nSet which moduels you want to be powered down for Running Cold.
Gui, Add, Button, x22 y1009 w90 h30 gShipSetupSave, Save Settings
Gui, Add, Button, x162 y1009 w90 h30 gShipSetupDone, When finished click here
; Generated using SmartGUI Creator 4.0
Gui, Show, x190 y2 h1049 w293, New GUI Window
Return
 
 
 
ShipSetupSave:
 Gui, Submit, NoHide
 gosub, Saveini
return
 
 
 
ShipSetupDone:
 Gui, Submit, NoHide
 gosub, Saveini
 Gui, Destroy
return
 
 
 
Loadini:
Loop, 35
{
	IniRead, DDL%A_Index%, game.ini, Settings, DDL%A_Index%
	IniRead, DDG%A_Index%, game.ini, Settings, DDG%A_Index%
	IniRead, DDV%A_Index%, game.ini, Settings, DDV%A_Index%
}
return

Saveini:
Loop, 35
{
	IniWrite, % DDL%A_Index%, game.ini, Settings, DDL%A_Index%
	IniWrite, % DDG%A_Index%, game.ini, Settings, DDG%A_Index%
	IniWrite, % DDV%A_Index%, game.ini, Settings, DDV%A_Index%	
}
return
 
 
; ---------------------------------------------------------
; ---------------------------------------------------------
; ---------------- CHANGE POWERED CELL BANKS --------------
; ---------------------------------------------------------
; ---------------------------------------------------------
 
 
 
SCB_Set_One:
 sleep, 8000
 gosub Systems_Panel
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 5 ; ----------------- for a SINGLE SCB delete FROM THIS LINE (INCLUSIVE)
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 6
 gosub UI_Panel_Up ; ------ for a SINGLE SCB delete TO THIS LINE (INCLUSIVE)
 gosub Systems_Panel
SCBused ++
 gosub Equip_OSD
return
 
 
 
SCB_Set_Two:
 sleep, 8000
 gosub Systems_Panel
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 4
 gosub UI_Panel_Down
 gosub UI_Panel_Select
 gosub UI_Panel_Select
loop, 4
 gosub UI_Panel_Up
 gosub Systems_Panel
SCBused ++
 gosub Equip_OSD
return
 
 
 
; ---------------------------------------------------------
; ---------------------------------------------------------
; --------------------- IN GAME KEY BINDS ----------------- 
; ---------------------------------------------------------
; ---------------------------------------------------------
 
 
 
Deploy_Heat_Sink:
Sleep, 10
Send, {O down}
sleep, 15 ; -------------------- Deploy Heat Sink
send, {O up}
Sleep, 10
return
 
 
 
Use_Shield_Cell:
sleep, 10
Send, {P down}
sleep, 15 ; --------------------- Use Shield Cell
send, {P up}
sleep, 10
return
 
 
 
Use_Chaff_Launcher:
Sleep, 10
Send, {C down}
sleep, 15 ; ------------------ Use_Chaff_Launcher
send, {C up}
Sleep, 10
return
 
 
 
Target_Panel:
Sleep, 10
Send, {Z down}
sleep, 15 ; ----------------------- Target Panel
send, {Z up}
Sleep, 600
return
 
 
 
Systems_Panel:
Sleep, 10
Send, {X down}
sleep, 15 ; ----------------------- Systems Panel
send, {X up}
Sleep, 900
return
 
 
 
UI_Panel_Up:
Sleep, 10
Send, {up down}
Sleep, 15 ; ------------------------- UI Panel Up
send, {up up}
Sleep, 10
return
 
 
 
UI_Panel_Down:
Sleep, 10
Send, {Down down}
Sleep, 15 ; ----------------------- UI Panel down
send, {Down up}
Sleep, 10
return
 
 
 
UI_Panel_Select:
Sleep, 10
Send, {Insert down}
Sleep, 15 ; --------------------- UI Panel Select
send, {Insert up}
Sleep, 10
return
 
 
 
Next_Panel_Tab:
Sleep, 10
Send, {L down}
Sleep, 15 ; ---------------------- Next Panel Tab
send, {L up}
Sleep, 10
return
 
Geff T
Posts: 6
Joined: 07 May 2016, 15:16

Re: ini read/write and a 105 variable GUI

10 May 2016, 04:08

Xtra , wow ... ty ... a lot to digest with my morning coffee ...

so you have ...
looped most of the gui using 3 variables ypos + ischeck (which are straightforward and those names for ease of reading) + A_index (variable array). also you have added GUIcontrol to place the selected item into A_index.
the read/write ini (also looped) use A_index for the data stored in its array .

i think i see what is going on here , but dont feel confident that i could reproduce this if i needed to again . no matter at this point i only plan on the one project .
still i will spend the day reading and trying to force this to sink in , probably resulting in more question that i can hopefuly find answers to myself .

on a quick desktop try waiting for the kettle ....
your call to the GUI at start (i haddnt notice that change) was actualy kinda pointless as the game temporarily hides windows when active and you need to be ingame to fill in the GUI , but it gave me the logical idea to check if ''game.ini'' exists and if not pop a warning on screen .

TY again Xtra , this has probably saved me pulling out all of my hair (well whats left anyway)
Geff T
Posts: 6
Joined: 07 May 2016, 15:16

Re: ini read/write and a 105 variable GUI

11 May 2016, 23:20

ok i have carried on from there , getting into testing the validity of the selections made in the GUI (that Xtra showed me how to get working with loops and the loop counter above).
i have got the first set of tests working , tho the whole intended routine isnt complete yet.
i am sure this can be simplified , it even look a mess to me !

also a quick question .... could i gosub from the popup GUI's at the end of this back into the GUI that sent the code this way ? if noone answers i will try it when i get some time.
tested and worked


this is the relevent sections.

Code: Select all

testshipvalid:
; ------------------------------------------------------------------------------------------------------------
; -------------------------------------- MODUELS - check that there is . . . ---------------------------------
; --------------------- one each of ... power plant , Cockpit Canopy , Sensors , Thrusters -------------------
; --------------------- one each of ... Cargo Hatch , Frame Shift Drive , Life Support , Power Distributor ---
; --------------------- max of one  ... Shield Generator -----------------------------------------------------
; ------------------------------------------------------------------------------------------------------------
failteasnum = 0
toomany = 0
toofew = 0
loop, 9
{
testnum%A_Index% = 0
big%A_Index% = 0
small%A_Index% = 0
}
loop, 35
{
 if DDL%A_Index% = power plant
 testnum1 += 1
 if DDL%A_Index% = Cockpit Canopy
 testnum2 += 1
 if DDL%A_Index% = Sensors
 testnum3 += 1
 if DDL%A_Index% = Thrusters
 testnum4 += 1
 if DDL%A_Index% = Cargo Hatch
 testnum5 += 1
 if DDL%A_Index% = Frame Shift Drive
 testnum6 += 1
 if DDL%A_Index% = Life Support
 testnum7 += 1
 if DDL%A_Index% = Power Distributor
 testnum8 += 1
 if DDL%A_Index% = Shield Generator
 testnum9 += 1
}
loop, 8
{
if testnum%A_Index% > 1
 big%A_Index% = 1
if testnum%A_Index% = 0
 small%A_Index% = 1
}
if testnum9 > 1
 big9 = 1
;
;
;
; ---------------------------------------------S---B---
; ---------------------------------------------T---E--- check continuity of modules from first to last (no gaps)
; ---------------------------------------------I------
; ---------------------------------------------L---D-------------------- GROUPS
; ---------------------------------------------L---O--- clear all non SCB group settings
; -------------------------------------------------N--- confirm only max 2 SCB per group
; ---------------------------------------------T---E--- chech continuity for SCB groups ( 1 , 2 , 3 etc )
; ---------------------------------------------O-------
;
;
;
; -------------------------------------------------------------------------------------------------
; -------------------------------------------------- set a fail for every type of invalid setup ---
; -------------------------------------------------------------------------------------------------
loop, 9
{
 if big%A_Index% = 1
  failtestnum = 1
}
loop, 8
{
 if small%A_Index% = 1
  failtestnum = 1
}
; -------------------------------------------------------------------------------------------------
; ------------------------------------------------------------------ which error mesage to give ---
; -------------------------------------------------------------------------------------------------
if failtestnum = 1
 {
  loop, 9
   {
    if big%A_Index% = 1
     toomany = 1
   }
  loop, 8
   {
    if small%A_Index% = 1
     toofew = 1
   }
  if toomany = 1
   {
    toofew = 0
    gosub too_many
   }
  if toofew = 1
   gosub too_few
 }
return

too_many:
 Gui +AlwaysOnTop -caption
 Gui, Add, Text, x12 y9 w250 h30 +Center, `nThis ship has too many critical modules`n
 Gui, Add, Button, x77 y59 w100 h30 gOK, OK
 Gui, Show, x765 y413 h97 w278, New GUI Window
return



too_few:
 Gui +AlwaysOnTop -caption
 Gui, Add, Text, x12 y9 w250 h30 +Center, `nThis ship has too few critical modules`n
 Gui, Add, Button, x82 y59 w100 h30 gOK, OK
 Gui, Show, x765 y413 h97 w278, New GUI Window
return

Return to “Gaming”

Who is online

Users browsing this forum: Yeeeeeeeee and 30 guests