XxMichałxX Opublikowano 13 Marca 2009 Opublikowano 13 Marca 2009 GML tekst='' code=get_string('Podaj kod','') file_text_open_write('cos.txt') file_text_write_string('cos.txt',code) file_text_close('cos.txt') file_text_open_read('cos.txt') tekst=file_text_read_string('cos.txt') file_text_close('cos.txt') string_replace(tekst,'!','l') string_replace(tekst,'@','o') ___________________________________________ ERROR in action number 1 of Create Event for object control: File is not opened for reading. co zle zrobilem?
Marek.S Opublikowano 13 Marca 2009 Opublikowano 13 Marca 2009 używając tych wszystkich funkcji w argumentach musisz podać identyfikator pliku zwrócony przez file_open... a nie jego nazwę. GML plik = file_text_open_write( 'cos.txt' ) file_text_write_string( plik , code ) file_text_close( plik ) file_ = file_text_open_read( 'cos.txt' ) tekst = file_text_read_string( file_ ) file_text_close( file_ )
XxMichałxX Opublikowano 13 Marca 2009 Autor Opublikowano 13 Marca 2009 edit: sorry post do usuniecia juz nic nie potrzebuje edit2: a nie jednak mam problem napisze w edit3 edit3: skrypt code: GML string_replace(argument0,'a','!') string_replace(argument0,'b','@') string_replace(argument0,'c','$') string_replace(argument0,'d','%') string_replace(argument0,'e','^') string_replace(argument0,'f','&') string_replace(argument0,'g','*') string_replace(argument0,'h','(') string_replace(argument0,'i',')') string_replace(argument0,'j','-') string_replace(argument0,'k','_') string_replace(argument0,'l','=') string_replace(argument0,'m','+') string_replace(argument0,'n','`') string_replace(argument0,'o','[') string_replace(argument0,'p',']') string_replace(argument0,'r','{') string_replace(argument0,'s','}') string_replace(argument0,'t',';') string_replace(argument0,'u',':') string_replace(argument0,'w','\') string_replace(argument0,'y','?') string_replace(argument0,'z','<') string_replace(argument0,'x','>') string_replace(argument0,'v','/') control,create: GML tekst='lol' code(tekst) i tekst zamiast zamienic sie na te znaki to zostaje taki sam
Marek.S Opublikowano 13 Marca 2009 Opublikowano 13 Marca 2009 string_replace nie zmienia ciągu, tylko zwraca nowy ze zmienionymi wartościami. Więc wypadało by go doc zegoś przypisać, hm? btw. string_replace zamienia tylko pierwszy znak ciągu, lepiej użyj: string_replace_all( .. ) GML (Code) var text_; text_ = argument0 text_ = string_replace_all(text_,'a','!') text_ = string_replace_all(text_,'b','@') text_ = string_replace_all(text_,'c','$') text_ = string_replace_all(text_,'d','%') text_ = string_replace_all(text_,'e','^') text_ = string_replace_all(text_,'f','&') text_ = string_replace_all(text_,'g','*') text_ = string_replace_all(text_,'h','(') text_ = string_replace_all(text_,'i',')') text_ = string_replace_all(text_,'j','-') text_ = string_replace_all(text_,'k','_') text_ = string_replace_all(text_,'l','=') text_ = string_replace_all(text_,'m','+') text_ = string_replace_all(text_,'n','`') text_ = string_replace_all(text_,'o','[') text_ = string_replace_all(text_,'p',']') text_ = string_replace_all(text_,'r','{') text_ = string_replace_all(text_,'s','}') text_ = string_replace_all(text_,'t',';') text_ = string_replace_all(text_,'u',':') text_ = string_replace_all(text_,'w','\') text_ = string_replace_all(text_,'y','?') text_ = string_replace_all(text_,'z','<') text_ = string_replace_all(text_,'x','>') text_ = string_replace_all(text_,'v','/') return text_ // ***
XxMichałxX Opublikowano 13 Marca 2009 Autor Opublikowano 13 Marca 2009 po 'btw.' kumam ale przed nie.. co mam przypisac? edit: argument0=string_replace_all(argument0,'litera','znak') ?
Marek.S Opublikowano 13 Marca 2009 Opublikowano 13 Marca 2009 GML var text_; text_ = argument0 text_ = string_replace_all(text_,'a','!') text_ = string_replace_all(text_,'b','@') text_ = string_replace_all(text_,'c','$') text_ = string_replace_all(text_,'d','%') text_ = string_replace_all(text_,'e','^') text_ = string_replace_all(text_,'f','&') text_ = string_replace_all(text_,'g','*') text_ = string_replace_all(text_,'h','(') text_ = string_replace_all(text_,'i',')') text_ = string_replace_all(text_,'j','-') text_ = string_replace_all(text_,'k','_') text_ = string_replace_all(text_,'l','=') text_ = string_replace_all(text_,'m','+') text_ = string_replace_all(text_,'n','`') text_ = string_replace_all(text_,'o','[') text_ = string_replace_all(text_,'p',']') text_ = string_replace_all(text_,'r','{') text_ = string_replace_all(text_,'s','}') text_ = string_replace_all(text_,'t',';') text_ = string_replace_all(text_,'u',':') text_ = string_replace_all(text_,'w','\') text_ = string_replace_all(text_,'y','?') text_ = string_replace_all(text_,'z','<') text_ = string_replace_all(text_,'x','>') text_ = string_replace_all(text_,'v','/') return text_ // ***
XxMichałxX Opublikowano 13 Marca 2009 Autor Opublikowano 13 Marca 2009 a zrobiłem tak: GML argument0=string_replace_all(argument0,'a','!') argument0=string_replace_all(argument0,'b','@') argument0=string_replace_all(argument0,'c','$') argument0=string_replace_all(argument0,'d','%') argument0=string_replace_all(argument0,'e','^') argument0=string_replace_all(argument0,'f','&') argument0=string_replace_all(argument0,'g','*') argument0=string_replace_all(argument0,'h','(') argument0=string_replace_all(argument0,'i',')') argument0=string_replace_all(argument0,'j','-') argument0=string_replace_all(argument0,'k','_') argument0=string_replace_all(argument0,'l','=') argument0=string_replace_all(argument0,'m','+') argument0=string_replace_all(argument0,'n','`') argument0=string_replace_all(argument0,'o','[') argument0=string_replace_all(argument0,'p',']') argument0=string_replace_all(argument0,'r','{') argument0=string_replace_all(argument0,'s','}') argument0=string_replace_all(argument0,'t',';') argument0=string_replace_all(argument0,'u',':') argument0=string_replace_all(argument0,'w','\') argument0=string_replace_all(argument0,'y','?') argument0=string_replace_all(argument0,'z','<') argument0=string_replace_all(argument0,'x','>') argument0=string_replace_all(argument0,'v','/') nie dziala musi byc to tekst_ ? edit: wziąłem to twoje - tez nie działa :( cos sie popieprzylo chyba w moim gm-ie.. powinno cholera sie zamienic a kurde sie nie chce..
XxMichałxX Opublikowano 13 Marca 2009 Autor Opublikowano 13 Marca 2009 no ale wziąłem nawet to z tym tekst_ i tez nic :/
Rekomendowane odpowiedzi