Sign in to follow this  
Followers 0
Cloudsx

some problem with ini read

31 posts in this topic

i want this ini screen shot where you see the cash and iron and ederuim and electricity

next to the pictures but if i buy something i want to see that i buy something and it have to go off the cash or iron or ederuim

look to the code and to the screen shot

#include <GUIConstants.au3>

GUICreate("game",350,400); will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW); will display an empty dialog 

GUICtrlCreatePic("Cash.jpg",25,10,20,20) 
GUICtrlCreatePic("iron.jpg",115,10,20,20)
GUICtrlCreatePic("ederuim.jpg",200,10,20,20)
GUICtrlCreatePic("electricity.jpg",275,10,20,20) 


Opt("GUICoordMode",4)
$gebouwen = GUICtrlCreateButton("gebouwen",290,100,60)
$militair = GUICtrlCreateButton("militair",290,125,60)
$voertuigen = GUICtrlCreateButton("voertuigen",290,150,60)
$onderzoek = GUICtrlCreateButton("onderzoek",290,175,60)
$verdediging = GUICtrlCreateButton("verdediging",290,200,61)
$overzicht = GUICtrlCreateButton("overzicht",290,225,60)

GUISetState ();this wil create a button

Dim $2, $3, $4, $5, $6, $7

While 1
$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then
If WinActive("game") then Exit
If WinActive("gebouwen") then GUIDelete( $2)
If WinActive("militair") then GUIDelete( $3)
if WinActive("voertuigen") then GUIDelete( $4)
If WinActive("onderzoek") then GUIDelete( $5)
If WinActive("verdediging") then GUIDelete( $6)
If WinActive("overzicht") then GUIDelete($7)
EndIf
if $msg = $gebouwen Then GUI2Create()
If $msg = $militair then Gui3create()
if $msg = $voertuigen then Gui4create()
If $msg = $onderzoek then Gui5create()
If $msg = $verdediging then gui6create()
If $msg = $overzicht then Gui7create()

Wend

Func GUI2Create()
If WinExists("gebouwen") then Return
$2 = GUICreate("gebouwen",350,350)
GUISetState (@SW_SHOW)
EndFunc

Func Gui3create()
If WinExists("militair") then Return
$3 = GUICreate("militair",350,350)
GUISetState (@SW_SHOW)
EndFunc

Func Gui4create()
If WinExists("voertuigen") then Return
$4 = GUICreate("voertuigen",350,350)
GUISetState (@SW_SHOW)
EndFunc

Func gui5create()
If WinExists("onderzoek") then Return
$5 = GUICreate("onderzoek",350,350)
GUISetState (@SW_SHOW)
EndFunc

Func gui6create()
If WinExists("verdediging") then Return
$6 = GUICreate("verdediging",350,350)
GUISetState (@SW_SHOW)
EndFunc

Func gui7create()
If WinExists("overzicht") then Return
$7 = GUICreate("overzicht",350,350)
GUISetState (@SW_SHOW)
EndFunc

i want that what you see in the screen shot of the notepad i want next to the Cash and iron and ederuim and electricity but it must work

Share this post


Link to post
Share on other sites



inis must be sth like this:

[Ressources]
cash=1000
...

then just use iniread() (look it up in helpfile)


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

how is the full code of inin read with this

[Ressources]

cash=1000

Share this post


Link to post
Share on other sites

$cash = iniread("your.ini", "Ressources", "cash", 0)
msgbox(0, "", "Your Cash is: " & $cash)


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

in the ini stand my cash is 2500 and it say in the autoit thing that is is 0 and it must diplay next to the cash token

Share this post


Link to post
Share on other sites

create a label just like i showed you before

just place it next to the pic

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

thanks is good but if i but a militair of 100 cash will it go off the cash ??? and the ini read is good it work but it say my cash is 0 and in the ini it say 2500

Edited by Cloudsx

Share this post


Link to post
Share on other sites

1

you have to write the code to deduct the purchase ( cash ) from the label

2

at the upper portion of the script***********

$cash = iniread("your.ini", "Ressources", "cash", 0)

next to a pic**************

$Label = GuiCtrlCreateLabel($cash,........

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

look to this code

$cash = iniread("rechours", "Ressources", "Cash = 2500", 0)

msgbox(0, "", "Your Cash is: " & $cash)

if i change it to this $cash = iniread("rechours", "Ressources", "Cash = 2500", 2500)

msgbox(0, "", "Your Cash is: " & $cash)

then i get a msgbox and it say your cash is 2500

Share this post


Link to post
Share on other sites

it says its 0, 'cause of an error while reading!


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

it says its 0, 'cause of an error while reading!

what you meen with error in reading

Share this post


Link to post
Share on other sites

1

you have to write the code to deduct the purchase ( cash ) from the label

2

at the upper portion of the script***********

$cash = iniread("your.ini", "Ressources", "cash", 0)

next to a pic**************

$Label = GuiCtrlCreateLabel($cash,........

8)

i dont under stand the **********************

Share this post


Link to post
Share on other sites

Change

$cash = iniread("rechours", "Ressources", "Cash = 2500", 0)
msgbox(0, "", "Your Cash is: " & $cash)

to

$cash = iniread("rechours", "Ressources", "Cash", 0)
msgbox(0, "", "Your Cash is: " & $cash)

And try it.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Change

$cash = iniread("rechours", "Ressources", "Cash = 2500", 0)
msgbox(0, "", "Your Cash is: " & $cash)

to

$cash = iniread("rechours", "Ressources", "Cash", 0)
msgbox(0, "", "Your Cash is: " & $cash)

And try it.

then it will still says that it cash is 0

Share this post


Link to post
Share on other sites

i was waiting for someone to fix the error

$var = IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")

the ini read NEEDS to read an ini file

$var = IniRead("C:\Temp\myfile.ini"..........

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

then it will still says that it cash is 0

No, that's the default value in case the iniread fails to get the value from the file


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

how can i show thw cash in here and next to the picture and i have to see it and if i buy something then it go off the cash or iron or ederuim

#include <GUIConstants.au3>

GUICreate("game",350,400); will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW); will display an empty dialog 

GUICtrlCreatePic("Cash.jpg",25,10,20,20)
$cash = iniread("rechours", "Ressources", "Cash", 0)
msgbox(0, "", "Your Cash is: " & $cash)
GUICtrlCreatePic("iron.jpg",115,10,20,20)
GUICtrlCreatePic("ederuim.jpg",200,10,20,20)
GUICtrlCreatePic("electricity.jpg",275,10,20,20)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

PUT THE LABEL THERE ( like i showed you... and told you before )

not the iniread

New to AutoIt ?

A Great Place To Start:

==> Welcome to AutoIt 1-2-3 <==

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

where do i have to place the label

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$cash = iniread("rechours", "Ressources", "Cash", 0)

msgbox(0, "", "Your Cash is: " & $cash)

GUICreate("game",350,400); will create a dialog box that when displayed is centered

GUICtrlCreatePic("Cash.jpg",25,10,20,20)

***** CREATE THE LABEL HERE ******

GUICtrlCreatePic("iron.jpg",115,10,20,20)

GUICtrlCreatePic("ederuim.jpg",200,10,20,20)

GUICtrlCreatePic("electricity.jpg",275,10,20,20)

GUISetState (@SW_SHOW); will display an empty dialog


NEWHeader1.png

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