ULX

Author Topic: Something like motd for modlist  (Read 3944 times)

0 Members and 1 Guest are viewing this topic.

Offline lpha

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Something like motd for modlist
« on: September 26, 2007, 01:14:32 AM »
Hello all,
I just want to add something on my server which can be useful for other persons.

At the moment, it is possible to add a windows for the motd by entering !motd in chat.
A lot of people add all their mod list in this motd.

I want to create something that when you enter !addons or !mod in chat, you have a similar windows that open the content of your installed_addons.txt (new file) in \addons\ulx.

Another thing would be the possibility of having a !rules command that open rules.txt in \addons\ulx


Thanks for your help  ;D

Offline WildWill

  • Global Moderator
  • Full Member
  • ****
  • Posts: 100
  • Karma: 15
    • Beast_Building_Server
Re: Something like motd for modlist
« Reply #1 on: September 26, 2007, 04:07:50 AM »
Your looking for something like UMotd, I'm not sure if it's still working though. I think it's still broken. http://forums.ulyssesmod.net/index.php/topic,658.0.html

I haven't had the chance to test out anything as my PC is dead but anyone else have any input in this?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Something like motd for modlist
« Reply #2 on: September 26, 2007, 03:40:24 PM »
Umotd is in a coma for now.

I won't say it's dead, because it may be revived again some day.
But, for now, it's in a deep coma. Not on life support, brain activity is there, just very little. :)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Golden-Death

  • Hero Member
  • *****
  • Posts: 751
  • Karma: 0
  • Honored Lua Scripter
    • BlueFire
Re: Something like motd for modlist
« Reply #3 on: September 26, 2007, 04:30:09 PM »
Why not just make it? It's not some crazy GUI thing he's asking for, all he wants is a simple system.

I can't make it because my computers dead right now, and I don;t have gmod installed.

Could even just at the simplest have it read the folder names in /addons for the list.


Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Something like motd for modlist
« Reply #4 on: September 26, 2007, 06:13:15 PM »
Time, patience, mood.
For any projects I do, I really have to be in a programming mood.
For various reasons I don't wish to share, I just haven't been in the mood to update/remake Umotd.

As for actual technical challenge of reading the addons..No, it's not that difficult.
I'd already made unreleased Umotd code (before the Garry Gmod HTML update/our ULX release that outdated Umotd) that would read the addon name and author.
It was part of my Umotd Todo list.

Code: [Select]
  --ToDo: Get Addon list
  function Umotd_GetAddons(Ufmt,Usep) -- fmt = long = Mod Name(version) description, short = Mod Name(version). sep = what to use as seperator.
           local U_aloc = "../addons/"
           local U_AddonDirs = file.FindDir(U_aloc .. "*")
           local UAddRslt = false
           for Uaid, Udir in pairs(U_AddonDirs) do
               if file.Exists(U_aloc..Udir.."/info.txt") then
                  local UAddInfo = util.KeyValuesToTable(file.Read(U_aloc..Udir.."/info.txt"))
                  if not UAddRslt then
                     UAddRslt = UAddInfo["name"] .. "("..UAddInfo["version"]..")"
                  else
                      UAddRslt = UAddRslt..Usep..UAddInfo["name"] .. "("..UAddInfo["version"]..")"
                  end
                  if Ufmt == "long" then UAddRslt = UAddRslt .. " by [" ..UAddInfo["author_name"].."]"
                  end
               end
           end
           return UAddRslt
  end

  local UAddons_long = Umotd_GetAddons("long",Umotd_AddOnSep1)
  local UAddons_short = Umotd_GetAddons("short",Umotd_AddOnSep2)


The above code example is raw, and can't be used without modification to adjust.
It has no error checking either. Feel free to use it in your own code. Try to give me a little credit if you do.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline lpha

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: Something like motd for modlist
« Reply #5 on: September 27, 2007, 03:56:26 AM »
How does this work, where do i have to add it ?

If i understand, this code check the folders in /addons/ so the addons list is automaticaly up to date.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Something like motd for modlist
« Reply #6 on: September 27, 2007, 04:30:50 AM »
As stated, this is raw code and not meant for 'works as is'.
Sorry.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: Something like motd for modlist
« Reply #7 on: September 27, 2007, 03:05:28 PM »
The code for gathering a list of addons is also in the new "ulx debuginfo" command.
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Something like motd for modlist
« Reply #8 on: September 27, 2007, 04:40:47 PM »
Spbogie, hehe, yeah.
Meg told me this after I'd made my post.
I'd written this bit of code back in February.
Not difficult, but a nice feature just the same.

I told Meg his was probably fewer lines of code than mine.
His code is much more polished.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming