Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,382 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
help for reading function and action from text file #402976
06/13/12 00:06
06/13/12 00:06
Joined: Jun 2011
Posts: 75
algeria
T
Tonyjack221 Offline OP
Junior Member
Tonyjack221  Offline OP
Junior Member
T

Joined: Jun 2011
Posts: 75
algeria
that code for reading a variables from a text file

Code:
STRING* str_file_data = "";
var _fHandle_user_config_i = NULL;

void get_user_settings(STRING* local_filename) 
{
	_fHandle_user_config_i = file_open_read(local_filename);
	
	if(_fHandle_user_config_i){ //read config file
		int eof = 0;
		while(eof != -1){
			eof = file_str_read(_fHandle_user_config_i, str_file_data);
			var_for_name(str_file_data);
		}
	}
	file_close(_fHandle_user_config_i);
}



i want to read anything from the text like function and action

Re: help for reading function and action from text file [Re: Tonyjack221] #402977
06/13/12 00:11
06/13/12 00:11
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
file_var_read

is what you need to read a var,

file_str_read is for strings


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: help for reading function and action from text file [Re: FoxHound] #402978
06/13/12 00:16
06/13/12 00:16
Joined: Jun 2011
Posts: 75
algeria
T
Tonyjack221 Offline OP
Junior Member
Tonyjack221  Offline OP
Junior Member
T

Joined: Jun 2011
Posts: 75
algeria
can be that read a function from a text

Re: help for reading function and action from text file [Re: Tonyjack221] #402979
06/13/12 00:23
06/13/12 00:23
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
I do not understand the question.

However going broad here. You can use the "file" functions to make and load file formats of any type. I have multiple file formats done, with vars and strings.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: help for reading function and action from text file [Re: FoxHound] #402980
06/13/12 00:29
06/13/12 00:29
Joined: Jun 2011
Posts: 75
algeria
T
Tonyjack221 Offline OP
Junior Member
Tonyjack221  Offline OP
Junior Member
T

Joined: Jun 2011
Posts: 75
algeria
i want to read action from a text file
like that
in the text file
----------------
cam_xy.pan =10
-------------

the Engine read this and use it

Re: help for reading function and action from text file [Re: Tonyjack221] #402981
06/13/12 01:45
06/13/12 01:45
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
From the manual
//////
execute (STRING* command)

Executes an engine function or variable assignment from a character sequence. Can be used to alter variables or object parameters during gameplay.
Parameters:
command - STRING* or char* pointer that contains an engine function or variable assignment.

Remarks:

LC Under lite-C the function uses the C-Script interpreter. It can only be used for calling engine functions with engine variables, and has no access to functions or variables of the script. For altering script variables, use var_for_name.

Don't enter the execute function in a command string to itself.

Examples:
execute("ent_bonerotate(player,"bone1",vector(10,0,0))");
execute("camera.clip_far = 20000");
...
function console()
{
inkey(exec_buffer);
if (13 == result) // terminated with RETURN?
{
execute(exec_buffer); } // executes the string
}
}

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

Now go forth and be fruitful!


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: help for reading function and action from text file [Re: FoxHound] #403040
06/13/12 18:26
06/13/12 18:26
Joined: Jun 2011
Posts: 75
algeria
T
Tonyjack221 Offline OP
Junior Member
Tonyjack221  Offline OP
Junior Member
T

Joined: Jun 2011
Posts: 75
algeria
i have a problem
When i try this
execute("camera.clip_far = 20000");
doesn't work what is the problem

Re: help for reading function and action from text file [Re: Tonyjack221] #403047
06/13/12 19:02
06/13/12 19:02
Joined: Jun 2011
Posts: 75
algeria
T
Tonyjack221 Offline OP
Junior Member
Tonyjack221  Offline OP
Junior Member
T

Joined: Jun 2011
Posts: 75
algeria
anyone can help me?

Re: help for reading function and action from text file [Re: Tonyjack221] #403051
06/13/12 19:31
06/13/12 19:31
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
How can you tell it doesn't work? Try something simple. Put up a panel that shows a var, use execute to change that var so you can tell. Also you could use the panel to show the camera.clip_far. I just know that clip_far isn't the easiest thing to tell when it's changed.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: help for reading function and action from text file [Re: FoxHound] #403052
06/13/12 19:34
06/13/12 19:34
Joined: Jun 2011
Posts: 75
algeria
T
Tonyjack221 Offline OP
Junior Member
Tonyjack221  Offline OP
Junior Member
T

Joined: Jun 2011
Posts: 75
algeria
i try this
execute("sys_exit(NULL)");
in void main()

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