I'd like to make a News Ticker/Lower Third in Ren'Py. (For reference: https://en.wikipedia.org/wiki/News_ticker )
The idea is to have a small bar that would go under a the text box (where the news anchor might talk) on certain screens/points of a game. The small bar would have text "headlines" that would be taken from a list and would scroll across the bottom of the screen horizontally, looping until more "headlines" were unlocked/activated by progressing through the game. I might even like to have the list of headlines that can be pulled from a website. (Like this: https://www.patreon.com/posts/news-from-your-15636026 )
If anyone could help walk me through some basics to start working on this, I'd be grateful!
Pseudo News Ticker
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.
Re: Pseudo News Ticker
ParameterizedText and a transform that move it. A screen to show that.
If you want for the list of news to cycle thru you also need a function that, when the actual list is void, fully restore it.
Need 24 hours to show a working code.
As for retrieve data from a website, avoid it. I usually play offline, and I'm quite sure I'm in good company (anyway I don't care for example about american news at all).
If you want for the list of news to cycle thru you also need a function that, when the actual list is void, fully restore it.
Need 24 hours to show a working code.
As for retrieve data from a website, avoid it. I usually play offline, and I'm quite sure I'm in good company (anyway I don't care for example about american news at all).
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
- 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: Pseudo News Ticker
This should give you some ideas:
I've had to adapt the timer according to the total length of the headlines.
Also, it's not an infinite scroll, so I've added enough blank space before and after to avoid an ugly effect (1280 is the pixels width of my test, change it accordingly).
Code: Select all
init python:
def addnews(n):
news_list.append(n)
def delnews():
if news_list:
news_list.pop(0)
transform scroll_news(l):
subpixel True
yalign 0.99
xalign 0.0
linear l xalign 1.0
repeat
screen news_ticker():
zorder 1
$ l = (len(" | ".join(news_list)) / 10) + 15
frame:
at scroll_news(l)
text "{space=1280}" + " | ".join(news_list) + "{space=1280}" layout "nobreak"
default news_list = [
"This is a headline of news; this one is very long, It must be more than a screen to test how readable it is, I hope it's enough already.",
"This is a second headline of news.",
"This is a third."]
label start:
show screen news_ticker
menu news_menu:
"Add a line":
$ addnews("This is a new headline of news.")
"Delete first (older) line of news":
$ delnews()
jump news_menu
Also, it's not an infinite scroll, so I've added enough blank space before and after to avoid an ugly effect (1280 is the pixels width of my test, change it accordingly).
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: Pseudo News Ticker
I've tried a lot of solutions, but having a rotating text image without knowing in advance the string lenght is quite hard.
Anyway...
SOLUTION A:
ParameterizedText
Good: is actually a text scrolling
Bad: Renpy suck into scrolling stuff so the effect is not extacly nifty.
SOLUTION B:
Teletext typewriter
Good: nice to see (that depend on tastes!), anyway no artifacts.
Bad: probably it does consume some resource more than a displayble
Instead of scrolling text, we cann use an old BASIC trick. This one emulate a teletext typewriter.
Mostly like those LED screens at MSG.
Please notice the lacking of any comma between strings in the news variable. This way is considered a single string.
To increase the string just use
When you need for.
Change timer 0.1 with any value you want to have different rotation speeds.
Anyway...
SOLUTION A:
ParameterizedText
Good: is actually a text scrolling
Bad: Renpy suck into scrolling stuff so the effect is not extacly nifty.
Code: Select all
image newstext=ParameterizedText(style="news_style")
label start:
$ nwtext=("ITALY: Gas created a scrolling newsbar that work perfectly!" "- JAPAN: Gas elected pilot of the new GundamVX-ff18 ""- USA: PyTom finally created a 'pressed' status for displayables! ")
show newstext "[nwtext]" at newsbar(dld=len(nwtext)/5)
"This is a news bulletin"
return
transform newsbar (dld=0):
yalign 0.0
subpixel True
linear dld xpan 360
xpan 0
repeat
style news_style:
layout "nobreak"
Teletext typewriter
Good: nice to see (that depend on tastes!), anyway no artifacts.
Bad: probably it does consume some resource more than a displayble
Instead of scrolling text, we cann use an old BASIC trick. This one emulate a teletext typewriter.
Mostly like those LED screens at MSG.
Code: Select all
default news=("The first News is uncanny... " "Well, the second one is even worst... " "But now you got a good one! ")
label start:
show screen newsbar
"This is a news bulletin"
"It use a vintage solution to have text rotate on the upper area"
"It work mostly like a teletext typewriter so in fact is a fake animation."
return
screen newsbar():
timer 0.1 action Function(textrotate) repeat True
text "[news]"
init python:
def textrotate():
el=store.news[:1]
store.news=store.news[1:len(store.news)]
store.news=store.news+el
return None
To increase the string just use
Code: Select all
$ news=news+" other words there"
Change timer 0.1 with any value you want to have different rotation speeds.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
Who is online
Users browsing this forum: Bing [Bot]