lindhsky
August 7th, 2020, 10:59
I am trying to learn how to program extensions for fantasy grounds and this is totally new to me. I have created projects in php and visual basic before but never touched lua. The best way to learn for me is to look at old code and examples, so I have gone through a lot of Damned's videos and they are so helpful and I have also zipped up extensions and looked at the structure there to understand it better. But I ran into some problems in a hobby project of mine.
This is for 5e and the normal (not the unity) version of fantasy grounds.
So I have added a skill called taunt to all characters. This worked and everytime I create a character this comes up. I also added this skill to the dropdown list on the Party Sheet so that I can test all characters at once with a simple click at the bottom of the main-frame of the Party Sheet. So far so good.
My plan is to let the characters set a taunt skill in the misc-column from 0 to 6 on the skill page on the character sheet. A tank would set perhaps 6 and a caster 0. This is just a little help for me in some cases when I want to see which character that will be attacked. Of course I don't look blindly at this, but it is just a little help for me. Or should I say, just a test project. :) So I roll in those kind of situations and looked which one that rolled highest with the taunt-value added and I decide which character the mob attacks.
What I want to do is to add text to the chat when a character have changed the misc value.
I got this to work when I added the function for this in an already existing onValueChanged() in record_char_skills.xml. When you click on the edit skills button at the bottom of that frame. I first wanted to try so that I got the code correct. And I got it right there. The correct value from the skill taunt was shown in the chat with the character name when I clicked the edit button. When I saw that it worked there I removed it and wanted add this to an onValueChanged when someone actually changed the misc-value.
I got this to work by adding the same code that worked before in a misc-tag. But instead of the charactername I got the skill name now and the skillvalue resulted in a nil-result. So I assume the code for calling the correct DB (local nodeWin = window.getDatabaseNode(); )is not correct, it seems to go to the skill-db instead or something just because I am inside the tags. I am just guessing. :)
So my question, how do I get the correct character name from the character sheet I am on and why is not the getValue working anymore to get the correct value of the skill when it worked before I tried to do it inside the misc-tag?
Here is the code that worked in one section of the character sheet but not inside the "misc"-tag.
<script>
function onValueChanged()
local msg = {font = "msgfont"};
local nodeWin = window.getDatabaseNode();
local rActor = ActorManager.getActor("pc", window.getDatabaseNode());
local curTaunt = DB.getValue(nodeWin, "skilllist.id-00016.misc");
msg.text = rActor.sName .. " is changing the Taunt Value " .. " to ".. curTaunt;
Comm.deliverChatMessage(msg);
end
</script>
Thanks in advance for any directions or help. And thanks a lot for your videos Damned, they are really helpful.
This is for 5e and the normal (not the unity) version of fantasy grounds.
So I have added a skill called taunt to all characters. This worked and everytime I create a character this comes up. I also added this skill to the dropdown list on the Party Sheet so that I can test all characters at once with a simple click at the bottom of the main-frame of the Party Sheet. So far so good.
My plan is to let the characters set a taunt skill in the misc-column from 0 to 6 on the skill page on the character sheet. A tank would set perhaps 6 and a caster 0. This is just a little help for me in some cases when I want to see which character that will be attacked. Of course I don't look blindly at this, but it is just a little help for me. Or should I say, just a test project. :) So I roll in those kind of situations and looked which one that rolled highest with the taunt-value added and I decide which character the mob attacks.
What I want to do is to add text to the chat when a character have changed the misc value.
I got this to work when I added the function for this in an already existing onValueChanged() in record_char_skills.xml. When you click on the edit skills button at the bottom of that frame. I first wanted to try so that I got the code correct. And I got it right there. The correct value from the skill taunt was shown in the chat with the character name when I clicked the edit button. When I saw that it worked there I removed it and wanted add this to an onValueChanged when someone actually changed the misc-value.
I got this to work by adding the same code that worked before in a misc-tag. But instead of the charactername I got the skill name now and the skillvalue resulted in a nil-result. So I assume the code for calling the correct DB (local nodeWin = window.getDatabaseNode(); )is not correct, it seems to go to the skill-db instead or something just because I am inside the tags. I am just guessing. :)
So my question, how do I get the correct character name from the character sheet I am on and why is not the getValue working anymore to get the correct value of the skill when it worked before I tried to do it inside the misc-tag?
Here is the code that worked in one section of the character sheet but not inside the "misc"-tag.
<script>
function onValueChanged()
local msg = {font = "msgfont"};
local nodeWin = window.getDatabaseNode();
local rActor = ActorManager.getActor("pc", window.getDatabaseNode());
local curTaunt = DB.getValue(nodeWin, "skilllist.id-00016.misc");
msg.text = rActor.sName .. " is changing the Taunt Value " .. " to ".. curTaunt;
Comm.deliverChatMessage(msg);
end
</script>
Thanks in advance for any directions or help. And thanks a lot for your videos Damned, they are really helpful.