• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling Adding a new attribute to items.xml

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,294
Solutions
3
Reaction score
1,037
I am trying to add a custom attribute to items.xml that I can check in-game using the function "getItemInfo". Basically what I did was take the attribute "runeSpellName" and just copy it with a different name. Here is the process of what I did, and the results of what happened after:

I am using TFS 0.4 rev. 3884

Starting out with the items.xml I added this:
Code:
<item id="2263" article="a" name="Test Rune">   
        <attribute key="runeSpellName" value="real rune" />
        <attribute key="runeSpellTest" value="test rune" />
    </item>

Then I started up the server and got this error:
Code:
[12:33:16.698] >> Loading items (XML)
[12:33:16.732] [Warning - Items::loadFromXml] Unknown key value runeSpellTest
[12:33:16.771] >> Loading groups
Well of course I got this error because I did not add the attribute to the source yet, so off I went to add this neat little attribute, and this is how I did it:

In items.h I located:
Code:
std::string name, pluralName, article, description, text, writer, runeSpellName, vocationString;
And I added ", runeSpellTest" to it like so:
Code:
std::string name, pluralName, article, description, text, writer, runeSpellName, runeSpellTest, vocationString;

In items.cpp I located:
Code:
else if(tmpStrValue == "runespellname")
            {
                if(readXMLString(itemAttributesNode, "value", strValue))
                    it.runeSpellName = strValue;
            }
Below it I added:
Code:
else if(tmpStrValue == "runespelltest")
            {
                if(readXMLString(itemAttributesNode, "value", strValue))
                    it.runeSpellTest = strValue;
            }

In luascript.cpp I located in the function "getItemInfo":
Code:
setField(L, "runeSpellName", item->runeSpellName.c_str());
Below it I added:
Code:
setField(L, "runeSpellTest", item->runeSpellTest.c_str());

From here I recompiled the server. Time to test it out!

I start up the server:
Code:
[12:46:02.112] >> Loading items (XML)
[12:46:02.187] >> Loading groups
Sweet, as you can see there is no more error!

So I log into the server to check out my sweet new attribute and I find my character teleported to temple unable to walk at all and every ground tile in the game is completely screwed up:
jnh7ZdD.jpg


At this point I have been troubleshooting this issue for about 3 hours and I am extremely frustrated. If anyone knows why this is happening and how I can overcome this issue I would be extremely grateful.
 
Ah, I've had this problem before on my server when testing out a couple things.

The solution is simple.


You just have to press Alt and the F4 button at the same time.

Hope I helped fix your problem. If you have any further questions, send me a PM.

- HeartlessX
 

Ah, I've had this problem before on my server when testing out a couple things.

The solution is simple.


You just have to press Alt and the F4 button at the same time.

Hope I helped fix your problem. If you have any further questions, send me a PM.

- HeartlessX

What he meant was -->


  1. Right-click in the screen’s bottom-left corner and choose the Control Panel from the pop-up menu.

  2. When the Control Panel appears, choose Uninstall a Program from the Programs category.

    The Uninstall or Change a Program window appears, listing your currently installed programs, their publisher, size, installation date, and version number.

    To free up disk space, click the Installed On or Size column header to find old or large programs. Then uninstall those forgotten programs you never or rarely use.

  3. Click the unloved program and then click its Uninstall, Change, or Repair button.

    The menu bar above the programs’ names always displays an Uninstall button, but when you click certain programs, you may also see buttons for Change and Repair. Here’s the rundown:
    • Uninstall: This completely removes the program from your PC. (Some programs list this button as Uninstall/Change.)

    • Change: This lets you change some of the program’s features or remove parts of it.

    • Repair: A handy choice for damaged programs, this tells the program to inspect itself and replace damaged files with new ones. You may need to have the program’s original CD or DVD handy, though, because you’ll need to insert it into your computer.
  4. When Windows asks whether you’re sure, click Yes.


    Hope I helped!
 
Back
Top