epic-power-rpg / roll20

Apache License 2.0
0 stars 0 forks source link

Initiative roll should add or update to turn order #73

Closed jazeee closed 1 year ago

jazeee commented 1 year ago

I tested in the Mods script area, and found that

    findObjs({_pageid: pageid,
        _type: 'graphic'});

returns an empty array. Due to this, the turn order is not updated.

Needs further investigation. @johnlamping - this is what I found so far.

johnlamping commented 1 year ago

I thought it might have something to do with transmogrified characters, but I'm also seeing the problem in a brand new character in Alanya. I tried things in Carlonia, which still has the old character sheet, and initiative is working right there. So it does not appear to be a roll20 change, but something about the new character sheet.

P.S. Here is how someone else showed how to get all tokens for a character.

findObjs({type:graphic}).filter((o)=>o.get('represents')===characterid);

On Sat, Jan 21, 2023 at 7:54 PM Jaz @.***> wrote:

I tested in the Mods script area, and found that

const right_tokens = tokens.filter((token) =>
    token.get('represents') == character_id);

returns an empty array. Due to this, the turn order is not updated.

Needs further investigation. @johnlamping https://github.com/johnlamping - this is what I found so far.

— Reply to this email directly, view it on GitHub https://github.com/epic-power-rpg/roll20/issues/73, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTV55RVCX2RXWLS4C247ODWTSVOXANCNFSM6AAAAAAUCYE7SQ . You are receiving this because you were mentioned.Message ID: @.***>

jazeee commented 1 year ago

I wonder if it is related to the upgrade to non-legacy. I'll play around with it...

On Sat, Jan 21, 2023, 8:44 PM John Lamping @.***> wrote:

I thought it might have something to do with transmogrified characters, but I'm also seeing the problem in a brand new character in Alanya. I tried things in Carlonia, which still has the old character sheet, and initiative is working right there. So it does not appear to be a roll20 change, but something about the new character sheet.

P.S. Here is how someone else showed how to get all tokens for a character.

findObjs({type:graphic}).filter((o)=>o.get('represents')===characterid);

On Sat, Jan 21, 2023 at 7:54 PM Jaz @.***> wrote:

I tested in the Mods script area, and found that

const right_tokens = tokens.filter((token) => token.get('represents') == character_id);

returns an empty array. Due to this, the turn order is not updated.

Needs further investigation. @johnlamping https://github.com/johnlamping - this is what I found so far.

— Reply to this email directly, view it on GitHub https://github.com/epic-power-rpg/roll20/issues/73, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACTV55RVCX2RXWLS4C247ODWTSVOXANCNFSM6AAAAAAUCYE7SQ

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/epic-power-rpg/roll20/issues/73#issuecomment-1399403838, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK6O2HXIANTFAHS4Q7YDC3WTS3JLANCNFSM6AAAAAAUCYE7SQ . You are receiving this because you authored the thread.Message ID: @.***>

jazeee commented 1 year ago

What we do is basically:

findObjs({_pageid: pageid, _type: 'graphic'}).filter((token) =>
        token.get('represents') == character_id)

The specific difference is the properties passed to findObjs I'll see what happens if we remove the _

jazeee commented 1 year ago

I went back to https://github.com/epic-power-rpg/roll20/tree/5e16716a2b886b4ad78d959d7f194911fdef6909 which was the commit when you added the initial API_Scripts.js file. Tested in JazLanya. I still couldn't get the turn order to update even with the legacy UI and code.

I wonder if we should get the api code from Carlonya and compare.

jazeee commented 1 year ago

Ahh, ok, I got it working using legacy code on JazLanya. I forgot to add the character on to the map.

jazeee commented 1 year ago

Works at 4b9a860ed4de0b455dc41a48ddf92b8f65e65480. Doing a binary search of commits.

jazeee commented 1 year ago

Ok, the breakage occurred in my PR: https://github.com/epic-power-rpg/roll20/pull/20

jazeee commented 1 year ago

Found it... An extra " in the string. Fixin gnow

jazeee commented 1 year ago

Fixed in #74