Jump to content

Regwrite newbie


Vindicator209
 Share

Recommended Posts

ok, so i have this simple little game im gonna present to my class as my talent project, but since i forgot to add a button to make a child GUI's the "weapon shop" i needed to creat a regwrite to save the current money score, but i SERIOUSLY dont know how to use regwrite, i just made it from the help file, but i dont know what it's gonna do, and im affraid it will mess up my computer could some of you really cool people check my script?

Global $Attack1 = 200
Global $AttackMin = 1
Global $ARMOR = 100
$Money = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\kyle\battle", "coins")

#include <GuiConstants.au3>

GuiCreate("Battle!", 222, 418,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Player 1", 10, 10, 200, 400)
$List_2 = GUICtrlCreateInput("", 20, 30, 180, 110)
$Button_3 = GuiCtrlCreateButton("Load", 20, 150, 180, 20)
$Combo_4 = GuiCtrlCreateCombo("Chest", 20, 180, 180, 21)
$1=GuiCtrlSetData($Combo_4,'Steel Plate')
$Combo_5 = GuiCtrlCreateCombo("Legs", 20, 210, 180, 21)
$2=GuiCtrlSetData($Combo_5,'Steel Plate Legs')
$Combo_6 = GuiCtrlCreateCombo("Weapon", 20, 240, 180, 21)
$3=GuiCtrlSetData($Combo_6,'Crystal Katana')
$Combo_7 = GuiCtrlCreateCombo("Gloves", 20, 270, 180, 21)
$4=GuiCtrlSetData($Combo_7,'Leather Steel-Lined')
$Combo_8 = GuiCtrlCreateCombo("MISC. 1", 20, 300, 180, 21)
$Combo_9 = GuiCtrlCreateCombo("MISC. 2", 20, 330, 180, 21)
$Combo_10 = GuiCtrlCreateCombo("MISC. 3", 20, 360, 180, 21)
$Button_11 = GuiCtrlCreateButton("FIGHT!", 20, 390, 180, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $Button_11
If GUICtrlRead($Combo_4) = ('Steel Plate') Then
    $ARMOR +=10
EndIf
If GUICtrlRead($Combo_5) = ('Steel Plate Legs') Then
                $ARMOR +=10 
                EndIf
If GUICtrlRead($Combo_6) = ('Crystal Katana') Then
$Attack1 +=10
$AttackMin += 100           
EndIf
If GUICtrlRead($Combo_7) = ('Leather Steel-Lined') Then
                    $ARMOR +=5
                    EndIf
If GUICtrlRead($Combo_8) = ('God Jewel') Then
    $Attack1 +=9999999999
    $AttackMin += 999999999
                        EndIf
If GUICtrlRead($Combo_9) = ('God Ring') Then
        $Attack1 +=9999999999
    $AttackMin += 999999999
                            EndIf
If GUICtrlRead($Combo_10) = ('God Amulet') Then
        $Attack1 +=9999999999
    $AttackMin += 999999999
            EndIf
$FIGHT= Random($AttackMin,$Attack1)
$armor1= $ARMOR
$Enemy= Random(50,200)
$ARMOR2=120

If $FIGHT < $ARMOR2 Then
    MsgBox(0,"Results", "You Lose!")
EndIf
If $FIGHT > $armor1 Then
    MsgBox(0,"Results", "You Win!")
    $Money += Random(10,100)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\kyle\battle", "coins","REG_SZ",$Money)
EndIf
        
    Case $msg = $Button_3
                If  GUICtrlRead($List_2) = "GOD MODE" Then
            $5=GUICtrlSetData($Combo_8,'God Jewel')
            $6=GUICtrlSetData($Combo_9,'God Ring')
            $7=GUICtrlSetData($Combo_10,'God Amulet')

            EndIf

    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

please list any errors and how to fix them, thanks!

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

ok, so i have this simple little game im gonna present to my class as my talent project, but since i forgot to add a button to make a child GUI's the "weapon shop" i needed to creat a regwrite to save the current money score, but i SERIOUSLY dont know how to use regwrite, i just made it from the help file, but i dont know what it's gonna do, and im affraid it will mess up my computer could some of you really cool people check my script?

Ok, your script does nothing dangerous to the registry - apart from that I guess there's quite a bit of work in there before it ready to fly - why not save ur settings in a file so its easier for u to see what's going on? Anyways, I'm unfortunately not in jive with autoit to an extend were I can help further :)

For ini usage:

IniWrite("C:\Temp\myfile.ini", "section2", "key", "this is a new value")
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...