[solved] Extend Ren'Py syntax itself / the Timeball

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

[solved] Extend Ren'Py syntax itself / the Timeball

#1 Post by Ayutac » Wed Nov 06, 2013 3:01 am

You know how it feels when you write a long post and it disappears? I certanly do!

Okay, so i'll try this again, shorter this time. I have a global function do(s, duration=None, flow=True) where s is a string. To use this in the Ren'Py environment, I must write e.g.

Code: Select all

$ do("Leo kiss Lauren")
But I want to be able to write it like this

Code: Select all

Do "Leo kiss Lauren"
With other words, I want to change the parsing/interpreting of Ren'Py. I assume there are just three ways:
1. Someone of you knows how to do this with just changing 1 or 2 files.
2. I have to convince PyTom to integrate this functionality in Ren'Py.
3. It's already there and I just don't know it.

So before I try the much harder way 2, I wanted to try 1 and 3. Any ideas?

Background (only needs reading for way 3): My partner in crime and I are about to make a complex time system in Ren'Py called the Timeball. The name came from Who. The timeball contains several timelines keeping track of people and locations. A timeline consists of multiple determined events and with them its possible to recreate the game from scratch to any point reached. Therefore a determined event is like (timepoint, duration, s, priority), where s is a string explaining what exactly happened. To recreate events, the function do (introduced above) is used with flow=False, because if several events are happening at the same time, it would be illogical to put forward time for each of them. However for the normal story the flow will be normal, so its default is True. duration=None just says the duration will be a default only dependent on s.
With the timeball it is possible to create multiplayer games (even for Dating Sims) and time travel to the past and back to the newest reached time in game. This will all just be fine.

So what I need the new Syntax for is user-friendlyness. No programmer would have problems working with a simple $ do, but Ren'Py is not primarly designed for programmers, if I recall correctly. While the Dating Sim Engine (see my sig) will come as an extension to Ren'Py just like the more simply DSE there already is, I thought the timeball may be interesting enough to be used seperately and for inexperienced users (since it's all closed up, nobody has to mess with the code), it just needs a proper do function to work and maybe a nice Ren'Py-Do.

PS: If I'm mistaken and Do or do is already a key word, please don't hang the idea for this. The "do" can be easily exchanged later.
Last edited by Ayutac on Wed Nov 06, 2013 11:18 am, edited 1 time in total.
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Extend Ren'Py syntax itself / the Timeball

#2 Post by PyTom » Wed Nov 06, 2013 11:06 am

Have you seen the newly-documented creator-defined statement stuff?

http://www.renpy.org/dev-doc/html/cds.html

That being said, your statement is pretty easy. Internally, Ren'Py turns the call:

Code: Select all

e "Hello, World"
into something like:

Code: Select all

$ e("Hello, world", interact=True)
so if all you want is your example, you could have the function do, make it ignore keyword arguments, and you'd have your syntax.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Ayutac
Regular
Posts: 150
Joined: Thu Oct 18, 2012 2:23 pm
Projects: Pokémon Dating Sim
Organization: A Breeze Of Science
Deviantart: Ubro
Location: Mayence, Germany
Contact:

Re: Extend Ren'Py syntax itself / the Timeball

#3 Post by Ayutac » Wed Nov 06, 2013 11:18 am

That is truly wonderful!
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)

Post Reply

Who is online

Users browsing this forum: Google [Bot], _ticlock_