Page 1 of 1
newfeat: $Servername ??
Posted: Tue Oct 21, 2003 10:25 am
by LordGiddion
Ok rather then ask for something this time I thought I try coding it.
$servername returns the name of the server your playing on.
I haven't tried it yet - at work right now.
Please let me know if I missed something.
in MacroParser.h
Code: Select all
//pmp funcs
PARMFUNC(parmServerName)
Code: Select all
PARMLIST Parms[] = {
{"servername", "parmServerName", NULL},
in macroParser.cpp
Code: Select all
DWORD parmServerName(PCHAR szVar, PCHAR szOutput, PSPAWNINFO pChar)
{
// $servername
strcat(szOutput,((PCHAR)EQADDR_SERVERNAME));
return 14;
}
Posted: Wed Oct 22, 2003 11:23 am
by LordGiddion
McKorr,
I understand you've worked with the servername for another peice of code, can you see if this looks right to you?
Posted: Wed Oct 22, 2003 11:52 am
by Mckorr
Take a look in EQLib_Mouse. The routine that determines the UI_Character_Server.ini file.
Code: Select all
if (!EQADDR_SERVERNAME)
return FALSE;
sprintf(UIFile,"%s\\UI_%s_%s.ini",gszEQPath,pCharInfo->Name,EQADDR_SERVERNAME);
I think that would make it
Code: Select all
DWORD parmServerName(PCHAR szVar, PCHAR szOutput)
{
// $servername
strcat(szOutput,EQADDR_SERVERNAME);
return 14;
}
Posted: Thu Oct 23, 2003 12:30 pm
by LordGiddion
Darn I missed something, Both codes CTD
So much for my first effort, can someone more knowledgable give me a hint where I messed up? I'd like to be a useful contributor - but not quite sure what I'm missing.
Posted: Thu Oct 23, 2003 1:18 pm
by Lax
I'll throw you a bone here :) Mckorr is great, but not so much of an expert at C++ as he is with other parts of the project.
So here's the deal -- printf is looking for extra parameters as void*, whereas strcat is looking for char*. In other words, it doesn't need a type cast to become void* from whatever it happens to be, to be used in printf. Luckily, EQADDR_SERVERNAME is defined as PCHAR, so your type cast (
(PCHAR)EQADDR_SERVERNAME) doesn't do anything and will work the same way with or without it.
The only thing I'd be concerned with is the return 14.
Code: Select all
* DWORD return value: Old "i++" value. e.g. number of chars to skip *
* in original string. Size of your parameter, *
* without the "$", and minus 1. $spawn(250,type) *
* should return 14. Returning 10000 indicates an *
* error return. (Bad macro parameter) *
* *
012345678901234
$spawn(250,type)
$servername
return 10 instead and your code should work as far as I know :)
Posted: Thu Oct 23, 2003 2:14 pm
by LordGiddion
Nope return 10 still CTD
Posted: Fri Oct 24, 2003 9:12 am
by Mckorr
Lax, I suck at C++

I'm an Intelligence Analyst by trade, not a programmer. I also missed something.
Code: Select all
DWORD parmServerName(PCHAR szVar, PCHAR szOutput, [color=red]PSPAWNINFO pChar[/color])
{
// $servername
strcat(szOutput,EQADDR_SERVERNAME);
return [color=red]10[/color];
}
Try that.