Jump to content

config.h some expalin for this


Recommended Posts

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://metin2.download/picture/eFv1NQDRAjcR1ze4f36WCqd6JGtW4y8Y/.png

 

how to make this or this can make ?

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium

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
Share on other sites

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
Share on other sites

  • Developer

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

503953077003354113.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.