Ren'Py Notifications

Black Ram oss

Black Ram
Game Developer
May 10, 2018
582
1,564
I wanted to add a notification saying that the points (e.g. Love) are increased with an icon next to them.
but the result of my various experiments are not very pleasant to see. Then:
How can I create a notification for n seconds at the top left with an image next to it? (can you resize the image to my liking with Renpy?)
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,566
7,382
How can I create a notification for n seconds at the top left with an image next to it? (can you resize the image to my liking with Renpy?)
If I'm correctly interpreting what you want, what I would suggest is the following:
  1. Design yourself a Ren'py screen that has the image and text in it, positioned where you want it to be.
  2. Inside the screen, include a "Timer" statement that, after N seconds, hides the screen. (See - you'd just use Hide("my_notification_screen") instead of the Jump they show in their example.)
  3. Now, when you want to show the notification, "show" the screen. This will cause it to overlay the rest of your game. The timer will take care of hiding the screen regardless of what the player does in the meantime.
  4. If you need the text or the image to vary depending on usage, you can include parameters to the screen, and specify the correct values when you "show" the screen.
 
  • Like
Reactions: Black Ram oss

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,547
4,631
Rich is correct, listen to him.

But if you are still confused, and if you want an example:

Find a Renpy game that already has the effect you want, and check it's source code. You can read it and learn about it. Some games are released with the source code all sitting straight in the "game" subfolder. But most games have the source code compressed into a RPA encrypted archive. There are easy to find tools to extract the RPA contents, so just search the internal for RPAExtractor or similar tools.

EDIT: just saw the correct extractor tool in another thread:
 
Last edited:
  • Like
Reactions: Black Ram oss

Black Ram oss

Black Ram
Game Developer
May 10, 2018
582
1,564
If I'm correctly interpreting what you want, what I would suggest is the following:
  1. Design yourself a Ren'py screen that has the image and text in it, positioned where you want it to be.
  2. Inside the screen, include a "Timer" statement that, after N seconds, hides the screen. (See - you'd just use Hide("my_notification_screen") instead of the Jump they show in their example.)
  3. Now, when you want to show the notification, "show" the screen. This will cause it to overlay the rest of your game. The timer will take care of hiding the screen regardless of what the player does in the meantime.
  4. If you need the text or the image to vary depending on usage, you can include parameters to the screen, and specify the correct values when you "show" the screen.
I've tried in this world but it doesn't show anything, I don't think I understand how they are used.

Python:
screen notification_anger_more:
     add "notifications/relations-anger.png"
     add "notifications/+.png"
     timer 3.0 action Jump ("too_slow")
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,566
7,382
I've tried in this world but it doesn't show anything, I don't think I understand how they are used.
Probably something like this:

Python:
screen notification_anger_more():
     add "relations-anger.png" anchor(0,0) pos(0,0)
     add "plus.png" anchor(0,0) pos(250,0)
     timer 3.0 action Hide("notification_anger_more")
The "anchor" and "pos" serve to position the images (relation-anger's top left corner is at the top-left corner of the screen, plus.pg's top left corner is 250 pixels to the right of that. Obviously, adjust as required to position things.

Then
Code:
    mc "OK, I've just done something that increases my anger"
    show screen notification_anger_more
The screen should be displayed, which will put the two images where you specify them. The "Timer" statement should then remove the screen after 3 seconds.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,210
What you are looking for is here.

If I remember correctly, I also published a more extended version, but honestly I don't remember where.