Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 839 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
save you.x in *.txt with ent_next doesen't work :( #471696
03/15/18 15:59
03/15/18 15:59
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
hi,
I m working on my 3dgs games an building a level editor.
Ich have try to save all parameter of my entitys in a txt file.

it doesent work after i start the "for" command with ent_next, i cant write in file X(
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <strio.c>;
///////////////////////////////
function open_model()
{
	wait(1);
	ENTITY* TestEnt;
	char* filename = file_dialog("Replace model","*.mdl;*.hmp;*.wmb");
	if (filename)
	{
		TestEnt = ent_create (filename,camera.x,NULL);
	}
}
function main()
{
	STRING* s = "    ";
	VECTOR temp;
	while(1){
		//load a mdl
		if(key_o){
			open_model();
			while(key_o)wait(1);
		}
		// save you,x in mydile.txt
		if(key_s){
			STRING* s = "    ";
			for(you = ent_next(NULL); you!=NULL; you = ent_next(you)){
				str_for_num(s,you.x); 
			} 
			var filehandle = file_open_write ("myfile.txt");
			file_str_write(filehandle,s);
			file_close (filehandle);	
			while(key_s)wait(1);
		}
		wait(1);
	}
}


Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471698
03/15/18 17:28
03/15/18 17:28
Joined: Oct 2008
Posts: 681
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 681
Germany
You use a while... why use a for loop too?

if you want to read all Entitys, use:

Code:
you = ent_next(NULL); // retrieve first entity
while (you) // repeat until there are no more entities
{ 
   // Save,...
   you = ent_next(you); // get next entity
}

insteat of for.


Last edited by Ayumi; 03/15/18 17:32.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ayumi] #471706
03/15/18 20:29
03/15/18 20:29
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
I see my problem is about file_dialog and then save string to *.txt.
after loading a mdl with file_dialog, the file_str_write not work.



Last edited by CocaCola; 03/15/18 20:31.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471708
03/15/18 20:40
03/15/18 20:40
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
here the short example, please someone know why it does not work?
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <strio.c>;
///////////////////////////////
function main()
{
	level_load("null.wmb");
	STRING* s = "    ";
	char* filename = file_dialog("Replace model","*.mdl;*.hmp;*.wmb");
	if (filename)
	{
		ent_create (filename,nullvector,NULL);
	}
	STRING* s = "hallo welt";
	var filehandle = file_open_write ("myfile.txt");
	file_str_write(filehandle,s);
	file_close (filehandle);	
}


i get no myfile.txt in the folder

Last edited by CocaCola; 03/15/18 20:41.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471711
03/15/18 21:40
03/15/18 21:40
Joined: Oct 2008
Posts: 681
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 681
Germany
It works (A7)

Other example works too!

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <strio.c>;

///////////////////////////////


///////////////////////////////
function open_model()
{
	wait(1);
	char* filename = file_dialog("Replace model","*.mdl;*.hmp;*.wmb");
	if (filename)
	{
		ent_create (filename,camera.x,NULL);
	}
}
function main()
{
	level_load(NULL);
	
	STRING* s = "    ";
	VECTOR temp;
	while(1)
	{
		if(key_o)
		{
			open_model();
			while(key_o)
				wait(1);
		}
		
		
		// save you,x in mydile.txt
		if(key_s)
		{
			STRING* s = "    ";
			
			you = ent_next(NULL); // retrieve first entity

			while (you) // repeat until there are no more entities
			{ 
			   str_for_num(s,you.x); 
			   var filehandle = file_open_write ("myfile.txt");
				file_str_write(filehandle,s);
				file_close (filehandle);
			   you = ent_next(you); // get next entity
			   wait(1);
			}

			
			
			while(key_s)wait(1);
		}
		
		wait(1);
	}
}


Last edited by Ayumi; 03/15/18 22:10.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ayumi] #471713
03/15/18 22:42
03/15/18 22:42
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
Its not a the manual its the bug list XD
ps ich habe A8 it not work

Last edited by CocaCola; 03/15/18 22:43.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471714
03/15/18 22:50
03/15/18 22:50
Joined: Oct 2008
Posts: 681
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 681
Germany
Gerade mit A8 getestet, funktioniert nicht und keine Lust mehr. Ich schau mir das morgen mal in Ruhe an.

Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ayumi] #471716
03/16/18 04:20
03/16/18 04:20
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
ok ich pausiere das ganze erstmal und debugge wenn mir mal was einfaällt wie man das macht , oder CMD meldungen oder. Ich warte ab was Du findes.

Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471720
03/16/18 12:31
03/16/18 12:31
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
Originally Posted By: Manual::strio.c::open_dialog::Remarks

The current directory is changed to the selected folder. If this is not desired, change it afterwards back to the game folder with the Windows API function
Code:
SetCurrentDirectory(_chr(work_dir));



Your text file should be within the folder of the model, I guess.

Salud!

Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471721
03/16/18 12:31
03/16/18 12:31
Joined: Aug 2003
Posts: 118
Deutschland
E
Ezzett Offline
Member
Ezzett  Offline
Member
E

Joined: Aug 2003
Posts: 118
Deutschland
Vielleicht liegt es am Betriebssystem? Windows 10 sperrt aus Sicherheitsgründen ziemlich viel.

Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ezzett] #471722
03/16/18 12:36
03/16/18 12:36
Joined: Oct 2008
Posts: 681
Germany
Ayumi Offline
User
Ayumi  Offline
User

Joined: Oct 2008
Posts: 681
Germany
@txesmi
No, i have tryed this (same Folder)

Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ayumi] #471724
03/16/18 12:53
03/16/18 12:53
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
It is working fine for me...

Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ezzett] #471725
03/16/18 13:41
03/16/18 13:41
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
@Ezzett windows 10 soll angeblich das erste windows sein, für das man keine hardware treiber programmieren kann, weil die alle eine zertifikat sicherung haben, ich habe aber schon hier im forum gelesen, dass win10 und 3dgs schwierigkeiten haben frown .

I have win 8.1 and wine on linux and A8 com

Last edited by CocaCola; 03/16/18 13:41.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471732
03/17/18 09:24
03/17/18 09:24
Joined: Aug 2003
Posts: 118
Deutschland
E
Ezzett Offline
Member
Ezzett  Offline
Member
E

Joined: Aug 2003
Posts: 118
Deutschland
In welchem Ordner ist Gamestudio und dein Projekt installiert? Unter "Programme" könnte ich mir vorstellen, dass es kritisch ist, weil das Verzeichnis geschützt ist. Lässt du Gamestudio als Administrator ausführen? Ist Windows Defender deaktiviert?

Re: save you.x in *.txt with ent_next doesen't work :( [Re: Ezzett] #471735
03/17/18 15:12
03/17/18 15:12
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
das wird es sei @Ezzet. Ich weiß zwar noch nicht was Windows Defender ist, aber unter linux geht es jetzt auch.
Danke laugh

Last edited by CocaCola; 03/17/18 15:12.
Re: save you.x in *.txt with ent_next doesen't work :( [Re: CocaCola] #471747
03/18/18 13:33
03/18/18 13:33
Joined: Mar 2014
Posts: 359
CocaCola Offline OP
Senior Member
CocaCola  Offline OP
Senior Member

Joined: Mar 2014
Posts: 359
hatte die modelle aus einem anderem ordner geladern.
die mode wurden zwar im game angezeigt, aber mit modellen aus dem projekt ordner wird auch die text datei erstellt.
- also gehts jetzt auch auf meinem windows ordner

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1