Make referencing a uuid in eval work in more situations. #412

Closed
opened 2025-11-08 07:22:29 +00:00 by LunarTides · 0 comments
LunarTides commented 2025-11-08 07:22:29 +00:00 (Migrated from github.com)

Currently, something like:

game.pause(`${@abcdefg.health} ${@1234567.health}`)

doesn't work since it gets replaced with:

(async () => {
    game.pause(`${let __card = Card.fromUUID("abcdefg");if (!__card) throw new Error("Card with uuid \"abcdefg\" not found");__card.health} ${let __card = Card.fromUUID("1234567");if (!__card) throw new Error("Card with uuid \"1234567\" not found");__card.health}`)
})()

Fix this by doing something like this:

(async () => {
    const __card_abcdefg = Card.fromUUID("abcdefg");
    if (!__card_abcdefg) throw new Error("Card with uuid \"abcdefg\" not found");
    const __card_1234567 =  Card.fromUUID("1234567");
    if (!__card_1234567) throw new Error("Card with uuid \"1234567\" not found");

    game.pause(`${__card_abcdefg.health} ${__card_1234567.health}`);
})()

Basically, create the needed cards at the beginning, then replace the references with those variables.

Currently, something like: ```ts game.pause(`${@abcdefg.health} ${@1234567.health}`) ``` doesn't work since it gets replaced with: ```ts (async () => { game.pause(`${let __card = Card.fromUUID("abcdefg");if (!__card) throw new Error("Card with uuid \"abcdefg\" not found");__card.health} ${let __card = Card.fromUUID("1234567");if (!__card) throw new Error("Card with uuid \"1234567\" not found");__card.health}`) })() ``` Fix this by doing something like this: ```ts (async () => { const __card_abcdefg = Card.fromUUID("abcdefg"); if (!__card_abcdefg) throw new Error("Card with uuid \"abcdefg\" not found"); const __card_1234567 = Card.fromUUID("1234567"); if (!__card_1234567) throw new Error("Card with uuid \"1234567\" not found"); game.pause(`${__card_abcdefg.health} ${__card_1234567.health}`); })() ``` Basically, create the needed cards at the beginning, then replace the references with those variables.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
LunarTides/Hearthstone.js#412
No description provided.