clickable text in miniconsoles

Post Reply
riahxoxo
Posts: 2
Joined: Wed Apr 20, 2016 8:56 pm

clickable text in miniconsoles

Post by riahxoxo »

What I'm trying to do is create clickable text in a "who here" miniconsole that, when a player's name is clicked, sends the "honours <player name>" command to the mainwindow, essentially displaying his/her honours.
Code: [show] | [select all] lua
playerWindow = Geyser.MiniConsole:new({
	name="playerWindow",
	x=3,y=3,
	width="-3px",height="24.5%",
}, leftBar)
playerWindow:setColor("black")
playerWindow:setFontSize(10)
playerWindow:setWrap(30)
playerWindow:setUnderline(true)

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: clickable text in miniconsoles

Post by SlySven »

Try something like this for each playerName, you will probably want to tweak the colours white on a magenta background:

Code: Select all

  local command=string.format("honours %s", playerName)
  setBgColor("playerWindow", 128, 0, 128)
  setFgColor("playerWindow", 255, 255, 255)
  echo("playerWindow","\n")
  echoLink("playerWindow", playerName, command, "Get player's honours", true)
  cecho("playerWindow","<reset>")

riahxoxo
Posts: 2
Joined: Wed Apr 20, 2016 8:56 pm

Re: clickable text in miniconsoles

Post by riahxoxo »

Where would I paste that? What will I have to tweak besides the colors? Sorry, I'm kind of high-maintenance.

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: clickable text in miniconsoles

Post by SlySven »

You'd paste it in the loop of code that writes out the list of players you have found/captured/stored - I've no idea how you got them (some sort of trigger that responds to the MUD server's response, typically to who or perhaps by logging all the people who Xxxx tells you, Xxxx says, Xxxx chats, Xxx yells,... etc.) the precise mechanisms are something you will have to work out - or crib from others' code. This sample will just provide the clickable link to send the command you requested for each name...

Post Reply