Welcome, Guest. Please login or register.
Did you miss your activation email?
August 04, 2020, 05:56:16 am

Login with username, password and session length
Search:     Advanced search
Savage: XR is a new patch for Savage, created by the Newerth.com staff. The XR1.1 Client is out now! Download it now!
190009 Posts in 11003 Topics by 18522 Members
Latest Member: WalkWithTheCrows
* Home Forum Wiki Help Search Login Register
+  Newerth Forums
|-+  Savage XR
| |-+  Mapping & Modding Forum
| | |-+  Python Notification System
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Python Notification System  (Read 4110 times)
Crashday
XR Coder
Sr. Member
***
Posts: 357


soundcloud.com/bernhardfritz


View Profile
« on: June 03, 2013, 08:42:55 pm »

Hello!
I proudly want to release my Python Notification System for Savage XR 1.0 servers! This system allows you to show automated custom notifications on your Savage XR 1.0 server. Here a preview to show you what I mean:

You can use it for any type of notification you'd like to. In this case I used it for showing tips for newbies. Other examples would be informations about new events such as NSL, NDC and so on...

The Python Notification System is easy to install on any Savage XR 1.0 server and can be customized easily. When you download my Python Notification System.zip archive the only thing you have to do is to extract it and move it into your Savage XR 1.0 server directory.

Files which are going to be installed on your server:

Savage XR 1.0 Server/game/PNS_Converter.jar
Savage XR 1.0 Server/game/notifications.cfg
Savage XR 1.0 Server/game/notifications.db
Savage XR 1.0 Server/python/savage1.zip

* The "Savage XR 1.0 Server" directory could have another name in your case but that's just fine.

The PNS_Converter.jar file is an executeable Java Application which allows you to edit your notifications. The notifications are saved in a SQLite database ("notifications.db"). To edit that database you have to use my Java Application ("PNS_Converter.jar") which converts the "notifications.db" file into a "notifications.xls" file. This file is a normal Excel file which can be edited by programs like "Microsoft Excel" or "OpenOffice Calc". Here is a preview how to use my Java Application ("PNS_Converter.jar") and how you can edit the Database in Excel:

First execute PNS_Converter.jar. Then drop the notifications.db file into my application.


As you can see, my program converted the notifications.db into a notifcations.xls file.


Now you can open and edit the notifications.xls file.
https://dl.dropboxusercontent.com/u/7592224/savage/pns4.jpg

Remember the left column is for notification strings and the right column can either be 1 (for active) or 0 (for inactive).

When you're done editing, save your work. (Be sure you save as .xls file). Now you can convert the notifications.xls back to the notifications.db file. (The Python Nofitication System can only work with .db files)


As you can see, my program converted the notifications.xls back into a notifcations.db file.


You can even create several notification categories by creating several Excel sheets. The name of the sheet will be the notification prefix. In this case "Tip". By pressing the little "+" in Microsoft Excel or OpenOffice Calc you can create a new sheet. Just be sure to again use the left column for notification strings and the right column for the active status (1 for active and 0 for inactive)


You can edit the file "notifications.cfg" to set a custom time interval in which your notifications should be shown. Per default it's set to 300 seconds which would be 5 minutes. You have to put in seconds for the time value. Here is a preview how to edit the time interval:


Have fun with my little Savage XR python extension Smiley

* Python Notification System.zip (3801.23 KB - downloaded 113 times.)
« Last Edit: June 04, 2013, 02:09:39 pm by Crashday » Logged

InDi :)
Full Member
***
Posts: 132


Leader -eXPlOit tEAm-


View Profile WWW
« Reply #1 on: June 04, 2013, 08:44:05 am »

thx u!!!
Logged

Crashday
XR Coder
Sr. Member
***
Posts: 357


soundcloud.com/bernhardfritz


View Profile
« Reply #2 on: June 04, 2013, 02:11:50 pm »

Added additional instructions on how to edit the time interval!
Logged

valli
Quack or die!
Newerth Council
Super Hero Member
*
Posts: 1083



View Profile WWW
« Reply #3 on: June 08, 2013, 09:34:21 am »

Command line interface would be great, as my servers, and most likely also groentjuh's servers are not using and UI. I guess I could create the db file locally and could upload it to the server as well and it would work, right?
Logged

He who controls the past commands the future, He who commands the future, conquers the past.
Groentjuh
Newerth Serveradmin, German Mirror and Webdeveloper
Administrator
Super Hero Member
*****
Posts: 1376


View Profile WWW
« Reply #4 on: June 08, 2013, 10:20:09 am »

Sqlite command line tool...?
Logged


Before adding any of my IMs, ask yourself: Can I ask it in a PM?
Before sending me a PM with questions, Search the forums!
Wanna be ref? Post on my Server Forum
Crashday
XR Coder
Sr. Member
***
Posts: 357


soundcloud.com/bernhardfritz


View Profile
« Reply #5 on: June 08, 2013, 05:16:26 pm »

@valli: yes my (gui) tool is intended to be used locally, not on a server. just edit the notifications.db locally with my tool and upload it on your server afterwards. If you really want a command line tool you can simply download the sqlite command line from http://www.sqlite.org/

Tables (tablename represents notification prefix. eg: "Tip") are created like this:
Code:
CREATE TABLE tablename ( id integer primary key autoincrement, string text not null, active integer default 1);

Notifications are inserted like this (test represents the notification. Don't use " inside your notifications):
Code:
INSERT INTO tablename(string,active) VALUES("test",1);

In this case the ingame notification would look like this:
tablename: test
Logged

Rigoletto
Full Member
***
Posts: 181


View Profile
« Reply #6 on: June 13, 2013, 11:14:38 am »

Nice Crashday Smiley

I have one or two tips to insert new notifications into the db more easier, in excel make a formula which ports the text into an insert command and save the column as txt file to execute on the server will import the new notifications without special converting tool.

I know it from oracle with stored procedures you can read txt-files into the db with executing one procedure. Perhaps sqllite has it too. I guess sql export / import in flat text format is possible and another way.
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.026 seconds with 19 queries.