Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+2)

Hello all.  I'm new to Decker.  I'm building a deck that has differently themed groups of cards.  I'd like to intercept field hyperlink clicks such that clicking a link from one card to another card within the same group navigates as normal, while clicking a link to a card in a different group plays a transition.  How can I achieve this?  Thanks!

(+1)

Since you're overriding this behavior on many cards, it's easiest to define an overload for the link[] event at the deck level; see Deck -> Properies... -> Script... via the menu. I'll assume for the sake of this example that cards are named with a "group_cardname" convention, so we can use the portion of the name preceding the underscore to determine whether two cards belong to the same group:

on link x do
 on groupname x do
  first "_" split x
 end
 if groupname[deck.card.name]~groupname[x]
  send link[x]
 else
  go[x "BoxIn"]
 end
end

Make sense?

You may have a different method of distinguishing groups, like invisible metadata fields on cards; I'd be happy to clarify how to adapt this approach to your deck, if needed.

(+2)

Thank you.  That was very helpful.  Here's what I ended up using:

on link x do
    target: deck.cards[x]

    if target
        if !(target.widgets.channel.text = card.widgets.channel.text)
            go[x "Wink"]
        else
            go[x]
        end
    else
        send link[x]
    end
end

(+1)

What about go["Back"]?  I want to keep the simplicity of go["Back"], but need to ensure that my transition plays when going back to a different card group.  Thanks again!

(1 edit) (+1)

Hmm. Tricky.

How about something like this?

on link x do
 here:deck.card
 send link[x]
 there:deck.card
 if !(here.widgets.channel.text=there.widgets.channel.text)
  go[here]
  go["Back" "Wink"]
 end
end
(+1)

Sorry for the confusion.  I have links and buttons in the mix.  Your answer solved the link issue.  However, I also have buttons with the Back action.  I need to make sure that if a back button from a channel one card would go back to channel two card, it plays the transition.

In that case you might want to consider giving the buttons a script that delegates to your link[] logic:

on click do
 link["Back"]
end