Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Hmm, I did try adding the aforementioned script to try and have the button appear when the field has scrolled down all the way instead, but could not get that to work as it was not targeting the field inside the contraption (I presume). Ultimately, with this I’m mainly trying to have a link that caps off the end of the field when scrolled down that links to the next card—and based on your advice it seems that a link in the rich text field is most hassle free way to accomplish that.

However, while linking some text at the end to the next card works, I’m still trying to parse out how to use the link feature to call an alert[] when some text is linked in the field. From what I understand, I canwrite alert[] or go[] into the scripting area to fire the event directly. Where the confusion stems is regarding if I can link to an alert that displays on the same card, then click Okay and be redirected to the next one.

(+2)

When you click a link in a field, that sends a link event to the field. If the field doesn’t handle it, it bubbles up to the card the field is on - in this case, the contraption’s prototype. If the prototype doesn’t handle the event, it bubbles up to the default event handlers, including this one:

on link x do
 go[x]
end

If you want clicking a link to anything other than go straight to the target, you have to add your own on link... handler to interrupt the default handling.

The easiest thing is just to put it into the prototype’s script, especially if you always want clicking a link in one of these text fields to display an alert before moving on, something like:

on link target do
 alert["You have clicked a link. This will be reported to the authorities."]
 go[target]
end

If you want different contraptions to have different behaviour, you’ll want the link event inside the prototype to become a link event on the contraption, by putting something like this in the prototype’s script:

on link target do
 # forward the event to the contraption
 card.event["link" target]
end

Then you can put different on link... handlers on different copies of the contraption, for different behaviour.