Jump to content
  • 0
Easycore

getd in SRC

Question

Hello,

 

It's posible use getd in SRC?

 

For eg:

 

M$ = Var

 

 

getd(""+M$+"Something") = "VarSomething".

 

 

I tried:

 

pc_readglobalreg(sd,script->add_str("M$"))+"Something" , but it generates map-server-crash.

 

In short, I would like to be able to "join" strings.

 

For more information, I used this in clif->soundeffectall:

 

 

clif->soundeffectall(src, (pc_readglobalreg(sd,script->add_str("M$"))+".wav"),0, AREA); 

 

Regards~

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

1) you cannot concat string directly, that should have given some sort of compile warning.

2) use pc_readglobalreg_str

Share this post


Link to post
Share on other sites
  • 0

1) you cannot concat string directly, that should have given some sort of compile warning.

2) use pc_readglobalreg_str

I was researching about that... 

And finally I came to a solution:

 

{
        char* a = pc_readglobalreg_str(sd,script->add_str("M$"));
	char* b = ".wav";
	char* c = (char* ) malloc(1 +sizeof(char*) * (strlen(a)+ strlen());
	strcpy(c, a);
	strcat(c, ;
	clif->soundeffectall(src, c,0, AREA);
}

So, I get compile warnings for 'strcpy' and 'strcat':

 

warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

 

warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.