getd in SRC

Easycore

New member
Messages
184
Points
0
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~

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

2) use pc_readglobalreg_str

 
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.
 
Back
Top