gitlabEdit

Screensaver-modding-guide

What is the screensaver for the kernel?

The screensaver is the idle process that will activate if your computer went idle. You can also see the default screensaver by savescreen that is set by you or by the kernel.

The screensaver can also be customized, and we'll teach you how to make your first screensaver, to make from the simplest screensaver to legendary ones.

The screensavers are glorified mods that can be either a traditional mod or a dynamic one.

How to start your own screensaver on Visual Studio?

If you're going to make a screensaver based on traditional mod codebase, you can follow these steps:

  1. Repeat steps 1-8 from the Modding guide (traditional)

  2. On the Compile section, click on Build Events, then write this on the Post-build event command line:

    • If you're using VB:

   copy ..\..\ModFile.vb ..\..\..\..\ModFile.ss.vb
   del /Q *.*
  • If you're using C#:

   copy ..\..\ModFile.cs ..\..\..\..\ModFile.ss.cs
   del /Q *.*
  1. Repeat steps 10-13 from the Modding guide (traditional), as well as steps 1-3 from the creation steps, but replace the Imports KS.ModParser with Imports KS.Screensaver

If you're going to use a dynamic mod codebase, follow these steps:

  1. Repeat steps 1-7 from the Modding guide (dynamic), as well as steps 1-3 from the creation steps, but replace the Imports KS.ModParser with Imports KS.Screensaver

Now, follow these steps:

  1. Between the Public Class... and the End Class lines, let Visual Studio know that you're going to create your KS screensaver by writing: Implements ICustomSaver

  2. Define properties for mod information by putting below the Implements IScript:

  1. Make your init screensaver sub named InitSaver() that implements the ICustomSaver.InitSaver, by writing:

  1. Replace every Your code here comment with your code. Repeat this step on all the interface subs

  2. Make your pre-display (Called before displaying screensaver) sub named PreDisplay() and post-display (called after displaying scrensaver) sub named PostDisplay() that implement the ICustomSaver.PreDisplay and ICustomSaver.PostDisplay, by writing:

  1. Make your display code (it should display something) sub named ScrnSaver() that implements the ICustomSaver.ScrnSaver, by writing:

  1. Run the build. When the build is successful, ignore the dialog box that appears.

  2. Run your Kernel Simulator you've just referenced to in your project, and load, set default, and lock your screen and your screensaver is there.

Optional stuff

  1. You can make your subs anywhere on the class, but if:

    • they're on the different class, either press Enter on End Class and make a public new class that stores new subs (traditional mod), or make a separate code file for it (dynamic mod):

  • they're trying to re-initialize the screensaver by re-calling InitSaver(), Try so on your test environment first, then the production environment if that worked properly.

  1. The new subs or functions should meet the following conditions:

    • They shouldn't make an infinite loop unless you're making them that exits if specified conditions are met

    • They shouldn't try to cause errors with the kernel.

    • Put your sub call on one of the three subs that implements the ICustomSaver interface. Ex. If you're going to make a sub that's going to be called on screensaver display, place your sub call on the ScrnSaver() sub, and then your code on your sub.

  2. You can put your custom referenced assemblies in the beginning of your code. Refer to the Custom Referenced Assemblies section in Modding guide for more information.

  3. If you're going to add imports, these rules must be met:

    • Don't import KS by itself. KS does that automatically

    • When importing modules/classes like TextWriterColor, it's written like this: Imports KS.TextWriterColor

Examples

Here are two examples of how to make a screensaver:

In-Console Message Box, and Soon, Overnight, or Rude (Go away...) messages

The back message box screensaver tells people that the computer owner is gone, or the owner tells that they should go away because there is important things going on in their computers. This is achieved in XLock in old Linux systems by putting 3 modes, Soon, Overnight, and Rude.

  1. Right-click on the project, and go to Add > Class

  2. Name your screensaver, but leave the .vb intact. Your mod name should be the one that is included in the Post-build build event. If your mod name is changed, you must also change the post-build event for the changes to be reflected.

  3. Click Add, and the code will be ready.

  4. Write below the (Assume that your mod name is SOR) Public Class SOR: Implements ICustomSaver

  5. Write above the Public Class SOR:

  1. You should get errors saying that these subs should be created.

  2. Make your start screensaver event handler by writing:

  1. Since we're not implementing anything before displaying screensaver, we're going to leave this blank:

  1. Write above the Property Initialized...:

  1. Write on the ScrnSaver() sub:

  1. You may need to create 1 function and 2 subs for this to work. Write them below the last End Sub:

  1. The code should look like this:

  1. Run the build. When the build is successful, ignore the dialog box that appears.

  2. Run your Kernel Simulator you've just referenced to in your project, and load, set as default, and run savescreen.

Simple Blank screen

  1. Repeat the steps 1-4 on the first example: In-Console Message Box, and Soon, Overnight, or Rude (Go away...) messages

  2. Write above the Public Class Blank (assuming that your classname is Blank):

  1. Write these below the Implements ICustomSaver:

  1. Write inside the ScrnSaver sub:

  1. The code should look like this:

  1. Repeat the steps 13-14 on the first example: In-Console Message Box, and Soon, Overnight, or Rude (Go away...) messages

More examples

If you want to check out more examples, feel free to check them out in the KSModExamplesarrow-up-right respository in GitHub.

Last updated