Jump to content

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
https://metin2.dev/topic/27446-configh-some-expalin-for-this/
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
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
  • 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

Villains are not born, they are made.
Join

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 

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



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.