Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

help with hypertext links

A topic by tamagotchivideo created 4 days ago Views: 58 Replies: 2
Viewing posts 1 to 2
(+3)

hello! i love decker a whole lot and have been trying to figure out how to use Lil as of late

im confused a bit on how scripting with hypertext links works? i understand the syntax for the most part but im just having a few issues

on link test1 do  
    alert["ah!"] 
end  
on link test2 do  
    alert["ee!"] 
end

this is a short test script but its basically what ive been doing. its in a text field with 2 links, just with the link spans of test1 and test2

im not sure if im inputting the name part right? this does get a response but it only prints the second alert no matter the link i click on

(+5)

So the way you've done things is you've basically got two "link" handlers that both overwrite the same default handler and don't actually check what the link span is, so it's defaulting to the second alert since that's the most recent one that got put in. That's why it's not working, you instead want to check which span is clicked.

What you want is something like this:

on link x do
 if x~"link1" alert["ah!"] end
 if x~"link2" alert["ee!"] end
end

So like, the logic is you have one link handler and then within that you check which one was clicked and do whatever accordingly.

I've put this in just the script for the field, that way you can have different ones in other fields.

(+3)

ah that clears it up! thank you so much :D !