ID:2083515
 
(See the best response by Lummox JR.)
I'm trying to make chat tabs, as per Lummox JR's tutorial, and I have the chat tabs ready, but the styling on the default terminal apparently is only for the default terminal and doesn't carry on to the other terminals. All I did was enclose the output in output(msg, "chat pane tab"), but the references to the client/script styles don't work. Can anyone help with that?
EDIT: Also, does anyone know if there is a reference to the current tab opened, because current-tab just gives a string and I need the tab pane reference to do stuff on it, otherwise I'd have to switch between the strings and it doesn't seem as elegant.

The value of current-tab in the tab control is just the pane's ID, so that should be all you need right there. I don't know what you mean by "reference" since there's really no such concept in the skin; not in DS, at least. Everything is done by ID.

To style other output controls you can always set their style parameter.
The thing is, I have to do
var/current_tab = winget(usr, "tab", "current-tab")
and then do
winget(usr, "[current_tab]", "font-size")
so I need a var, otherwise there is no way to call that control directly from winget.

As for the style parameter, I assigned it the same style as the client/script in a verb. When I call that verb it just massively breaks stuff and gives the tab some random background color and does nothing else, even though that style sheet works for client/script.
In response to Nirnael
Nirnael wrote:
The thing is, I have to do
var/current_tab = winget(usr, "tab", "current-tab")
and then do
winget(usr, "[current_tab]", "font-size")
so I need a var, otherwise there is no way to call that control directly from winget.

That's true, that requires two separate winget calls at present. Of course a more fundamental question is: Why do you need to query the font-size? Shouldn't that typically be already set?

You also do have the option of setting an on-tab command for your tab control. If you set it to something like tab-changed "myid" "[[*]]" then it will send that info to the server for you.

mob/verb/Tab_Changed(id as text, pane as text)
set instant = 1
...


As for the style parameter, I assigned it the same style as the client/script in a verb. When I call that verb it just massively breaks stuff and gives the tab some random background color and does nothing else, even though that style sheet works for client/script.

An example would of what's going on would be helpful.
In response to Lummox JR
Lummox JR wrote:
Nirnael wrote:
The thing is, I have to do
var/current_tab = winget(usr, "tab", "current-tab")
and then do
winget(usr, "[current_tab]", "font-size")
so I need a var, otherwise there is no way to call that control directly from winget.

That's true, that requires two separate winget calls at present. Of course a more fundamental question is: Why do you need to query the font-size? Shouldn't that typically be already set?

You also do have the option of setting an on-tab command for your tab control. If you set it to something like tab-changed "myid" "[[*]]" then it will send that info to the server for you.

mob/verb/Tab_Changed(id as text, pane as text)
> set instant = 1
> ...


The font-size was only an example, I'm not actually querying it.
And yes, I was considering calling a proc from the on-tab command that would do all the processing required. Guess I'll do that.

The style sheet is this one:
var/const/stylesheet = {"<style>
body {font-family: Verdana, sans-serif;}

h1, h2, h3, h4, h5, h6 {color: #0000ff; font-family: Georgia, Verdana, sans-serif;}

em {font-style: normal; font-weight: bold;}

/*
.motd {color: #638500; font-family: Verdana, sans-serif;}
.motd h1, .motd h2, .motd h3, .motd h4, .motd h5, .motd h6
{color: #638500; text-decoration: underline;}
.motd a, .motd a:link, .motd a:visited, .motd a:active, .motd a:hover
{color: #638500;}
*/

.italics { font-style: italic;}

.prefix { font-weight: bold;}

.ooc { font-weight: bold;}
.adminobserverooc {color: #0099cc; font-weight: bold;}
.adminooc {color: #700038; font-weight: bold;}

.adminobserver {color: #996600; font-weight: bold;}
.admin {color: #386aff; font-weight: bold;}

.name { font-weight: bold;}

.say {}
.deadsay {color: #5c00e6;}
.radio {color: #008000;}
.sciradio {color: #993399;}
.comradio {color: #aca82d;}
.secradio {color: #b22222;}
.medradio {color: #337296;}
.engradio {color: #fb5613;}
.suppradio {color: #a8732b;}
.servradio {color: #6eaa2c;}
.syndradio {color: #6d3f40;}
.centcomradio {color: #686868;}
.aiprivradio {color: #ff00ff;}

.yell { font-weight: bold;}

.alert {color: #ff0000;}
h1.alert, h2.alert {color: #000000;}

.emote { font-style: italic;}
.selecteddna {color: #ffffff; background-color: #001B1B}

.attack {color: #ff0000;}
.disarm {color: #990000;}
.passive {color: #660000;}

.userdanger {color: #ff0000; font-weight: bold; font-size: 3;}
.danger {color: #ff0000;}
.warning {color: #ff0000; font-style: italic;}
.announce {color: #228b22; font-weight: bold;}
.boldannounce {color: #ff0000; font-weight: bold;}
.rose {color: #ff5050;}
.info {color: #0000CC;}
.notice {color: #000099;}
.boldnotice {color: #000099; font-weight: bold;}
.adminnotice {color: #0000ff;}
.unconscious {color: #0000ff; font-weight: bold;}
.suicide {color: #ff5050; font-style: italic;}
.green {color: #03ff39;}
.shadowling {color: #3b2769;}

.cyberman {color: #066600; font-family: "Courier New", cursive, sans-serif; font-weight: bold; font-size: 2;}
.cybermancollective {color: #066600; font-family: "Courier New", cursive, sans-serif; font-weight: bold; font-size: 4;}

.newscaster {color: #800000;}
.ghostalert {color: #5c00e6; font-style: italic; font-weight: bold;}

.alien {color: #543354;}
.noticealien {color: #00c000;}
.alertalien {color: #00c000; font-weight: bold;}
.borer {color: #804000;}

.interface {color: #330033;}

.sans {font-family: "Comic Sans MS", cursive, sans-serif;}
.robot {font-family: "Courier New", cursive, sans-serif;}

.big {font-size: 3;}
.reallybig {font-size: 4;}
.greentext {color: #00FF00; font-size: 3;}
.redtext {color: #FF0000; font-size: 3;}

BIG IMG.icon {width: 32px; height: 32px;}

.memo {color: #638500; text-align: center;}
.memoedit {text-align: center; font-size: 2;}

.ticket-status {
color: #000099;
font-weight: bold;
}

.ticket-text-sent {
color: #000099;
font-weight: bold;
}

.ticket-text-received {
color: #ff0000;
font-weight: bold;
}

.ticket-text-monitored {
color: #ff00ff;
font-weight: bold;
}

.ticket-header-recieved {
color: #ff0000;
font-weight: bold;
font-size: 15px;
}

.ticket-admin-reply {
color: #ff0000;
font-weight: bold;
font-style: italic;
}

</style>"}


It then is assigned to
client/script = stylesheet


And then for the other (non-default) tab:
client/verb/generate()
winset(usr, "oocoutput", "style=[stylesheet]")
usr<<winget(usr, "oocoutput", "style")

When I click generate, the oocoutput control gets a random purplish color that changes to purple-red-magenta etc. every time I click it, but doesn't change the text style for that output. The winget outputs a blank string to default terminal (meaning there is no style set). If I query the style of the default terminal, it returns the stylesheet above, which should happen with the other one, but it doesn't. My guess is the style must be set at client login or something, or it's bugged.
EDIT: As for the output, it's the same string, the only difference is one output is for the default terminal and the other is for the oocoutput terminal.
EDIT2: Just tested if I can assign the stylesheet to client/script at runtime, I can't, throws a runtime error, so I'm leaning towards controls not being able to be assigned styles at runtime because it breaks them (doesn't throw runtime though).
By the way, what are "myid" "[[*]]"? Is that in the reference because I can't find it. Are there any more parameters/references/things of that group?
"myid" is the ID of the tab control (as an example), which would be sent as an argument to the Tab_Changed verb I posted. If the tab control has an on-tab command, it would send that. The [[*]] gets replaced with the new value of current-tab.
In response to Lummox JR
Lummox JR wrote:
"myid" is the ID of the tab control (as an example), which would be sent as an argument to the Tab_Changed verb I posted. If the tab control has an on-tab command, it would send that. The [[*]] gets replaced with the new value of current-tab.

Ah, I see. Did you figure out why the script isn't working?
That's something I'll have to look at another time. Maybe some other users on the forum will have some insights that can help.
Okay, I did this.
var/styles = "<style>.combat{color:red}</style>"
winset(usr, "icoutput", "style=[styles]")

Which returned
.combat{color


So whatever is parsing the CSS template for the control style is bugged and doesn't like spaces/punctuation. That's what I think.
Best response
You can't send strings directly that way if they have special characters. You'll need to use url_encode() on them. Or, you can use list2params() to build the parameters.

Also, the style parameter on a control doesn't use the HTML <style> tag.
Holy shit, I removed the style tag and encoded it and it works. Thank you very much Lummox.