Jump to content

i2d; item script to description


trickyloki3

Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   15
  • Joined:  11/03/14
  • Last Seen:  

Hey guys,

I'm working on a project that translates item scripts into item descriptions. The source is available at github.

The idea is simple. For example, the item script from item id 1310 (Glorious Cleaver)

{ bonus2 bAddRace,RC_DemiHuman,75; bonus2 bAddRace,RC_Player,75; bonus2 bIgnoreDefRaceRate,RC_DemiHuman,20; bonus2 bIgnoreDefRaceRate,RC_Player,20; bonus bUnbreakableWeapon; .@r = getrefine(); if(.@r>5) { bonus2 bAddRace,RC_DemiHuman,pow(min(14,.@r)-4,2); bonus2 bAddRace,RC_Player,pow(min(14,.@r)-4,2); bonus2 bIgnoreDefRaceRate,RC_DemiHuman,5; bonus2 bIgnoreDefRaceRate,RC_Player,5; bonus bAspdRate,5; } if(.@r>8) { bonus bAspdRate,5; bonus3 bAutoSpell,"NPC_CRITICALWOUND",1,50; bonus4 bAutoSpellOnSkill,"MC_MAMMONITE","NPC_CRITICALWOUND",2,200; } }

is converted into

Increase physical damage by 75% against demihuman enemies.
Increase physical damage by 75% against player enemies.
Pierce physical defense by 20% of demihuman enemies.
Pierce physical defense by 20% of player enemies.
Weapon is indestructible.
[Refine Count is 6 - 15]
Increase physical damage by 6% ~ 15% (Refine Count) against demihuman enemies.
Increase physical damage by 6% ~ 15% (Refine Count) against player enemies.
Pierce physical defense by 5% of demihuman enemies.
Pierce physical defense by 5% of player enemies.
Attack Speed +5%
[Refine Count is 9 - 15]
Attack Speed +5%
Add a 5% chance to cast Critical Wounds of level 1 on each normal attack.
Add a 20% chance to cast Critical Wounds of level 2 when using Mammonite.

 

Another example, the item script from item id 1311 (Vecer Axe)

{ if(readparam(bLuk)>=90) { bonus bBaseAtk,20; } if(readparam(bDex)>=90) { bonus bCritical,5; } if(readparam(bDex)>=90&&readparam(bLuk)>=90) { bonus2 bSkillAtk,"MC_MAMMONITE",15; } }

is converted into

[LUK is 90 - 150]
Base ATK +20
[DEX is 90 - 150]
Critical +5
[DEX is 90 - 150 and LUK is 90 - 150]
Increase damage of Mammonite by 15%.

 

The tool has a few limitations regarding non-trivial code structures and unsupported statements, functions, and etc. 

However, the tool's one major advantage is that there is no mismatch between the server's item scripts and client's item descriptions.

If this sounds familiar, then you may remember me from this thread

Unlike the previous project, you can translate the json data files into another language, which is used to generate item descriptions.

Project

Language: C

License: Public Domain

Platform: Windows, Linux, Mac OS X

Dependency: jansson (MIT License)

Build: Visual Studio 2017, makefile

Support: rAthena (renewal)

To Do

  1. lua format
  2. flavour text [optional]

I Need Help

I need multiple sources for flavor text in English. If you have any links or files, then feel free to send them to [email protected].

For example, the item id 1186 (Death Guidance) has the flavor text (from RMS).

All present for the destruction of weapons that exist cursed.
The sword is the curse of his master, and is the owner and make someone unhappy.

 

Edited by trickyloki3
  • Upvote 3
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

I followed this for a while. This is everyone needed tools!

Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   23
  • Joined:  04/28/12
  • Last Seen:  

@trickyloki3 Great looking work mate.

When you say you are looking for flavor text in English, would the following links be useful to you?

Also, do you have ideas of how to "test" whether the results are good or not? The challenge of automating something at a large scale (e.g. roughly 15000 items) is the concern that the descriptions might not be of good quality, i.e. The hand-performed modifications done in the above-linked github repositories are able to maintain the high-quality descriptions at the cost of man-power, resources, time.

What I think can aid in your project is coming up with some test scripts/measurement.

Measurement

I'm considering of helping out (idk, write test scripts or something?)

I was thinking of:

  • Determining NLP-related textual similarity measures that measure how different the expected description is versus the automated description
    • e.g. Edit distance
    • Not sure of other textual similarity measures that are (a) simple enough to compute fast (b) is a sufficient measure for semantic relatedness/similarity
      • This will definitely take time to research
  • Collecting a few samples from RMS
  • Building a few test scripts to see how this way of evaluation may work out for your system

Personally, I think that edit distance might be enough as a measure for it, and doing textual similarity on descriptions is over kill. 

In any case, you would know best what you need help with, and what you think is the priority/roadmap of your project.

I want to know what you think. You have any ideas about it?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   15
  • Joined:  11/03/14
  • Last Seen:  

@iwilnot Thank you for the links.

Do you mean comparing the different flavor text?

Otherwise, I only check whether or not the generated item description is semantically equivalent to the item script.

Edited by trickyloki3
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   23
  • Joined:  04/28/12
  • Last Seen:  

@trickyloki3 Yes, I do mean comparing for the different flavor text. The last message you wrote was asking for help with regard to Flavor text, and that's what I was concerned with. 

The problem: scaling up generation of item descriptions for flavor text

Your program is about automation which excites me, but I am not sure how to scale up/automate the Flavor text part. That is big chunk of work you'll need to do to make sure each item's complete description (including flavor text) is reliable.

It's either we do checking manually (which Asheraf, Zackdreaver, and community contributors already do) or we go with the fundamental idea of your work: automating the item descriptions. I like the path you're taking: automate it. We already have very few volunteers in the community. Better to make good use of their time and automate what we can.

We already have existing reliable and high quality datasets for item descriptions (Asheraf, Zackdreaver). We frame the task of item descriptions generation as a dataset generation problem, and the goal is to achieve similar quality as that of the gold standard: Human-processed manually checked item descriptions.

To compare the similarity between two things, we need a measure. Coming up with some statistical measure can help you be more confident that your generated item descriptions are indeed semantically equivalent to the item.

 

What good would a statistical measure do? How can it be useful?

Having a statistical measure, like edit distance, can allow us to see statistics between the datasets. This is illustrated in an example below:
 

Asheraf Translation vs. trickyloki AutoGen DB to Item Description

15,000 items automatically generated from item_db.conf and item_db2.conf
13,000 items compared between the two data translations.
Average edit distance: 4 characters (means that your automatically generated descriptions only vary with asheraf's translation by 4 characters on the average).

 

Zackdreaver Translation vs. trickyloki AutoGen DB to Item Description

15,000 items automatically generated from item_db.conf and item_db2.conf
12,000 items compared between the two data translations.
Average edit distance: 12 characters (means that your automatically generated descriptions only vary with zackdreaver's translation by 12 characters on the average. This is curious, and since this is all automated, you can easily query which items had high edit distances and study why they varied, so you can better tailor your description algorithm).

 

In the end, you're not aiming to be perfectly close to Asheraf or Zackdreaver, but to generate not only high quality item script descriptions but also still have reliable flavor text that we all love to read while playing RO.

These are only ideas and suggestions; it is your project sir, and I wish you all the best. Thank you for your generous contribution to the community!

Edited by iwillnot
  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   15
  • Joined:  11/03/14
  • Last Seen:  

Last time I did flavor text, I just pick among a few sources for the best translation and stored it in a sqlite3 database, which can be found here. Then I combine the flavor text with what I generated from the item scripts and properties.

Imo, flavor text could be an optional feature since I don't want to go through that process again. The primary goal of i2d is to translate item script to item description. (See the attached file; output.txt.) To be honest, a separate program could always do the final itemInfo.lua generation.

Here is a few samples from output.txt

4658 - Nightmare Verit Card
[script]
{ bonus2 bMagicAddClass,Class_All,5; if(getrefine()>6) { bonus2 bMagicAddClass,Class_All,3; } if(getrefine()>8) { bonus2 bMagicAddClass,Class_All,2; } } =>
Increase magic damage by 5% against normal, boss, guardian, and battlefield enemies.
[Refine Count is 7 - 15]
Increase magic damage by 3% against normal, boss, guardian, and battlefield enemies.
[Refine Count is 9 - 15]
Increase magic damage by 2% against normal, boss, guardian, and battlefield enemies.

12225 - Sweet Candy Cane
[script]
{ pet 1245; } =>
Tame a Christmas Goblin.
[Pet Script]
Add a 5% (+5% when loyal) chance to cast level 5 Sight.

[Loyal Pet Script]
Max HP +30
Reduce damage by 1% from water property.

4653 - Nightmare Arclouse Card
[script]
{ bonus2 bSubRace,RC_Brute,20; bonus2 bSubRace,RC_Undead,20; } =>
Reduce damage by 20% from brute enemies.
Reduce damage by 20% from undead enemies.

[combo]
[Nightmare Arclouse Card, Nightmare Mimic Card Combo]
Reduce damage by 5% from brute enemies.
Reduce damage by 5% from undead enemies.
Pierce magic defense by 50% of brute enemies.
Pierce magic defense by 50% of undead enemies.
[Nightmare Arclouse Card, Nightmare Minorous Card Combo]
Reduce damage by 5% from brute enemies.
Reduce damage by 5% from undead enemies.
Pierce physical defense by 50% of brute enemies.
Pierce physical defense by 50% of undead enemies.

It is not perfect, but it does a great job for simple code structures.

output.txt

Edited by trickyloki3
Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   15
  • Joined:  11/03/14
  • Last Seen:  

The project is close to completion. I still have to integrate the lua library and write the source for updating an existing itemInfo file.

I don't know if anyone was able to get this project to work by themselves. If so, then I would love to hear your feedback.

I have attached a text file containing the item descriptions generated by i2d. (using the renewal item database from dd0842)

If you are interested in this project, then feel free to message me. I want to make this project easy to use, accessible, and free for everyone.

output.txt

Edited by trickyloki3
  • Love 1
  • MVP 1
Link to comment
Share on other sites

  • 2 years later...

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3122
  • Reputation:   1614
  • Joined:  03/26/12
  • Last Seen:  

This topic has been moved to the "Abandoned Projects" sub-forum.

If the author is still working on this project, they may request that a moderator moves the topic back and removes this post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...