PDA

View Full Version : Cmd_ExecuteString - execute /tell /say etc. from gsc



kung foo man
9th September 2013, 19:18
Ok, first post in this new forum, here we can collect the infos for new updates:



[21:01] Selbie: case 1204:
{
void (*Cmd_ExecuteString)(const char *text);
(*(int *)&Cmd_ExecuteString) = 0x080609D4;

char *msg;
int helper = 0;
helper += stackGetParamString(1, &msg); // todo: is string?
if (helper < 1)
{
printf_hide("scriptengine> wrongs args for: say(): at least 1 arg\n");
return stackReturnInt(0);
}
Cmd_ExecuteString(msg);
return stackPushInt(1);
}

closer(1204, "say hello");
closer(1204, "tell 0 hello");
closer(1204, "status");

[21:01] kung foo man: nice
[21:01] kung foo man: you can read the return value also?
[21:01] kung foo man: like /status in a string
[21:02] Selbie: I haven't tried that. could work. I have tested it to get tell and say working. but more things are looking possible now. it'sfor 1.2
[21:02] kung foo man: ah nice
[21:03] Selbie: just lookup the addr for 'Cmd_ExecuteString' and it should work for 1.3 & 1.7 to
[21:04] kung foo man: thats like saying "you find the apple tree somewhere" for explaining where it is
[21:04] Selbie: oh, well
[21:05] kung foo man: gonna make a forum for libcod
[21:05] Selbie: I looked into rcon system from q3, went down the same path. I am not quite good with IDa.
[21:05] kung foo man: then we can collect all infos there
[21:05] Selbie: good
[21:05] kung foo man: ah k
[21:08] kung foo man: ok added
[21:09] Selbie: ;)
[21:09] Selbie: 1.2 only, not sure about 1.3 etc
[21:09] kung foo man: yea mitch or so will search
[21:13] Selbie: didn't tested it, but 0x08609CC should be the 1.3 value

Mitch
15th January 2014, 22:38
This functions works with CoD2 1.0, 1.2, 1.3 and CoD4 1.7.

std\utils.gsc


executeString(str) { closer(1204, str); }
sayConsole(str) { executeString("say " + str); }


std\player.gsc


tellMessage(str)
{
std\utils::executeString("tell " + self GetEntityNumber() + " " + str);
}


Note: the cod4 version is a bit different inside libcod, but it isn't a problem within gsc.


#if COD_VERSION == COD4_1_7
void (*Cmd_ExecuteString)(int a1, int a2, const char *text);
#else
void (*Cmd_ExecuteString)(const char *text);
#endif
...
#if COD_VERSION == COD4_1_7
Cmd_ExecuteString(0, 0, msg); // idk what first 2 numbers do
#else
Cmd_ExecuteString(msg);
#endif