• 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!

Items.xml don't recognize "-"

Zazeros

Member
Joined
Feb 13, 2012
Messages
74
Reaction score
19
0.4

Good afternoon everyone, I didn't know how to explain my problem in the title, so I apologize.

My items.xml doesn't recognize this dash, so all items that are, for example, like this:
C++:
<item id="4667-4690" name="dirt"/>

On the server it looks like this:
You see an item of type 4690, please report it to gamemaster.

What can I do?

Thank you.
 
Solution
0.4

Good afternoon everyone, I didn't know how to explain my problem in the title, so I apologize.

My items.xml doesn't recognize this dash, so all items that are, for example, like this:
C++:
<item id="4667-4690" name="dirt"/>

On the server it looks like this:
You see an item of type 4690, please report it to gamemaster.

What can I do?

Thank you.
Use fromid and toid
XML:
<item fromid="4667" toid="4690" name="dirt"/>
0.4

Good afternoon everyone, I didn't know how to explain my problem in the title, so I apologize.

My items.xml doesn't recognize this dash, so all items that are, for example, like this:
C++:
<item id="4667-4690" name="dirt"/>

On the server it looks like this:
You see an item of type 4690, please report it to gamemaster.

What can I do?

Thank you.
Use fromid and toid
XML:
<item fromid="4667" toid="4690" name="dirt"/>
 
Solution
My god, it's going to take a long time to do this manually.
Message me privately. I'll build a quick script to automate it for you
For sure simple .php/.py/.js script can do it for you in seconds (move id='X-T' to fromid="X" toid="Y") for whole items.xml. So msg @Fjorda

These are not Tibia.dat or Tibia.spr files with "tibia client" 'custom format'. It's .xml, which is widely supported since 1998 in all programming languages.
 
For sure simple .php/.py/.js script can do it for you in seconds (move id='X-T' to fromid="X" toid="Y") for whole items.xml. So msg @Fjorda

These are not Tibia.dat or Tibia.spr files with "tibia client" 'custom format'. It's .xml, which is widely supported since 1998 in all programming languages.
I thought of a quick and even easier way using regexp. Had to watch out for "-" within attribute values, but it will match any set of ids in the format of: id="number-number".

@Zazeros
Open up items.xml in notepad++ or an IDE capable of using regexp in find/replace.
Click Replace tab at the top.

In the "Find what" field, enter:
Code:
id=\"(\d+)-(\d+)\"

In the "Replace with field, enter:
Code:
fromid=\"$1\" toid=\"$2\"

Make sure Regular expression is the search mode!
Click Replace All.

regexp.jpg
 
Back
Top