Jump to content
  • 0

config.h some expalin for this


ahmedhaies

Question

hello all if i want make variable in config.h share value on all channels or cores how to make this

more explain so if i assignment any value or change value on core or channel one this value will change to all cores or channels

like this variable in photo if i want change to all cores or channels inside game

https://i.imgur.com/PuSnmlD.png

 

how to make this or this can make ?

Edited by ahmedhaies
Link to comment

4 answers to this question

Recommended Posts

  • 0
  • VIP

Declare in the header the extern constant initialization.

Assign a value to the constant/variable in the cpp.

Now by #Including the config file, you'll can use the new constant/variable everywhere as u prefer.

You can edit the config value by using TOKEN("") too, with CONFIGs.

  • Good 1
Link to comment
  • 0
Posted (edited)
5 minutes ago, WeedHex said:

Declare in the header the extern constant initialization.

Assign a value to the constant/variable in the cpp.

Now by #Including the config file, you'll can use the new constant/variable everywhere as u prefer.

You can edit the config value by using TOKEN("") too, with CONFIGs.

can you give me any example

i want change value inside game to all channels

i want make this like game event but without using GetEventFlag

Edited by ahmedhaies
Link to comment
  • 0
  • VIP

Simple, in config.h you can declare ur variable, for example:

extern BYTE  g_variableExample;

then, in config.cpp you define your variable, for example:

BYTE g_variableExample = 100;

after,  in this file,  search this function:

static bool __LoadGeneralConfigFile(const char* configName)
{..

in this function, search this while loop:

	while (fgets(buf, 256, fp))
	{
		parse_token(buf, token_string, value_string);

in this while u can find much Token, perfect, you have to create a new token for function

		TOKEN("newvariable")
		{
			str_to_number(g_variableExample, value_string);
			fprintf(stdout, "VARIABLE_LIMIT: %d\n", g_variableExample);
			continue;
		}

If u search in token, u can find "fprint(stdout, "VARIABLE_LIMIT: %d\n", variable name);

"VARIABLE_LIMIT: " is the declaration that you can put in the CONFIG of your cores to use the variable differently according to your needs

The best theory is practice

Link to comment
  • 0

i know all this i want 

sync value in this variable from core one to core 2

for example:

if i type this code in core 1

this code i made for change value on game realtime

/change_value_event 1

i want this "1" value sync for all cores

i hope undersntad me 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.