Entrar
Últimos assuntos
» Retorno da GMBR!!!por theguitarmester Ter 19 Mar 2024, 22:38
» Procuro Programador de game maker
por Wou Sex 15 Mar 2024, 10:27
» Mod APK
por gamerainha Qua 13 Mar 2024, 06:30
» Mudar cor de apenas uma palavra
por lunalol Sex 01 Mar 2024, 13:42
» 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
» Servidor de Discord do fórum?
por Lighter Sáb 27 Jan 2024, 17:18
» 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
» Devlogs em vídeos do Block Room
por Joton Seg 15 Jan 2024, 16:56
» Alguém aqui já ganha dinheiro com seus games?
por Joton Seg 15 Jan 2024, 16:49
» ACERVO GMBR MAGAZINE
por Joton Qui 11 Jan 2024, 19:21
» como aumentar o obj sem aumentar a colisão??
por GabrielXavier Qua 10 Jan 2024, 07:21
» Asteroid Core - Early Acesse Update [0.2.0.0]
por JOZ. Seg 08 Jan 2024, 14:39
» Versionamento de código com GitHub
por GabrielXavier Seg 08 Jan 2024, 07:32
» Rio Rise - novo launcher do Gta San Andreas SAMP Brasil
por kolesovsup Sex 29 Dez 2023, 07:16
» a funçao approach ainda existe?
por PEDRINDEV Ter 26 Dez 2023, 20:05
» Inimigo ataca até por trás! >:(
por saim Sex 22 Dez 2023, 08:55
» [RESOLVIDO]Spawn após morte
por Deception_1999 Dom 17 Dez 2023, 16:39
» Remunerado $$$ - Procuro programador para ajudar a "montar" um jogo
por theguitarmester Sáb 02 Dez 2023, 16:28
» Game maker nao abre
por Cerf Dom 26 Nov 2023, 12:01
[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 : 2799
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
- 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]Erro em texto no 3d3
» [Resolvido]Fade no texto
» [RESOLVIDO]Texto estilo RPG
» [RESOLVIDO]Problema em texto
» [Resolvido]Texto+Variável
» [Resolvido]Fade no texto
» [RESOLVIDO]Texto estilo RPG
» [RESOLVIDO]Problema em texto
» [Resolvido]Texto+Variável
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|