ULX

Author Topic: MOTD Setup inquiry  (Read 7174 times)

0 Members and 1 Guest are viewing this topic.

Offline TwinbladeTM

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
MOTD Setup inquiry
« on: October 03, 2009, 06:45:59 PM »
I would like to know whether it is possible for the MOTD to be set up using CSS.  It's my understanding that GMod doesn't like .htm files, and I have a limited understanding of CSS...What I'm ultimately looking for is a Web template that I can use in the MOTD, to give it a nicer look than the stock MOTD.  Any Suggestions?

Offline [WCA]AIDS

  • Jr. Member
  • **
  • Posts: 58
  • Karma: 7
    • PlanetWCA Forums
Re: MOTD Setup inquiry
« Reply #1 on: October 03, 2009, 08:44:26 PM »
CSS is just a list that defines params for styles and classes. For the most part the html interpreter used by the motd function will understand html, some dhtml, css, and a very little bit of java. If you would like me to build you an motd I certainly will, just shoot me off a pm and we'll get things set up.


Anyways, back to your original query. Yes, it is possible for the motd to use styles defined in css.
motd.txt
Code: [Select]
<html>
<head>
<script type="text/css">
#body {
background: #FFFFFF;
}

#topbar { width: 80%; height: 50px; background: #009900; margin-left: auto; margin-right: auto; }
</script>
</head>
<body>
<div style="topbar"> Lolsup </div>
I liek tuwtals
</body>
</html>

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: MOTD Setup inquiry
« Reply #2 on: October 03, 2009, 08:52:54 PM »
The text inside of ulx_motd.txt is actually HTML.
As for CSS, or any HTML, it all depends on what the actual Source html interpreter allows, not Gmod itself.
Unless it's been improved in the past 2 years, Source html interpreter is very limited as to what it allows.
I've used CSS within the motd html before, but I put it inline using the style tag, not a separate file.
You may use a separate CSS file, but only if you host it on a publicly accessable web server and use the <link> tag to link to it.
Attempting to use locally stored images/files within the Source html won't work.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline TwinbladeTM

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: MOTD Setup inquiry
« Reply #3 on: October 03, 2009, 09:11:40 PM »
OK, so I would like to have the CSS code embedded in the .txt, how would  go about doing that?
This is what the beginning of my code looks like...it's pretty much greek to me. :/  And do I need the metatags?  It was originally part of a template I have.
Code: [Select]
html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>MOTD</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: MOTD Setup inquiry
« Reply #4 on: October 03, 2009, 10:40:36 PM »
This topic is really going past what this forum area was meant to be...support of ULX, ULib (and occasionally, other Ulysses releases) - Hence why I moved it.

The link tag, which includes the href=<local file.css> won't work in Source html interpreter UNLESS you're hosting that file on a web server. You can't (easily) link to a local css file, which I just said in previous post.
You would need to open the css file you have, and teach yourself how to include it INSIDE the original html file using the <style> tag.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline TwinbladeTM

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: MOTD Setup inquiry
« Reply #5 on: October 05, 2009, 10:53:02 AM »
Sorry about dragging it off topic...but continuing with my query, I got most of the CSS to work internally with the <style> tags.  Now my question is can you get it to bring up images?  For instance, most of the layout of the template I'm using is images, can I get it to bring those up, or do they absolutely have to be hosted elsewhere?

Offline atomicspark

  • Full Member
  • ***
  • Posts: 196
  • Karma: 12
Re: MOTD Setup inquiry
« Reply #6 on: October 05, 2009, 12:17:29 PM »
They have to be hosted elsewhere. Might I suggest you read this: http://forums.ulyssesmod.net/index.php/topic,4183.0.html

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: MOTD Setup inquiry
« Reply #7 on: October 05, 2009, 03:37:20 PM »
or do they absolutely have to be hosted elsewhere?
Yes.
Attempting to use locally stored images/files within the Source html won't work.

In THEORY, one could write a script so that it would send a few images, store it in the same folder as where the motd.txt gets saved on the client, then point to the same images location within the motd.txt
But you might as well have a fast sv_downloadurl and web host location to host them in that case, as the time involved sending images from the local pc isn't worth the time most players like to wait.
« Last Edit: October 05, 2009, 03:39:37 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline TwinbladeTM

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: MOTD Setup inquiry
« Reply #8 on: October 05, 2009, 11:06:06 PM »
OK, I hosted the images elsewhere and managed to get it to work.  Thaks for all your help, guys! :)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: MOTD Setup inquiry
« Reply #9 on: October 07, 2009, 09:55:32 AM »
If you're using SVN you can now use a url to the motd instead of using the text file. :)
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: MOTD Setup inquiry
« Reply #10 on: October 07, 2009, 03:41:32 PM »
If you're using SVN you can now use a url to the motd instead of using the text file. :)
I knew if I ignored Umotd long enough features from it would start being incorporated into ULX.
:P
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline TwinbladeTM

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: MOTD Setup inquiry
« Reply #11 on: October 08, 2009, 09:08:20 PM »
Now the question is, are there directions on how to do so?  (I haven't updated my SVN in a while...)  I'll have to update soon.  linking it would be far more convenient than hosting just the images and throwing enough of the CSS into a .txt file to show up correctly :)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: MOTD Setup inquiry
« Reply #12 on: October 09, 2009, 05:24:07 AM »
Just set ulx showMotd to a url. :)
Experiencing God's grace one day at a time.