Skocz do zawartości

Rekomendowane odpowiedzi

Opublikowano

Mam taki error:

ERROR in
action number 1
of Key Press Event for <Enter> Key
for object objWczytujeLevele:

Trying to read from undefined INI file

 

Kod na wczytywanie:

GML
nazwal=get_string("Nazwa levelka?:","WPISZ TUTAJ :D")

ini_open(string(nazwal)+".lvl")

 

Zazwyczaj mi to działało, a teraz dupa :( Dlaczego?

Opublikowano

W gm7 tak nie było, teraz bawie się gm8, oblookam pod tym względem.

@EDIT:

Nie :(

ini_open(name) Opens the INI file with the given name. The ini file must be stored in the same folder as the game!
ini_close() Closes the currently open INI file.
ini_read_string(section,key,default) Reads the string value of the indicated key in the indicated section. When the key or section does not exist the default value is returned.
ini_read_real(section,key,default) Reads the real value of the indicated key in the indicated section. When the key or section does not exist the default value is returned.
ini_write_string(section,key,value) Writes the string value for the indicated key in the indicated section.
ini_write_real(section,key,value) Writes the real value for the indicated key in the indicated section.
ini_key_exists(section,key) Returns whether the indicated key exists in the indicated section.
ini_section_exists(section) Returns whether the indicated section exists.
ini_key_delete(section,key) Deletes the indicated key from the indicated section.
ini_section_delete(section) Deletes the indicated section.

Nie ma tutaj nic wspomnianego o zwracaniu tego do zmiennej, tak samo przy wczytywaniu/save'wowaniu nie wybierasz który plik, tylko do tego otwartego.

Opublikowano
skoro zmieniasz rozszezenie to nie jest on juz plikiem ini

a właśnie że jest plikiem ini :P zmiana rozszeżenia w większości przypadków nic nie robi. Chyba że gm sprawdza czy nazwa pliku kończy się na .ini

Opublikowano

gnysek:

Ale jeżeli nawet plik nie istnieje to ini_open('plik.ini') tworzy go.

 

EDIT:

ini_open(nazwa) - Wczytuje plik ini. Plik musi być w tym samym folderze co gra, a jeżeli go nie ma, tworzy go.
Opublikowano

Czy w ogóle piszesz gdzieś wcześniej? Mniej więcej to powinno być tak:

GML
ini_open(string(room)+".lvl");

ini_write_string(string(room), "Pozycja", string(hp));

ini_write_real(string(room),"Pozycja",string(score));

ini_close();

 

Potem jest

GML
ini_open(string(room)+".lvl");

ini_read_string(string(room), "Pozycja", string(hp));

ini_read_real(string(room), "Pozycja", real(score));

ini_close();

Opublikowano

To może coś tu nie tak:

GML
n=ini_read_real("Game","Number",0)

 

for(i=0;i<n;i+=1)

{

o=ini_read_real("GameObj","obj"+string(i),0)

xx=ini_read_real("GameX","x"+string(i),0)

yy=ini_read_real("GameY","y"+string(i),0)

d=instance_create(xx div 32*32,yy div 32*32,obj[o])

}

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...