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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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