Entrar
Últimos assuntos
» Servidor de Discord do fórum?por Super Games Ontem à(s) 01:27
» Problemas com a caixa de diálogo, ela é pequena e as letras não cabem dentro
por Rukasu777 Qui 16 maio 2024, 18:10
» Problemas com particulas
por RastaMaan Dom 12 maio 2024, 17:03
» Problema ao entrar por uma porta e voltar por ela
por aminaro Seg 06 maio 2024, 10:08
» Alguém aqui já ganha dinheiro com seus games?
por theguitarmester Ter 30 Abr 2024, 11:43
» Colisões não funcionando
por theguitarmester Ter 30 Abr 2024, 10:16
» Como ajustar velocidade de cada frame da animação no game maker
por pequetux Sex 26 Abr 2024, 16:45
» Preciso de ajuda
por AftonDuGrau Dom 21 Abr 2024, 20:18
» Como faz o evento drawn GUI, não se repetir?
por aminaro Sex 19 Abr 2024, 20:30
» PROBLEMAS COM FÍSICAS DE ÁGUA
por aminaro Ter 16 Abr 2024, 10:07
» Retorno da GMBR!!!
por Ralphed Sex 12 Abr 2024, 22:45
» JOGADOR PARANDO NO AR QUANDO ATACA
por aminaro Qua 10 Abr 2024, 13:51
» Problemas com texto interativo
por Kaaru72 Dom 07 Abr 2024, 11:31
» Erro escondido e indecifrável
por dev_gabize.azv Qui 04 Abr 2024, 10:11
» Mudar cor de apenas uma palavra
por Ralphed Sáb 30 Mar 2024, 00:39
» Procuro Programador de game maker
por Wou Sex 15 Mar 2024, 10:27
» Mod APK
por gamerainha Qua 13 Mar 2024, 06:30
» Aceito pedidos de sprites (Com exemplos meus)
por Sevilha Qua 28 Fev 2024, 12:17
» Inventário simples
por Isquilo_Roedor Qui 22 Fev 2024, 15:18
» Problemas na programaçnao de inimigo [jogo DOOM LIKE]
por Black Mirror Dom 11 Fev 2024, 13:34
» ANDROID MULTI TOUCH
por DiegoBr Dom 04 Fev 2024, 12:13
» Save e Load Json
por Klinton Rodrigues Qui 25 Jan 2024, 11:12
» Colisão com mais de um objeto
por aminaro Seg 22 Jan 2024, 15:02
» Oi sou novo aqui
por Thiago Silveira Alexandre Sáb 20 Jan 2024, 20:55
» Como acessar conteudo comprado no marketplace
por macmilam Sex 19 Jan 2024, 07:42
[Resolvido]Dúvida com ficheiros de texto
+2
Super Games
afonso_silva
6 participantes
Página 1 de 1
[Resolvido]Dúvida com ficheiros de texto
Oi pessoal. Sei que ultimamente tenho colocado muitas questões, mas estou a criar um programa e preciso realmente da vossa ajuda. Então é o seguinte:
Como é que eu faço para que quando carrego num botão, abra-se uma janela para escolher um ficheiro de texto(com aquela função get_open_filename), e depois esse texto seja mostrado na tela, mas com a variavel keyboard_string, para que o texto surja na minha caixa de texto?
Como é que eu faço para que quando carrego num botão, abra-se uma janela para escolher um ficheiro de texto(com aquela função get_open_filename), e depois esse texto seja mostrado na tela, mas com a variavel keyboard_string, para que o texto surja na minha caixa de texto?
afonso_silva- Data de inscrição : 29/05/2010
Reputação : 0
Número de Mensagens : 147
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: [Resolvido]Dúvida com ficheiros de texto
Tente colocar algo como draw_text.
Espero ter ajudado...
Espero ter ajudado...
Super Games- Games Ranking :
Notas recebidas : C
Data de inscrição : 10/06/2010
Reputação : 36
Número de Mensagens : 2800
Prêmios :
x 0 x 0 x 0
x 0 x 1 x 0
x 0 x 0 x 0
Plataformas :- Game Maker 8.0 ou 8.1
- Game Maker Studio 1.4
- Game Maker Studio 2.0
- Java
- Godot
- Javascript
- C ou C++
Re: [Resolvido]Dúvida com ficheiros de texto
Super Games escreveu:Tente colocar algo como draw_text.
Espero ter ajudado...
Nesse caso seria melhor nem postar ¬¬"
Só poste se você realmente souber como resolver o problema, não fique supondo soluções! Isso só atrapalha. Na próxima vou considerar um FLOOD.
Avisado por MP.
A função get_open_filename retorna o diretorio+nome do arquivo escolhido. Então basta salvar isso numa variavel dessa forma:
arquivo = get_open_filename(....);
Depois você pode manipular como quiser, se quer mudar a variavel keyboard_string para esse valor, você pode simplesmente fazer:
keyboard_string = get_open_filename(....);
OBS: A função retorna uma string vazia caso a pessoa aperte o botão "Cancelar".
Janx- Data de inscrição : 24/05/2008
Reputação : 14
Número de Mensagens : 2417
Prêmios :
x 0 x 0 x 0
x 0 x 2 x 0
x 0 x 0 x 0
Re: [Resolvido]Dúvida com ficheiros de texto
Janx, creio que ele queira pegar o texto do arquivo, e não o título..
Se for isso, no Help do GM:
file_text_open_read(fname) Opens the file with the indicated name for reading. The function returns the id of the file that must be used in the other functions. You can open multiple files at the same time (32 max). Don't forget to close them once you are finished with them.
file_text_open_write(fname) Opens the indicated file for writing, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_open_append(fname) Opens the indicated file for appending data at the end, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_close(fileid) Closes the file with the given file id.
file_text_write_string(fileid,str) Writes the string to the file with the given file id.
file_text_write_real(fileid,x) Write the real value to the file with the given file id. (As separator between the integer and decimal part always a dot is used.
file_text_writeln(fileid) Write a newline character to the file.
file_text_read_string(fileid) Reads a string from the file with the given file id and returns this string. A string ends at the end of line.
file_text_read_real(fileid) Reads a real value from the file and returns this value.
file_text_readln(fileid) Skips the rest of the line in the file and starts at the start of the next line.
file_text_eof(fileid) Returns whether we reached the end of the file.
file_text_eoln(fileid) Returns whether we reached the end of a line in the file.
Meu inglês e meu tempo estão ruins, espero ter ajudado! Flw
Se for isso, no Help do GM:
file_text_open_read(fname) Opens the file with the indicated name for reading. The function returns the id of the file that must be used in the other functions. You can open multiple files at the same time (32 max). Don't forget to close them once you are finished with them.
file_text_open_write(fname) Opens the indicated file for writing, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_open_append(fname) Opens the indicated file for appending data at the end, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_close(fileid) Closes the file with the given file id.
file_text_write_string(fileid,str) Writes the string to the file with the given file id.
file_text_write_real(fileid,x) Write the real value to the file with the given file id. (As separator between the integer and decimal part always a dot is used.
file_text_writeln(fileid) Write a newline character to the file.
file_text_read_string(fileid) Reads a string from the file with the given file id and returns this string. A string ends at the end of line.
file_text_read_real(fileid) Reads a real value from the file and returns this value.
file_text_readln(fileid) Skips the rest of the line in the file and starts at the start of the next line.
file_text_eof(fileid) Returns whether we reached the end of the file.
file_text_eoln(fileid) Returns whether we reached the end of a line in the file.
Meu inglês e meu tempo estão ruins, espero ter ajudado! Flw
Gabreel- Data de inscrição : 02/10/2009
Reputação : 52
Número de Mensagens : 2232
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Plataformas :- Game Maker 8.0 ou 8.1
- Game Maker Studio 1.4
- Game Maker Studio 2.0
- Javascript
- Outros
Re: [Resolvido]Dúvida com ficheiros de texto
·ßieL escreveu:Janx, creio que ele queira pegar o texto do arquivo, e não o título..
Se for isso, no Help do GM:
file_text_open_read(fname) Opens the file with the indicated name for reading. The function returns the id of the file that must be used in the other functions. You can open multiple files at the same time (32 max). Don't forget to close them once you are finished with them.
file_text_open_write(fname) Opens the indicated file for writing, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_open_append(fname) Opens the indicated file for appending data at the end, creating it if it does not exist. The function returns the id of the file that must be used in the other functions.
file_text_close(fileid) Closes the file with the given file id.
file_text_write_string(fileid,str) Writes the string to the file with the given file id.
file_text_write_real(fileid,x) Write the real value to the file with the given file id. (As separator between the integer and decimal part always a dot is used.
file_text_writeln(fileid) Write a newline character to the file.
file_text_read_string(fileid) Reads a string from the file with the given file id and returns this string. A string ends at the end of line.
file_text_read_real(fileid) Reads a real value from the file and returns this value.
file_text_readln(fileid) Skips the rest of the line in the file and starts at the start of the next line.
file_text_eof(fileid) Returns whether we reached the end of the file.
file_text_eoln(fileid) Returns whether we reached the end of a line in the file.
Meu inglês e meu tempo estão ruins, espero ter ajudado! Flw
Sim, é isso que eu quero fazer. Eu tenho o seguinte código:
- Código:
txt = get_open_filename('Arquivos de texto|*.txt','')
file_text_open_read(txt)
keyboard_string = txt
No entanto dá sempre erro, e não acontece nada. Se me puder ajudar...
afonso_silva- Data de inscrição : 29/05/2010
Reputação : 0
Número de Mensagens : 147
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Re: [Resolvido]Dúvida com ficheiros de texto
file_text_open retorna um número para identificar qual arquivo você abriu.afonso_silva escreveu:Sim, é isso que eu quero fazer. Eu tenho o seguinte código:
- Código:
txt = get_open_filename('Arquivos de texto|*.txt','')
file_text_open_read(txt)
keyboard_string = txt
No entanto dá sempre erro, e não acontece nada. Se me puder ajudar...
Assim como fez em "txt = get_open_filename('Arquivos de texto|*.txt','')" você tem que usar uma variável para guardar o indice do arquivo carregado.
- Código:
f = file_text_open_read(txt);
- Código:
texto = file_text_write_string(f); // lé primeira linha do arquivo
file_text_readln(f) // pula para a próxima linha
texto += file_text_write_string(f); // adiciona a segunda linha do arquivo
// ...
- Código:
txt = '';
do
{
txt += file_text_read_string(f); // adicionar linha
file_text_readln(f); // passar a próxima
}
until file_text_eof(f); // parar se esta na ultima linha
No final o script ficaria assim:
- Código:
caminho = get_open_filename('Arquivos de texto|*.txt',''); // caminho do arquivo
f = file_text_open_read(caminho); // carregar
txt = '';
do
{
txt += file_text_read_string(f); // adicionar linha
file_text_readln(f); // passar a próxima
}
until file_text_eof(f); // parar se esta na ultima linha
Re: [Resolvido]Dúvida com ficheiros de texto
sei que n precisa mais de ajuda sobre isso, mas vou dar minha "contribuição".
crie um script e de o seguinte nome a ele
//===OpenFile====//
var _file,_open,_stream;
_file=argument0;
if (file_exists(_file))
{
_open=file_text_open_read(_file);
_stream='';
for (i=0;!file_text_eof(_open);i+=1;)
{
_stream+=file_text_read_string(_open)+' ';
file_text_readln(_open);
}
file_text_close(_open);
return _stream;
}else
{
return 0;
}
//como usar
para usar esse script
basta criar um script colocar esse código la
e dar o nomeOpenFile();
esse script abriar e ira ler todo o conteudo do arquivo
com o simples comando
var str;
str=OpenFile("arquivo.txt");
//isso fará com que a variavel str armazene todo o conteudo do arquivo!
:D
crie um script e de o seguinte nome a ele
//===OpenFile====//
var _file,_open,_stream;
_file=argument0;
if (file_exists(_file))
{
_open=file_text_open_read(_file);
_stream='';
for (i=0;!file_text_eof(_open);i+=1;)
{
_stream+=file_text_read_string(_open)+' ';
file_text_readln(_open);
}
file_text_close(_open);
return _stream;
}else
{
return 0;
}
//como usar
para usar esse script
basta criar um script colocar esse código la
e dar o nomeOpenFile();
esse script abriar e ira ler todo o conteudo do arquivo
com o simples comando
var str;
str=OpenFile("arquivo.txt");
//isso fará com que a variavel str armazene todo o conteudo do arquivo!
:D
Re: [Resolvido]Dúvida com ficheiros de texto
Obrigadão Jiraya e Kabeção. Era mesmo isso que eu queria saber. Alguém que tranque o tópico please
afonso_silva- Data de inscrição : 29/05/2010
Reputação : 0
Número de Mensagens : 147
Prêmios :
x 0 x 0 x 0
x 0 x 0 x 0
x 0 x 0 x 0
Tópicos semelhantes
» [Resolvido]Duvida com uma Caixa de Texto
» Dúvida com texto...
» [Duvida] Texto com fonte criada
» Duvida sobre caixa de texto
» [Resolvido]Texto duplicado!
» Dúvida com texto...
» [Duvida] Texto com fonte criada
» Duvida sobre caixa de texto
» [Resolvido]Texto duplicado!
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|