HeurekaI got it working!
Just need to clean up the mess inside the lua script (tomorrow).The general Idea how my script works:
1 function with 2 parameters (table id, object id) which accesses a specific dialog via these 2 parameters
(Table: eDialogs (Id: 11) Id: 1 for example is the first saved dialog in the game. You can find out the different dialog ids by using the explorer and dump the dialog entry to the log)
so instead of using
which returns all dialogparts of the "start" dialog of "mynpc"
i use a shorter version:
getObject("(" .. tableid .. "," .. id .. ")"):getLinks(VDialogDialogParts);
to get the exact same dialog parts.
Of course the above srcipt part uses the parameters from the function...
using the function function csdo(table,id)
(short for "count specific dialog options") i read out all dialogparts for the given dialog.
for each dialogpart the counter goes only +1 if the dialogpart is still available and its condition is true (or if negated false).
after this we have a number. This number is neccessary to call another function which changes the dialogarea of the currentcharacter.
Because the changes which are made to the dialogarea only get visible after the next dialog is shown, we have to call all the csdo functions before the dialog is displayed.
E.g. before the
1. dialog starts count the parts from the first dialog, then start dialog.
2. when in a subdialog and want to return to a level higher call the script for the above dialog in the executed action which runs when the selection is clicked.
Things to condider:
when having a subdialog with e.g. 3 dialog parts and all these get deleted after they are selected. The dialog jumps one level higher, when all 3 options are removed. Because of this we have to define a value which counts up on each of the dialog parts and when all 3 were selected run the script for the above level, else run it for the current level.