Hello all: I've got two problems and they are related and both probably are a reflection of my lack of coding skills. So, I'm using KaVir's protocol snippet for ROM and I'm hitting two snags. One I know is my lack of knowledge and the other is I have no idea.
Problem 1 OK, I'm trying to code my generation variable so it will display with MSDP. I have done a number of other variables fine, but this one is giving me problems.
MSDPSetNumber( d, eMSDP_GEN, d->character->gen );
I'm basing it off of this:
sprintf(buf, "Your generation is: %d.\n\r", ch->gen);
But when I use mushclient and configure it to show:
if msdp["RACE"] == "Vampire" then outlined_text (colourGold, score_window, msdp["GEN"]..'th '..msdp["CLAN"]..'', 10, 5, y_offset, score_width) else outlined_text (colourGold, score_window, msdp["RACE"]..' ('..msdp["CLAN"]..')', 10, 5, y_offset, score_width) end – if
I get fun error messages that after putting in some troubleshooting statements tells me that GEN is nil. But for the life of me, I know it's not because even looking at the information in the pfile it says it is 8. Any thoughts?
Problem 2 The way health is coded is again based on the WoD system, but we display health using this:
msdp["RACE"] It's not a good idea to use pointer to const char as an array subscript.
30 Nov, 2011, JohnnyStarr wrote in the 3rd comment:
Votes: 0
haha
30 Nov, 2011, David Haley wrote in the 4th comment:
Votes: 0
I'm not sure it's great to be laughing at somebody trying to learn how to code. :sad:
What he did would be perfectly appropriate in other languages, or even in C++ for a map. Don't kill him for not realizing you can't do that in C with straight arrays.
<unhurt> get gen MSDP RECV (GEN) (13) #variable {MSDP_GEN} {13}
The code you posted looks fine as well. So my guess is you just didn't add it to the REPORT line in the OnPluginTelnetRequest() function in the plugin. You no longer need to send them all in the same line, either, so if you prefer you could just add another REPORT call below the first:
SendPkt ("\255\250\69\1REPORT\2GEN\255\240")
Problem 2: The first code section shows health_string() taking a CHAR_DATA* argument, so assuming that's correct the second should be:
I've got two problems and they are related and both probably are a reflection of my lack of coding skills. So, I'm using KaVir's protocol snippet for ROM and I'm hitting two snags. One I know is my lack of knowledge and the other is I have no idea.
Problem 1
OK, I'm trying to code my generation variable so it will display with MSDP. I have done a number of other variables fine, but this one is giving me problems.
I'm basing it off of this:
But when I use mushclient and configure it to show:
I get fun error messages that after putting in some troubleshooting statements tells me that GEN is nil. But for the life of me, I know it's not because even looking at the information in the pfile it says it is 8.
Any thoughts?
Problem 2
The way health is coded is again based on the WoD system, but we display health using this:
And I'm not sure how to put it in code wise. I have this right now in the update.c file, but I know it's not right.
Any help would be appreciated. Thanks in advance.
Arholly