Sign in to follow this  
Followers 0
Cloudsx

Load Picture With Iniread

8 posts in this topic

I an making a game

if i run the scrip then i see then you must choose a picture of the list then you press load to load your picture

so if you stop with the game for 1 hour and you going to play again and then i want to see the picture and dont want to load it again

do i need an .ini file for it or not

do some one know that please help me with that

Share this post


Link to post
Share on other sites



I an making a game

if i run the scrip then i see then you must choose a picture of the list then you press load to load your picture

so if you stop with the game for 1 hour and you going to play again and then i want to see the picture and dont want to load it again

do i need an .ini file for it or not

do some one know that please help me with that

You will have to save the information somewhere, of course, and an INI file or the registry are good places. Read the AutoIT help file and check out the IniRead()/IniWrite() and RegRead()/RegWrite() functions. Once you get a script written, you can post it here, even if it doesn't work. We'll help you get it going

But it always starts with the help file (which is also the command reference for AutoIT).

:think:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

yes i already use the helpfile and the iniread

i can explane it now better

if i start the game from begin then you must choose a picture

then you searc you picture and load it

then i want that the picture been save that you never have to change your picture only if you want to change

her is my little script with iniread

#include <GUIconstants.au3>

MsgBox(4096,"Choose your picture", "choose you picture you want to use for the game")

$Player=FileOpenDialog ("choose your picture","C:\","(*.*)")


GUICreate ("elcaponis" ,400,400)
GUISetState(@SW_SHOW)
GUICtrlCreatePic ($Player,25,70,64,64);you should be adjust at size your image

$Player=IniRead("Player.ini", "Player", "C:\")

i hope that i explane it now better :think:

Share this post


Link to post
Share on other sites

at line before FileOpenDialog try to read name of picture from INI/registry

and then only if name is not defined then invoke FileOpenDialog and save choosen picture name to INI/registry

that's all :think:

Share this post


Link to post
Share on other sites

i am sorry but my english is a bit bad :think:

what did you meen

Share this post


Link to post
Share on other sites

i am sorry but my english is a bit bad :think:

what did you meen

#include <GUIconstants.au3>

;~ MsgBox(4096,"Choose your picture", "choose you picture you want to use for the game")
$picname = RegRead("HKEY_CURRENT_USER\SOFTWARE\My player", "Picture name")
If $picname = '' Then
    $picname=FileOpenDialog ("choose your picture","C:\","(*.*)")
    If @error Then Exit; Cancel
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\My player", "Picture name", "REG_SZ", $picname)
EndIf

GUICreate ("My player" ,400,400)
GUISetState(@SW_SHOW)
GUICtrlCreatePic ($picname,25,70,64,64)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Share this post


Link to post
Share on other sites

Based on wht you posted before, it would be something like this...

#include <GUIconstants.au3>


$Player=IniRead("Player.ini", "Player", "PlayerName","NotSet"); Reads the player from the ini file 

;if the ini file does not exist or no entry then load the file open dialogue.
If $Player = "NotSet" then
   MsgBox(4096,"Choose your picture", "choose you picture you want to use for the game")
   $Player=FileOpenDialog ("choose your picture","C:\","(*.*)")
EndIf

IniWrite ("Player.ini", "Player", "PlayerName", $Player);write the player back to the ini file

GUICreate ("elcaponis" ,400,400)
GUISetState(@SW_SHOW)
GUICtrlCreatePic ($Player,25,70,64,64);you should be adjust at size your image

Share this post


Link to post
Share on other sites

thansk this work

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