Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script][Bug] "Duplicate a Character and Token" - not really setting bar link

March 29 (3 years ago)

Hi

I discovered through using it that, it looks like the bar is set, the value is set, but once you edit it through the bar UI (the round input over the token), the value are changed back to a "default" max value, when you look at the token, it says the link is correct, when you drag a new token of this created one, the link works, but not for the one directly created, and sadly ... i need to use them x)


Could a little setTimeout around the setting action of the bar link be enough ?

i'll let you @Chris Dickey look into it when you have time, i'll use a quick token-mod macro as a patchwork during the time to re apply the bar link.


While i'm here i'd like to thank you for this script which i use a lot so i don't have to reset life on each enemy i put my player against x) a great time saver !

Have a great day everyone :)

March 29 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Hi Groch!

You will likely need to PM Chris Dickey directly. The Roll20 forums do not have a user tagging system.

March 29 (3 years ago)

okay Thanks !

Sounds like the same problem tokenmod has as well when rolling hp and setting a bar link in the same command.  I'd love to hear a solution to this.  

March 29 (3 years ago)
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator

Sorry, but I don't really understand this at all. Can you provide a more detailed example of what is going on?

Specifically, I have a character "X". It is linked with bar 3 set to "Damage" with a current value of 2 and a Max value of 33.

I duplicate the character to have "X 1". I use the character sheet to change the Damage to 4 and lower the Damage Max to 30. Everything looks good on the token and the values are changed there. I use the round circles of the bar UI to change Damage to 6. The damage correctly flows to the character sheet and the token, still no problems found. I am unaware of any way to use the bar UI to change the MAX value of damage (it can be done through the gear icon, but this does not seem to be talking about doing it that way). I drag a 2nd token of "X 1" to the VTT and change stuff as above. All the changes flows to both the character sheet and both tokens. The max values are of the character sheet and the tokens are all set to the last value that I changed it to on the character sheet. Obviously none of these changes are reflected in character "X", since that is a totally different character with different Tokens.  Still no troubles found. 

So what exactly and precisely is the troublesome behavior you are seeing and how is it duplicated?

March 30 (3 years ago)

Edited March 30 (3 years ago)

ok i've screeshoted everything
dunno if u'll be able to reproduce it but i can do it consistently on my game

Original state :


Duping Token and showing stats

Editing value through the bar

After edit result

After edit Character sheet

still showing 4 / 4 will power
and then comparing the edited token, and a new one drag and dropped from the dupped created :


I hope there is enough info for you to locate the issue and/or reproduce it


edit: its a custom character sheet, if it can narrow the issue

March 30 (3 years ago)
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator

How is willpower_max getting set to 5? Setting willpower from 4 to 5 should not affect willpower_max at all.  So how is it being set to 5?

Could you also let me know what the attributes & abilities tab says for willpower after each step? Or at least if it says anything different or unusual?


But it is clear that at some point it is loosing the linking. In all except the last screenshot bar2 and bar3 have an attribute value correctly linked. in the last screen shot the newly dragged token does not have any attributes linked. So that is the problem. Can you narrow it down as to exactly when it is loosing the links?

For example is the case that a token that is dragged out looses it's links? Or that one that is dragged out after the values are edited looses it's links? Or one where the value is set to be above the old max value?

Maybe do a whole series of tests where you try different things as far as duplicting and editing and dragging and find out some cases where tokens do or don't lose their links, or not. 

March 31 (3 years ago)

Edited March 31 (3 years ago)

HI again


For me, the link isn't saved really, as soon as i dupe the token, if i drag the new one from the journal, the link is not there


the link "appear" broken as soon as i modify the value in the blue bubble, it updates the maximum of the bar, but the UI still says it's linked, even if it's not, the willpower value nor the willpower_max value are changed in the created character sheet (in the attributes & abilities tab)


i feel its a race condition, as if setting link is too long in database, but you get the "ok" from database even if it's not finished, and when you save the whole token, the link is not yet set (sorry if i'm not completely correct it's not my main language), so when the save happen, the values are there but not the link ?

i know it's weird but it's the best clues i could figure, thats why i spoke about a setTimeout in some way, at start i said you to do it on setting the link, but maybe on saving the token before dropping it would yield better result ? :/


Hope it helps ! thanks for your time

edit: i checked sheetworker & api scripts just to be sure, and i never edit willpower_max, so i really don't have more clues for you atm

March 31 (3 years ago)

Edited March 31 (3 years ago)

Ok i have a clue,

in my sheetworker, i missed somewhere where i set up default attributes, but that doesnt explain why it triggers if you copy all attributes, and why link is broken

investigation in progress

edit: no, the attribute is correctly copied

and the code only trigger on this variable ...

Best clue i have is that token drag & dropped directly after script created the new sheet&token appear as broken link

April 01 (3 years ago)
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator

OK, we are making progress. We know that the real problem seems to have nothing to do with the values being edited though the bubbles.  If we dup a character and the first thing we do is drag a new token out, the dragged token already has the problem. So progress of a sorts.

I don't think it is a timing issue. in one of the screen shots above, it has the words in the chat window "Done duplicating Civretch 2 times. It took one seconds". That is there because if you are making many copies of a character with thousands of attributes it might take several minutes.  Anyway, assuming you are waiting for that message to appear before dragging your new tokens out, then the duplicating process should be totally and completely done. You are waiting for it to be done aren't you?

Also, how are you linking the tokens? Thought the token gear tab or using some API script? Maybe send some exact details of how you are doing that?

I am pretty stumped. Can you PM me a link to a google share or dropbox that has all the html, css, and js for your project?


April 01 (3 years ago)

Edited April 01 (3 years ago)

Yeah i'm waiting the message before drag n dropping

for the link, usually i put the token image, then double click,  select which character sheet it's linked to validate the UI, then i use token_mod to set which bar is set to what with this default_setup macro

!token-mod --set width|70 height|70 bar1_link|peripheral-essence bar2_link|willpower bar3_link|onslaught bright_vision|0 night_vision|1 night_vision_distance|3 night_vision_effect|dimming|0 emits_bright|0 showplayers_aura1|0 aura1_radius|0 aura1_color|#fff --off playersedit_aura1

so i can setup multiple token at once, only need to do a scale command, then set the default, and when i need to use token, i drop all token i need, do a macro that scale all token depending on page scale/size, and everything is setup !


you can find all i do here : https://github.com/groch/roll20_exalted_stuff/

api/script wise

  • combat_master.js is a fork i specified for Exalted 3E (thanks to original author are obviously present)
  • ex3_dice_roller.js is a dice roller for the game (handling limited reroll/explodes & recursive ones and so on)
  • (node_dice_roller.js is a tool you can execute in nodejs to make statistical analysis on rolls using the same script injected into roll20)

and for charsheet

  • roll20_character_sheet.css
  • roll20_character_sheet.html

both are what i put in the game custom sheet

hope it helps !


ps: i started with things already written so, not every code part is equally consistent, i'm trying to improve everything step by step !

April 14 (3 years ago)

Hello,

Any clues on the issue ? ^^'

April 15 (3 years ago)
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator

No, sorry, not yet. I have verified that I can duplicate the issue. When I drag a token out, it is no longer properly linked. 

I never ran into the problem before because I never drag duplicated tokens out to the tabletop. The whole point for me is to have one character sheet per token, and the api creates the token I need, so I never drag new ones out. 

But like I said, I can duplicate the problem and will look at it again as soon as I have a chance. 

April 15 (3 years ago)

okay ! perfect, thanks a lot then :) i have a temporary fix but i was thinking if you could replicate or anything.

have a great day !

April 17 (3 years ago)
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator

OK, bug fix is submitted and will go live on the next merge sometime in the next several days.

The problem was that at the end of the program the main thread calls. setDefaultTokenForCharacter(), yet the program was multi-threaded, and some of the other threads finished after that. So I made sure that setting the default token is the very last thing done, and it now tests out good. 

April 18 (3 years ago)

Hello !

That's wonderfull ! thanks a lot :) and ok from what you describe i could describe that as a sort of race condition but i might be mistaken.
Anyways, it's really great, thanks again for the good work and i wish you lots of great games !

Havea a good day