I was thinking about create a battle log screen/window on the right side of the game, recording things such as "xx attack you and you dodged", "you attack xx and xx lost 4 health points" something like that. When the information is too much, a scrollbar would appear.
I think it is quite similar to dialogue history, but it is on the same screen of the game. My first thought was using vbox, I check the instruction and found that you need to add text beforehand, not automatically with games. besides there is no mention of scrollbar. So I am wondering is there any example I can follow? Or this kind of log system is just impossible for renpy. Thanks.
[Solved] Any example for creating a battle log on the screen?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
[Solved] Any example for creating a battle log on the screen?
Last edited by wanyc on Fri Jul 12, 2019 12:04 am, edited 1 time in total.
Re: Any example for creating a battle log on the screen?
It really depends on your battle system, but for what you're trying to achieve you can use screens for it https://www.renpy.org/doc/html/screens.html such as using a blank frame for the box then you populate it later with data. As for the scroll part, you can use the viewport to make it https://www.renpy.org/doc/html/screens.html#viewport and in the renpy cookbook you should be able to find tutorials on scroll bars. As I said earlier, it will really depend on your battle system.
Re: Any example for creating a battle log on the screen?
Thanks a lot, I am gonna try this. Do you happen to know the code to populate data? I check the page of screens several times and I couldn't find it.Enchant00 wrote: ↑Wed Jul 10, 2019 5:17 am It really depends on your battle system, but for what you're trying to achieve you can use screens for it https://www.renpy.org/doc/html/screens.html such as using a blank frame for the box then you populate it later with data. As for the scroll part, you can use the viewport to make it https://www.renpy.org/doc/html/screens.html#viewport and in the renpy cookbook you should be able to find tutorials on scroll bars. As I said earlier, it will really depend on your battle system.
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Any example for creating a battle log on the screen?
You can try this (not tested):
Code: Select all
default histo = []
init python:
def log(txt):
histo.append(txt)
renpy.hide_screen("myhistory")
renpy.show_screen("myhistory")
screen myhistory():
viewport:
mousewheel True
draggable True
scrollbars "vertical"
yinitial 1.0
vbox:
null height 10
for i in histo:
text i
label start:
$ log("Troll insults you, -5HP.")
pause
$ log("You punch Troll, -2HP.")
pause
$ log("Troll punches you, -500000HP.")
pause
$ log("GAME OVER")
pause
return
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: Any example for creating a battle log on the screen?
Thanks a lot! This is exactly what I want, although "pause" freezes the screen and would not recover no matter what I click so I cannot test the scroll part. Anyway, I think I don't need pause in my game so that is just fine. Thanks againxavimat wrote: ↑Wed Jul 10, 2019 11:32 am You can try this (not tested):Code: Select all
default histo = [] init python: def log(txt): histo.append(txt) renpy.hide_screen("myhistory") renpy.show_screen("myhistory") screen myhistory(): viewport: mousewheel True draggable True scrollbars "vertical" yinitial 1.0 vbox: null height 10 for i in histo: text i label start: $ log("Troll insults you, -5HP.") pause $ log("You punch Troll, -2HP.") pause $ log("Troll punches you, -500000HP.") pause $ log("GAME OVER") pause return
Who is online
Users browsing this forum: No registered users