Sign in to follow this  
Followers 0
SilkroakGEEK

PELASE HELP! Im going crazy!

6 posts in this topic

I'm having problem in writing the items or data from the listbox to a file. Please could someone help me correct it.. I'm almost getting crazy! Just a noob here!

This script should write something to a section from a INI file

for example

[AttackSkill]

Count=5

1=Skill1

2=Skill2

3=Skill3

4=Skill4

5=skill5

Here's my code!

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListBox.au3>
#include <File.au3>

;Weapon Masteries

$Bicheon = "Strike n' smash|Stab n' smash|Crosswise smash|Illusion chain|Blood chain|Billow chain|Ascension chain|Heaven chain|Castle shield|Mountain shield|Ironwall shield|Soul cut blade|Evil cut blade|Devil cut blade|Blood blade force|Soul blade force|Demon blade force|Flower bloom blade|Flower bud blade|Dragon Sore blade|Snake sword dance|Petal sword dance"
$Heuksal = "Wolf bite spear|Waning moon spear|Yuhon spear|Bloody fan storm|Bloody wolf storm|Bloody snake storm|Dancing demon spear|Jade breaking spear|Spirit crash spear|Soul spear-Move|Soul spear-Truth|Soul spear-Soul|Ghost spear-Petal|Ghost spear-Prince|Ghost spear-Mars|Chain spear-Tiger|Chain spear-Nachal|Chain spear-Shura|Chain spear-Pluto|Chain spear-Dragon|Flying dragon-Flow|Flying dragon-Fly"
$Pacheon = "Anti devil bow-Missile|Anti devil bow-Wave|Anti devil bow-Steel|2 Arrow combo|3 Arrow combo|4 Arrow combo|White hawk summon|Black hawk summon|Blue hawk summon|Autumn wind-Flame|Autumn wind-Snake|Autumn wind-Blood|Demon soul arrow|Bloody soul arrow|Dragon soul arrow|Berserker arrow|Demon arrow|Devil arrow|Strong bow-Spirit|Strong bow-Vision|Mind Bow - Flower|Mind Bow - Butterfly"

;Force Masteries
$Imbue1 = "Ice river force|Ice jade force|Ice ocean force|Ice Cloud Force"
$Imbue2 = "Thundertiger force|Thundersky force|Thunderking force|Thunderdragon force"
$Imbue3 = "River fire force|Extreme fire force|Poison fire force|Soul fire force"
$Cold = "Weak guard of ice|Soft guard of ice|Power guard of ice|Might Guard of Ice|Cold wave-Arrest|Cold wave-Binding|Cold wave-Shackle|Crystal wall|Snow wall|Extreme wall|Frost nova-Wind|Frost nova-Woods|Frost Nova Storm|Snow storm-Ice shot|Snow strom-Ice rain"
$Lightning = "Must-Piercing force|Flow-Piercing force|Speed-Piercing force|Force-Piercing Force|Grass walk-Flow|Ghost walk-phantom|Grass walk-Speed|Shock lion shout|Heaven lion shout|Earth lion shout|Concentration-1st|Concentration-2nd|Concentration-3rd|Wolf's thunderbolt|Tiger's thunderbolt"
$Fire = "Fire shield-Phoenix|Fire shield-Flower|Fire shield-King|Fire Shield-Emperor|Flame body-Wisdom|Flame body-Extreme|Basic fire protection|Divine fire protection|Hard fire protection|Fire wall-Tower|Fire wall-Mountain|Fire wall-Castle|Flame wave-Arrow|Flame wave-Burning|Flame wave-Wide|Flame wave-Bomb"
$ForceM = "|"

#Region ### START Koda GUI section ### Form=e:\documents and settings\professional xp\my documents\appz\easyskills\backup.kxf
$Main = GUICreate("By: Jimtags & DanteBax", 278, 402, 309, 144)
$Group1 = GUICtrlCreateGroup("Available Skills", 1, 24, 145, 316)
$Skills = GUICtrlCreateList("", 3, 40, 141, 240, BitOR($LBS_SORT,$LBS_STANDARD,$WS_VSCROLL,$WS_BORDER,$LBS_EXTENDEDSEL))
$SkillImbue = GUICtrlCreateList("", 3, 279, 141, 58)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Attack Skills", 149, 24, 129, 124)
$Attack = GUICtrlCreateList("", 151, 40, 124, 84, BitOR($WS_VSCROLL,$WS_BORDER))
$Addattack = GUICtrlCreateButton("Add", 153, 126, 49, 17, $BS_FLAT)
$RemoveAttack = GUICtrlCreateButton("Remove", 222, 126, 51, 17, $BS_FLAT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Buff Skills", 149, 152, 129, 123)
$Buff = GUICtrlCreateList("", 151, 168, 124, 84, BitOR($WS_VSCROLL,$WS_BORDER))
$AddBuff = GUICtrlCreateButton("Add", 153, 253, 50, 17, $BS_FLAT)
$RemoveBuff = GUICtrlCreateButton("Remove", 223, 253, 51, 17, $BS_FLAT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Imbue", 149, 278, 129, 62)
$Imbue = GUICtrlCreateList("", 151, 296, 124, 20)
GUICtrlSetState($imbue, $GUI_DISABLE)
$AddImbue = GUICtrlCreateButton("Add", 152, 318, 52, 17, $BS_FLAT)
$RemoveImbue = GUICtrlCreateButton("Remove", 224, 318, 49, 17, $BS_FLAT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Weapon = GUICtrlCreateCombo("[ Weapon ]", 2, 3, 77, 25)
GUICtrlSetData(-1, "Bicheon|Heuksal|Pacheon")
$Force = GUICtrlCreateCombo("[ Force ]", 82, 3, 65, 25)
GUICtrlSetData(-1, "Cold|Lightning|Fire|Force")
$Level = GUICtrlCreateCheckbox("Check if skill is level 1", 151, 5, 129, 17)
$Username = GUICtrlCreateInput("Username", 1, 341, 105, 21)
$Character = GUICtrlCreateInput("Character Name", 110, 341, 105, 21)
$Create = GUICtrlCreateButton("Create", 218, 341, 59, 21, $BS_FLAT)
$Group5 = GUICtrlCreateGroup("", 0, 358, 278, 44)
$Credits = GUICtrlCreateLabel("SibiPrecincts easy skill configuration beta version", 20, 368, 235, 17, $SS_CENTER)
$Credits2 = GUICtrlCreateLabel("Shinobi Developers - 2009", 74, 384, 129, 13, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Weapon
        _Weapon()
    Case $Force
        _Force()
    Case $Addattack
        _GUICtrlListBox_BeginUpdate($Skills)
        _GUICtrlListBox_GetCurSel($Skills)
        _GUICtrlListBox_AddString($Attack, GUICtrlRead($Skills))
        _GUICtrlListBox_EndUpdate($Skills)
    Case $RemoveAttack
        $Selected = _GUICtrlListBox_GetCurSel($Attack)
        _GUICtrlListBox_DeleteString($Attack, $Selected)
    Case $AddBuff
        _GUICtrlListBox_AddString($Buff, GUICtrlRead($Skills))
    Case $RemoveBuff
        $Selected = _GUICtrlListBox_GetCurSel($Buff)
        _GUICtrlListBox_DeleteString($Buff, $Selected)
    Case $AddImbue
        GUICtrlSetData($Imbue, "")
        _GUICtrlListBox_AddString($Imbue, GUICtrlRead($SkillImbue))
    Case $RemoveImbue
        GUICtrlSetData($Imbue, "")
    Case $Create
        _Write()
EndSwitch
WEnd

Func _Weapon()
    GUICtrlSetData($Skills, "")
    $data = GUICtrlRead($Weapon)
    if $data = "Bicheon" Then
        GUICtrlSetData($Skills, $Bicheon)
    EndIf
    if $data = "Heuksal" Then
        GUICtrlSetData($Skills, $Heuksal)
    EndIf
    if $data = "Pacheon" Then
        GUICtrlSetData($Skills, $Pacheon)
    EndIf
EndFunc

Func _Force()
    GUICtrlSetData($Skills, "")
    GUICtrlSetData($SkillImbue, "")
    $data = GUICtrlRead($Force)
    if $data = "Cold" Then
        GUICtrlSetData($Skills, $Cold)
        GUICtrlSetData($SkillImbue, $Imbue1)
    EndIf
    if $data = "Lightning" Then
        GUICtrlSetData($Skills, $Lightning)
        GUICtrlSetData($SkillImbue, $Imbue2)
    EndIf
    if $data = "Fire" Then
        GUICtrlSetData($Skills, $Fire)
        GUICtrlSetData($SkillImbue, $Imbue3)
    EndIf
EndFunc

Func _Write()
    IniWriteSection(@ScriptDir & "\" & GUICtrlRead($Username) & "_" & GUICtrlRead($Character) & ".ini", "Attackskill", "MY PROBLEM is not writing")
EndFunc

Share this post


Link to post
Share on other sites



put a

msgbox(0,"",@error) after your iniwritesection

whats it say?


Giggity

Share this post


Link to post
Share on other sites

put a

msgbox(0,"",@error) after your iniwritesection

whats it say?

It says 0

bcoz this 1 is writing it... but i want to write the data from the $Attack list

Func _Write()
    IniWriteSection(@ScriptDir & "\" & GUICtrlRead($Username) & "_" & GUICtrlRead($Character) & ".ini", "Attackskill", "MY PROBLEM is not writing")
EndFunc

Share this post


Link to post
Share on other sites

It says 0

bcoz this 1 is writing it... but i want to write the data from the $Attack list

Func _Write()
    IniWriteSection(@ScriptDir & "\" & GUICtrlRead($Username) & "_" & GUICtrlRead($Character) & ".ini", "Attackskill", "MY PROBLEM is not writing")
EndFunc
Something like this should work inside your _Write() function:

$count = _GUICtrlListBox_GetCount($attack)
For $i = 0 to $count
     $text = _GUICtrlListBox_GetText($attack, $i)
     IniWrite(@ScriptDir & "\" & GUICtrlRead($Username) & "_" & GUICtrlRead($Character) & ".ini", "Attackskill", "$i", "$text" )
Next

[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites

Something like this should work inside your _Write() function:

$count = _GUICtrlListBox_GetCount($attack)
For $i = 0 to $count
     $text = _GUICtrlListBox_GetText($attack, $i)
     IniWrite(@ScriptDir & "\" & GUICtrlRead($Username) & "_" & GUICtrlRead($Character) & ".ini", "Attackskill", "$i", "$text" )
Next
Its writing now thanks 'magload' but i want it to look like this

Count=5 <----I want to count the the skills

1=Skill1

2=Skill2

3=Skill3

4=Skill4

5=Skill5

The code you give is writing like this

1=Skill1

2=Skill2

3=Skill3

4=Skill4

5=skill5

6=0 <----Can i get rid of this one? and no Count=XX!

Share this post


Link to post
Share on other sites

Its writing now thanks 'magload' but i want it to look like this

Count=5 <----I want to count the the skills

1=Skill1

2=Skill2

3=Skill3

4=Skill4

5=Skill5

The code you give is writing like this

1=Skill1

2=Skill2

3=Skill3

4=Skill4

5=skill5

6=0 <----Can i get rid of this one? and no Count=XX!

well you have the count from $count = _GUICtrlListBox_GetCount($attack), just use the iniwrite the same way but use $count instead of the listbox contents when you write.

and sorry, it should have been: for $i = 0 to $count - 1


[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
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
Sign in to follow this  
Followers 0