Sign in to follow this  
Followers 0
Rorka

Filereadline?

12 posts in this topic

Ok... well im stuck on making it load all previous people and ticket numbers added before it was closed.

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

#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("Eternal Guardians Lottery System", 450, 438)
$ListView1 = GUICtrlCreateListView("Player|# Tickets", 216, 8, 226, 422)
GUICtrlSendMsg(-1, 0x101E, 0, 150)
GUICtrlSendMsg(-1, 0x101E, 1, 70)
$Label3 = GUICtrlCreateLabel("", 96, 48, 4, 4)
$Group1 = GUICtrlCreateGroup("Information:", 8, 0, 201, 89)
$Label1 = GUICtrlCreateLabel("Each Ticket costs 1G", 16, 16, 107, 17)
$Label2 = GUICtrlCreateLabel("You need 2 numbers to get gold back!", 16, 32, 190, 17)
$Label4 = GUICtrlCreateLabel("See our website for more details", 16, 48, 190, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Addplayer = GUICtrlCreateButton("Add a player", 8, 120, 203, 25, 0)
$Drawnum1 = GUICtrlCreateButton("Draw First Number", 8, 152, 203, 25, 0)
$Drawnum2 = GUICtrlCreateButton("Draw Second Number", 8, 184, 203, 25, 0)
$drawnum3 = GUICtrlCreateButton("Draw Third Number", 8, 216, 203, 25, 0)
$Drawnum4 = GUICtrlCreateButton("Draw Forth Number", 8, 248, 203, 25, 0)
$drawnum5 = GUICtrlCreateButton("Draw Fifth Number", 8, 280, 203, 25, 0)
$Drawnum6 = GUICtrlCreateButton("Draw Sixth Number", 8, 312, 203, 25, 0)
$Number1 = GUICtrlCreateInput("#1", 8, 96, 25, 21)
$Number2 = GUICtrlCreateInput("#2", 40, 96, 25, 21)
$Number3 = GUICtrlCreateInput("#3", 72, 96, 25, 21)
$Number4 = GUICtrlCreateInput("#4", 104, 96, 25, 21)
$Number5 = GUICtrlCreateInput("#5", 136, 96, 25, 21)
$Number6 = GUICtrlCreateInput("#6", 168, 96, 25, 21)
$Madeby = GUICtrlCreateLabel("Made by: Dathos!", 16, 368, 189, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Load()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Addplayer
            $charname = InputBox("Eternal Guardians Lottery System", " Please enter the Characters name", "", "", 300, 120)
            $Numticket = InputBox("Eternal Guardians Lottery System", " Please enter the Number of tickets", "", "", 300, 120)
            $ListView1_0 = GUICtrlCreateListViewItem($charname &"|"&$Numticket, $ListView1)
            FileWriteLine("Tickets.txt",$charname &"|"&$Numticket)
            
        Case $Drawnum1
            $randomletter1 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum1 = Random(1, 99, 1)
            GUICtrlSetData($Number1, $randomletter1 & $randomnum1)
            
        Case $Drawnum2
            $randomletter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum2 = Random(1, 99, 1)
            GUICtrlSetData($Number2, $randomletter2 & $randomnum2)
            
        Case $Drawnum3
            $randomletter3 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum3 = Random(1, 99, 1)
            GUICtrlSetData($Number3, $randomletter3 & $randomnum3)
            
        Case $Drawnum4
            $randomletter4 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum4 = Random(1, 99, 1)
            GUICtrlSetData($Number4, $randomletter4 & $randomnum4)
            
        Case $Drawnum5
            $randomletter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum5 = Random(1, 99, 1)
            GUICtrlSetData($Number5, $randomletter5 & $randomnum5)
            
        Case $Drawnum6
            $randomletter6 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum6 = Random(1, 99, 1)
            GUICtrlSetData($Number6, $randomletter6 & $randomnum6)
            
    EndSwitch
WEnd


Func Load()
Do 
    $loadingfile = FileReadLine("Tickets.txt")
    $ListView1_0 = GUICtrlCreateListViewItem($loadingfile, $ListView1)
Until FileReadLine("Tickets.txt") = ""

EndFunc

Any ideas?

Share this post


Link to post
Share on other sites



Ok... well im stuck on making it load all previous people and ticket numbers added before it was closed.

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

#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("Eternal Guardians Lottery System", 450, 438)
$ListView1 = GUICtrlCreateListView("Player|# Tickets", 216, 8, 226, 422)
GUICtrlSendMsg(-1, 0x101E, 0, 150)
GUICtrlSendMsg(-1, 0x101E, 1, 70)
$Label3 = GUICtrlCreateLabel("", 96, 48, 4, 4)
$Group1 = GUICtrlCreateGroup("Information:", 8, 0, 201, 89)
$Label1 = GUICtrlCreateLabel("Each Ticket costs 1G", 16, 16, 107, 17)
$Label2 = GUICtrlCreateLabel("You need 2 numbers to get gold back!", 16, 32, 190, 17)
$Label4 = GUICtrlCreateLabel("See our website for more details", 16, 48, 190, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Addplayer = GUICtrlCreateButton("Add a player", 8, 120, 203, 25, 0)
$Drawnum1 = GUICtrlCreateButton("Draw First Number", 8, 152, 203, 25, 0)
$Drawnum2 = GUICtrlCreateButton("Draw Second Number", 8, 184, 203, 25, 0)
$drawnum3 = GUICtrlCreateButton("Draw Third Number", 8, 216, 203, 25, 0)
$Drawnum4 = GUICtrlCreateButton("Draw Forth Number", 8, 248, 203, 25, 0)
$drawnum5 = GUICtrlCreateButton("Draw Fifth Number", 8, 280, 203, 25, 0)
$Drawnum6 = GUICtrlCreateButton("Draw Sixth Number", 8, 312, 203, 25, 0)
$Number1 = GUICtrlCreateInput("#1", 8, 96, 25, 21)
$Number2 = GUICtrlCreateInput("#2", 40, 96, 25, 21)
$Number3 = GUICtrlCreateInput("#3", 72, 96, 25, 21)
$Number4 = GUICtrlCreateInput("#4", 104, 96, 25, 21)
$Number5 = GUICtrlCreateInput("#5", 136, 96, 25, 21)
$Number6 = GUICtrlCreateInput("#6", 168, 96, 25, 21)
$Madeby = GUICtrlCreateLabel("Made by: Dathos!", 16, 368, 189, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Load()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Addplayer
            $charname = InputBox("Eternal Guardians Lottery System", " Please enter the Characters name", "", "", 300, 120)
            $Numticket = InputBox("Eternal Guardians Lottery System", " Please enter the Number of tickets", "", "", 300, 120)
            $ListView1_0 = GUICtrlCreateListViewItem($charname &"|"&$Numticket, $ListView1)
            FileWriteLine("Tickets.txt",$charname &"|"&$Numticket)
            
        Case $Drawnum1
            $randomletter1 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum1 = Random(1, 99, 1)
            GUICtrlSetData($Number1, $randomletter1 & $randomnum1)
            
        Case $Drawnum2
            $randomletter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum2 = Random(1, 99, 1)
            GUICtrlSetData($Number2, $randomletter2 & $randomnum2)
            
        Case $Drawnum3
            $randomletter3 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum3 = Random(1, 99, 1)
            GUICtrlSetData($Number3, $randomletter3 & $randomnum3)
            
        Case $Drawnum4
            $randomletter4 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum4 = Random(1, 99, 1)
            GUICtrlSetData($Number4, $randomletter4 & $randomnum4)
            
        Case $Drawnum5
            $randomletter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum5 = Random(1, 99, 1)
            GUICtrlSetData($Number5, $randomletter5 & $randomnum5)
            
        Case $Drawnum6
            $randomletter6 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum6 = Random(1, 99, 1)
            GUICtrlSetData($Number6, $randomletter6 & $randomnum6)
            
    EndSwitch
WEnd


Func Load()
Do 
    $loadingfile = FileReadLine("Tickets.txt")
    $ListView1_0 = GUICtrlCreateListViewItem($loadingfile, $ListView1)
Until FileReadLine("Tickets.txt") = ""

EndFunc

Any ideas?

We would need some more information on what you're trying to do....

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Its a lottery System for my Guild...

But im stuck on loading the players names and amount of tickets into the list view... Becasue some not all members will sign up at the same time, so i need to be able to close it and carry on later

this part of the code is whats incorrect

Func Load()
Do 
    $loadingfile = FileReadLine("Tickets.txt")
    $ListView1_0 = GUICtrlCreateListViewItem($loadingfile, $ListView1)
Until FileReadLine("Tickets.txt") = ""

EndFunc

EDIT: If you run the first script and add a player, close it and start again, you will see what i meen

Edited by Rorka

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Its a lottery System for my Guild...

But im stuck on loading the players names and amount of tickets into the list view... Becasue some not all members will sign up at the same time, so i need to be able to close it and carry on later

this part of the code is whats incorrect

Func Load()
Do 
    $loadingfile = FileReadLine("Tickets.txt")
    $ListView1_0 = GUICtrlCreateListViewItem($loadingfile, $ListView1)
Until FileReadLine("Tickets.txt") = ""

EndFunc

EDIT: If you run the first script and add a player, close it and start again, you will see what i meen

Fixed it for you

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

#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("Eternal Guardians Lottery System", 450, 438)
$ListView1 = GUICtrlCreateListView("Player|# Tickets", 216, 8, 226, 422)
GUICtrlSendMsg(-1, 0x101E, 0, 150)
GUICtrlSendMsg(-1, 0x101E, 1, 70)
$Label3 = GUICtrlCreateLabel("", 96, 48, 4, 4)
$Group1 = GUICtrlCreateGroup("Information:", 8, 0, 201, 89)
$Label1 = GUICtrlCreateLabel("Each Ticket costs 1G", 16, 16, 107, 17)
$Label2 = GUICtrlCreateLabel("You need 2 numbers to get gold back!", 16, 32, 190, 17)
$Label4 = GUICtrlCreateLabel("See our website for more details", 16, 48, 190, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Addplayer = GUICtrlCreateButton("Add a player", 8, 120, 203, 25, 0)
$Drawnum1 = GUICtrlCreateButton("Draw First Number", 8, 152, 203, 25, 0)
$Drawnum2 = GUICtrlCreateButton("Draw Second Number", 8, 184, 203, 25, 0)
$drawnum3 = GUICtrlCreateButton("Draw Third Number", 8, 216, 203, 25, 0)
$Drawnum4 = GUICtrlCreateButton("Draw Forth Number", 8, 248, 203, 25, 0)
$drawnum5 = GUICtrlCreateButton("Draw Fifth Number", 8, 280, 203, 25, 0)
$Drawnum6 = GUICtrlCreateButton("Draw Sixth Number", 8, 312, 203, 25, 0)
$Number1 = GUICtrlCreateInput("#1", 8, 96, 25, 21)
$Number2 = GUICtrlCreateInput("#2", 40, 96, 25, 21)
$Number3 = GUICtrlCreateInput("#3", 72, 96, 25, 21)
$Number4 = GUICtrlCreateInput("#4", 104, 96, 25, 21)
$Number5 = GUICtrlCreateInput("#5", 136, 96, 25, 21)
$Number6 = GUICtrlCreateInput("#6", 168, 96, 25, 21)
$Madeby = GUICtrlCreateLabel("Made by: Dathos!", 16, 368, 189, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Load()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Addplayer
            $charname = InputBox("Eternal Guardians Lottery System", " Please enter the Characters name", "", "", 300, 120)
            $Numticket = InputBox("Eternal Guardians Lottery System", " Please enter the Number of tickets", "", "", 300, 120)
            $ListView1_0 = GUICtrlCreateListViewItem($charname &"|"&$Numticket, $ListView1)
            IniWrite("f:\something.ini", "Players", "Player", $charname)
            IniWrite("f:\something.ini", "Tickets", "Ticket", $Numticket)

            
        Case $Drawnum1
            $randomletter1 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum1 = Random(1, 99, 1)
            GUICtrlSetData($Number1, $randomletter1 & $randomnum1)
            
        Case $Drawnum2
            $randomletter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum2 = Random(1, 99, 1)
            GUICtrlSetData($Number2, $randomletter2 & $randomnum2)
            
        Case $Drawnum3
            $randomletter3 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum3 = Random(1, 99, 1)
            GUICtrlSetData($Number3, $randomletter3 & $randomnum3)
            
        Case $Drawnum4
            $randomletter4 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum4 = Random(1, 99, 1)
            GUICtrlSetData($Number4, $randomletter4 & $randomnum4)
            
        Case $Drawnum5
            $randomletter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum5 = Random(1, 99, 1)
            GUICtrlSetData($Number5, $randomletter5 & $randomnum5)
            
        Case $Drawnum6
            $randomletter6 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum6 = Random(1, 99, 1)
            GUICtrlSetData($Number6, $randomletter6 & $randomnum6)
            
    EndSwitch
WEnd


Func Load()
    $PlayerIni = IniRead ( "f:\something.ini", "Players", "Player", "Player not found" )
    $TicketIni = IniRead ( "f:\something.ini", "Tickets", "Ticket", "Ticket not found" )
    
    $ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & " " &  $TicketIni , $ListView1)
EndFunc

I tried entering Player Crabs and Ticket 2. After restarting the programm it inserted those values in the ListView.

Edited by Qousio

Share this post


Link to post
Share on other sites

Fixed it for you

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

#Region ### START Koda GUI section ### Form=
$MainGUI = GUICreate("Eternal Guardians Lottery System", 450, 438)
$ListView1 = GUICtrlCreateListView("Player|# Tickets", 216, 8, 226, 422)
GUICtrlSendMsg(-1, 0x101E, 0, 150)
GUICtrlSendMsg(-1, 0x101E, 1, 70)
$Label3 = GUICtrlCreateLabel("", 96, 48, 4, 4)
$Group1 = GUICtrlCreateGroup("Information:", 8, 0, 201, 89)
$Label1 = GUICtrlCreateLabel("Each Ticket costs 1G", 16, 16, 107, 17)
$Label2 = GUICtrlCreateLabel("You need 2 numbers to get gold back!", 16, 32, 190, 17)
$Label4 = GUICtrlCreateLabel("See our website for more details", 16, 48, 190, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Addplayer = GUICtrlCreateButton("Add a player", 8, 120, 203, 25, 0)
$Drawnum1 = GUICtrlCreateButton("Draw First Number", 8, 152, 203, 25, 0)
$Drawnum2 = GUICtrlCreateButton("Draw Second Number", 8, 184, 203, 25, 0)
$drawnum3 = GUICtrlCreateButton("Draw Third Number", 8, 216, 203, 25, 0)
$Drawnum4 = GUICtrlCreateButton("Draw Forth Number", 8, 248, 203, 25, 0)
$drawnum5 = GUICtrlCreateButton("Draw Fifth Number", 8, 280, 203, 25, 0)
$Drawnum6 = GUICtrlCreateButton("Draw Sixth Number", 8, 312, 203, 25, 0)
$Number1 = GUICtrlCreateInput("#1", 8, 96, 25, 21)
$Number2 = GUICtrlCreateInput("#2", 40, 96, 25, 21)
$Number3 = GUICtrlCreateInput("#3", 72, 96, 25, 21)
$Number4 = GUICtrlCreateInput("#4", 104, 96, 25, 21)
$Number5 = GUICtrlCreateInput("#5", 136, 96, 25, 21)
$Number6 = GUICtrlCreateInput("#6", 168, 96, 25, 21)
$Madeby = GUICtrlCreateLabel("Made by: Dathos!", 16, 368, 189, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Load()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Addplayer
            $charname = InputBox("Eternal Guardians Lottery System", " Please enter the Characters name", "", "", 300, 120)
            $Numticket = InputBox("Eternal Guardians Lottery System", " Please enter the Number of tickets", "", "", 300, 120)
            $ListView1_0 = GUICtrlCreateListViewItem($charname &"|"&$Numticket, $ListView1)
            IniWrite("f:\something.ini", "Players", "Player", $charname)
            IniWrite("f:\something.ini", "Tickets", "Ticket", $Numticket)

            
        Case $Drawnum1
            $randomletter1 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum1 = Random(1, 99, 1)
            GUICtrlSetData($Number1, $randomletter1 & $randomnum1)
            
        Case $Drawnum2
            $randomletter2 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum2 = Random(1, 99, 1)
            GUICtrlSetData($Number2, $randomletter2 & $randomnum2)
            
        Case $Drawnum3
            $randomletter3 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum3 = Random(1, 99, 1)
            GUICtrlSetData($Number3, $randomletter3 & $randomnum3)
            
        Case $Drawnum4
            $randomletter4 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum4 = Random(1, 99, 1)
            GUICtrlSetData($Number4, $randomletter4 & $randomnum4)
            
        Case $Drawnum5
            $randomletter5 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum5 = Random(1, 99, 1)
            GUICtrlSetData($Number5, $randomletter5 & $randomnum5)
            
        Case $Drawnum6
            $randomletter6 = Chr(Random(Asc("A"), Asc("Z"), 1))
            $randomnum6 = Random(1, 99, 1)
            GUICtrlSetData($Number6, $randomletter6 & $randomnum6)
            
    EndSwitch
WEnd


Func Load()
    $PlayerIni = IniRead ( "f:\something.ini", "Players", "Player", "Player not found" )
    $TicketIni = IniRead ( "f:\something.ini", "Tickets", "Ticket", "Ticket not found" )
    
    $ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & " " &  $TicketIni , $ListView1)
EndFunc

I tried entering Player Crabs and Ticket 2. After restarting the programm it inserted those values in the ListView.

Not what im looking for sorry...

it doesnt work if there more than one player

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Not what im looking for sorry...

it doesnt work if there more than one player

You can adjust it for any amount of players. Ever heard of the "For...To...Step...Next" loop?

Edited by Qousio

Share this post


Link to post
Share on other sites

You can adjust it for any amount of players. Ever heard of the "For...In...Next" loop?

Sorry! im quite new to this - i dont understand... And could the number of please be unlimited?

Share this post


Link to post
Share on other sites

Sorry! im quite new to this - i dont understand... And could the number of please be unlimited?

CODE
#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <ListViewConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

Global $a=0

#Region ### START Koda GUI section ### Form=

$MainGUI = GUICreate("Eternal Guardians Lottery System", 450, 438)

$ListView1 = GUICtrlCreateListView("Player|# Tickets", 216, 8, 226, 422)

GUICtrlSendMsg(-1, 0x101E, 0, 150)

GUICtrlSendMsg(-1, 0x101E, 1, 70)

$Label3 = GUICtrlCreateLabel("", 96, 48, 4, 4)

$Group1 = GUICtrlCreateGroup("Information:", 8, 0, 201, 89)

$Label1 = GUICtrlCreateLabel("Each Ticket costs 1G", 16, 16, 107, 17)

$Label2 = GUICtrlCreateLabel("You need 2 numbers to get gold back!", 16, 32, 190, 17)

$Label4 = GUICtrlCreateLabel("See our website for more details", 16, 48, 190, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Addplayer = GUICtrlCreateButton("Add a player", 8, 120, 203, 25, 0)

$Drawnum1 = GUICtrlCreateButton("Draw First Number", 8, 152, 203, 25, 0)

$Drawnum2 = GUICtrlCreateButton("Draw Second Number", 8, 184, 203, 25, 0)

$drawnum3 = GUICtrlCreateButton("Draw Third Number", 8, 216, 203, 25, 0)

$Drawnum4 = GUICtrlCreateButton("Draw Forth Number", 8, 248, 203, 25, 0)

$drawnum5 = GUICtrlCreateButton("Draw Fifth Number", 8, 280, 203, 25, 0)

$Drawnum6 = GUICtrlCreateButton("Draw Sixth Number", 8, 312, 203, 25, 0)

$Number1 = GUICtrlCreateInput("#1", 8, 96, 25, 21)

$Number2 = GUICtrlCreateInput("#2", 40, 96, 25, 21)

$Number3 = GUICtrlCreateInput("#3", 72, 96, 25, 21)

$Number4 = GUICtrlCreateInput("#4", 104, 96, 25, 21)

$Number5 = GUICtrlCreateInput("#5", 136, 96, 25, 21)

$Number6 = GUICtrlCreateInput("#6", 168, 96, 25, 21)

$Madeby = GUICtrlCreateLabel("Made by: Dathos!", 16, 368, 189, 33)

GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

Load()

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Addplayer

$charname = InputBox("Eternal Guardians Lottery System", " Please enter the Characters name", "", "", 300, 120)

$Numticket = InputBox("Eternal Guardians Lottery System", " Please enter the Number of tickets", "", "", 300, 120)

$ListView1_0 = GUICtrlCreateListViewItem($charname &"|"&$Numticket, $ListView1)

IniWrite("f:\something.ini", "Players", "Player" & $a, $charname)

IniWrite("f:\something.ini", "Tickets", "Ticket" & $a, $Numticket)

$a +=1

Case $Drawnum1

$randomletter1 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum1 = Random(1, 99, 1)

GUICtrlSetData($Number1, $randomletter1 & $randomnum1)

Case $Drawnum2

$randomletter2 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum2 = Random(1, 99, 1)

GUICtrlSetData($Number2, $randomletter2 & $randomnum2)

Case $Drawnum3

$randomletter3 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum3 = Random(1, 99, 1)

GUICtrlSetData($Number3, $randomletter3 & $randomnum3)

Case $Drawnum4

$randomletter4 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum4 = Random(1, 99, 1)

GUICtrlSetData($Number4, $randomletter4 & $randomnum4)

Case $Drawnum5

$randomletter5 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum5 = Random(1, 99, 1)

GUICtrlSetData($Number5, $randomletter5 & $randomnum5)

Case $Drawnum6

$randomletter6 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum6 = Random(1, 99, 1)

GUICtrlSetData($Number6, $randomletter6 & $randomnum6)

EndSwitch

WEnd

Func Load()

For $i = 0 to 10

$PlayerIni = IniRead ( "f:\something.ini", "Players", "Player" & $i, " " )

$TicketIni = IniRead ( "f:\something.ini", "Tickets", "Ticket" & $i, " " )

$ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & " " & $TicketIni , $ListView1)

Next

EndFunc

Works for 10 players. But you can modify it to work with any amount of players by changing For $i = 0 to (amount of players)

Right now I have to leave. You can also make another ini section with the amount of players, and do something like " For $i = 0 to IniRead ( "f:\something.ini", "PlayerAmount", "MaxPlayer", " " )

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

CODE
#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <ListViewConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

Global $a=0

#Region ### START Koda GUI section ### Form=

$MainGUI = GUICreate("Eternal Guardians Lottery System", 450, 438)

$ListView1 = GUICtrlCreateListView("Player|# Tickets", 216, 8, 226, 422)

GUICtrlSendMsg(-1, 0x101E, 0, 150)

GUICtrlSendMsg(-1, 0x101E, 1, 70)

$Label3 = GUICtrlCreateLabel("", 96, 48, 4, 4)

$Group1 = GUICtrlCreateGroup("Information:", 8, 0, 201, 89)

$Label1 = GUICtrlCreateLabel("Each Ticket costs 1G", 16, 16, 107, 17)

$Label2 = GUICtrlCreateLabel("You need 2 numbers to get gold back!", 16, 32, 190, 17)

$Label4 = GUICtrlCreateLabel("See our website for more details", 16, 48, 190, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$Addplayer = GUICtrlCreateButton("Add a player", 8, 120, 203, 25, 0)

$Drawnum1 = GUICtrlCreateButton("Draw First Number", 8, 152, 203, 25, 0)

$Drawnum2 = GUICtrlCreateButton("Draw Second Number", 8, 184, 203, 25, 0)

$drawnum3 = GUICtrlCreateButton("Draw Third Number", 8, 216, 203, 25, 0)

$Drawnum4 = GUICtrlCreateButton("Draw Forth Number", 8, 248, 203, 25, 0)

$drawnum5 = GUICtrlCreateButton("Draw Fifth Number", 8, 280, 203, 25, 0)

$Drawnum6 = GUICtrlCreateButton("Draw Sixth Number", 8, 312, 203, 25, 0)

$Number1 = GUICtrlCreateInput("#1", 8, 96, 25, 21)

$Number2 = GUICtrlCreateInput("#2", 40, 96, 25, 21)

$Number3 = GUICtrlCreateInput("#3", 72, 96, 25, 21)

$Number4 = GUICtrlCreateInput("#4", 104, 96, 25, 21)

$Number5 = GUICtrlCreateInput("#5", 136, 96, 25, 21)

$Number6 = GUICtrlCreateInput("#6", 168, 96, 25, 21)

$Madeby = GUICtrlCreateLabel("Made by: Dathos!", 16, 368, 189, 33)

GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

Load()

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Addplayer

$charname = InputBox("Eternal Guardians Lottery System", " Please enter the Characters name", "", "", 300, 120)

$Numticket = InputBox("Eternal Guardians Lottery System", " Please enter the Number of tickets", "", "", 300, 120)

$ListView1_0 = GUICtrlCreateListViewItem($charname &"|"&$Numticket, $ListView1)

IniWrite("f:\something.ini", "Players", "Player" & $a, $charname)

IniWrite("f:\something.ini", "Tickets", "Ticket" & $a, $Numticket)

$a +=1

Case $Drawnum1

$randomletter1 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum1 = Random(1, 99, 1)

GUICtrlSetData($Number1, $randomletter1 & $randomnum1)

Case $Drawnum2

$randomletter2 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum2 = Random(1, 99, 1)

GUICtrlSetData($Number2, $randomletter2 & $randomnum2)

Case $Drawnum3

$randomletter3 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum3 = Random(1, 99, 1)

GUICtrlSetData($Number3, $randomletter3 & $randomnum3)

Case $Drawnum4

$randomletter4 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum4 = Random(1, 99, 1)

GUICtrlSetData($Number4, $randomletter4 & $randomnum4)

Case $Drawnum5

$randomletter5 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum5 = Random(1, 99, 1)

GUICtrlSetData($Number5, $randomletter5 & $randomnum5)

Case $Drawnum6

$randomletter6 = Chr(Random(Asc("A"), Asc("Z"), 1))

$randomnum6 = Random(1, 99, 1)

GUICtrlSetData($Number6, $randomletter6 & $randomnum6)

EndSwitch

WEnd

Func Load()

For $i = 0 to 10

$PlayerIni = IniRead ( "f:\something.ini", "Players", "Player" & $i, " " )

$TicketIni = IniRead ( "f:\something.ini", "Tickets", "Ticket" & $i, " " )

$ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & " " & $TicketIni , $ListView1)

Next

EndFunc

Works for 10 players. But you can modify it to work with any amount of players by changing For $i = 0 to (amount of players)

Right now I have to leave. You can also make another ini section with the amount of players, and do something like " For $i = 0 to IniRead ( "f:\something.ini", "PlayerAmount", "MaxPlayer", " " )

EDIT: still only shows one player :/ when making a new player it deletes the old one.

Edited by Rorka

Share this post


Link to post
Share on other sites

#10 ·  Posted

EDIT: still only shows one player :/ when making a new player it deletes the old one.

Did you run the script i posted or only some part of it? Because it works absoloutely fine for me...

This is the .ini I get with 7 players:

[Players]
Player0=
Player1=w
Player2=e
Player3=r
Player4=t
Player5=y
Player6=u
[Tickets]
Ticket0=
Ticket1=2
Ticket2=3
Ticket3=4
Ticket4=5
Ticket5=6
Ticket6=7

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Did you run the script i posted or only some part of it? Because it works absoloutely fine for me...

This is the .ini I get with 7 players:

[Players]
Player0=
Player1=w
Player2=e
Player3=r
Player4=t
Player5=y
Player6=u
[Tickets]
Ticket0=
Ticket1=2
Ticket2=3
Ticket3=4
Ticket4=5
Ticket5=6
Ticket6=7

EDIT: NVM Found what was up....

Had accidently deleted one line ^^

Also this:

$ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & " " & $TicketIni , $ListView1)

should of been:

$ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & "|" & $TicketIni , $ListView1)

Thanks anyways

Edited by Rorka

Share this post


Link to post
Share on other sites

#12 ·  Posted

EDIT: NVM Found what was up....

Had accidently deleted one line ^^

Also this:

$ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & " " & $TicketIni , $ListView1)

should of been:

$ListView1_0 = GUICtrlCreateListViewItem($PlayerIni & "|" & $TicketIni , $ListView1)

Thanks anyways

I'm glad we solved this! Have fun with your lottery ^_^

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