Add parameters to actions & conditions in dialogs.xml
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 536
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 3
Description
Now modmakers must write a similar separate functions for different things.
For example,
<phrase id = "1">
...
<precond> file.hasItem_pm </ precond>
<action> file.addItem_ak74 </ action>
...
</phrase>
<phrase id = "2">
...
<precond> file.hasItem_vodka </ precond>
<action> file.addItem_bread </ action>
...
</phrase>
function addItem_ak74 (first_speaker, second_speaker)
return dialogs.relocate_item_section_to_actor (first_speaker, second_speaker, 'wpn_ak74')
end
function addItem_Bread (first_speaker, second_speaker)
return dialogs.relocate_item_section_to_actor (first_speaker, second_speaker, 'bread')
end
function hasItem_pm (first_speaker, second_speaker)
return db.actor:object('wpn_pm ') ~ = nil
end
function hasItem_vodka (first_speaker, second_speaker)
return db.actor:object('vodka ') ~ = nil
end
I propose to make support arguments so as not to produce a bunch of similar functions.
For example,
<phrase id = "1">
...
<precond> file.hasItem ({"wpn_pm"}) </ precond>
<action> file.addItem ({"wpn_ak74"}) </ action>
...
</phrase>
<phrase id = "2">
...
<precond> file.hasItem ({"vodka"}) </ precond>
<action> file.addItem ({"bread"}) </ action>
...
</phrase>
function addItem (first_speaker, second_speaker, sections)
for k, v in pairs (sections)
dialogs.relocate_item_section_to_actor (first_speaker, second_speaker, v)
end
end
function hasItem (first_speaker, second_speaker, sections)
for k, v in pairs (sections)
if (db.actor:object(v) == nil) then
return false
end
end
return true
end
It does not greatly affect the already made dialogues, in a pinch, you can go by regular expressions of action\precond\.. and add to the end of the parenthesis
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review dialogs.xml and the Lua action and precondition examples in the issue to trace how these handlers are currently referenced and invoked. Define support for argument lists while preserving existing dialogue syntax; the examples should no longer require one function per item, and existing dialogues should continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, xml
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100