why ren'py? WHY ?!!

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
AlfieMachica123
Regular
Posts: 56
Joined: Sun Jun 30, 2013 10:15 pm
Contact:

why ren'py? WHY ?!!

#1 Post by AlfieMachica123 » Thu Aug 29, 2013 12:01 pm

uhm i have some quick question guys,

in python this code works:

Code: Select all

a = ['a','b','c','d','e']
b = a
and whenever i print b, it works, it will print out:

Code: Select all

['a','b','c','d','e']
####### meanwhile in renpy

but when i go like this on renpy:

Code: Select all

c = 'abcde'
global b
b = []  ## the suspicious variable
def sveSpl(x)
   c = x[0]
   for d in range(1, len(x)):
      c += (' '+c[d])
   e = c.split()
   b = e ## still suspicious variable
   return e
and when i call it:

Code: Select all

hmm = sveSpl('abcde')
e "[hmm!]"
e "[b!]" ## the suspicious variable, again
it prints out:

Code: Select all

[]
instead of:

Code: Select all

['a', 'b', 'c', 'd', 'e']
if you understand what i am saying, any help will be so so so much appreciated, thank ou :)

User avatar
Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: why ren'py? WHY ?!!

#2 Post by Anima » Thu Aug 29, 2013 12:46 pm

b isn't global inside the function. Setting it to global outside has no effect on the b inside the function scope.
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
AlfieMachica123
Regular
Posts: 56
Joined: Sun Jun 30, 2013 10:15 pm
Contact:

Re: why ren'py? WHY ?!!

#3 Post by AlfieMachica123 » Thu Aug 29, 2013 12:54 pm

if i set it global inside that function, will it work with other functions?

User avatar
Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: why ren'py? WHY ?!!

#4 Post by Anima » Thu Aug 29, 2013 1:04 pm

No, the global designation just means that the b inside the function is the same as the global b. It's probably better to give it as a parameter.
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
AlfieMachica123
Regular
Posts: 56
Joined: Sun Jun 30, 2013 10:15 pm
Contact:

Re: why ren'py? WHY ?!!

#5 Post by AlfieMachica123 » Thu Aug 29, 2013 6:12 pm

ok , i understand , thanks for the tip :P thank you so much :D

User avatar
AlfieMachica123
Regular
Posts: 56
Joined: Sun Jun 30, 2013 10:15 pm
Contact:

Re: why ren'py? WHY ?!!

#6 Post by AlfieMachica123 » Thu Jan 16, 2014 4:46 am

uhmm can i ask something,

How do I make the Ace Attorney style typing sound work? The SFX only plays once using the code in the FAQ

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: why ren'py? WHY ?!!

#7 Post by Crazy Li » Thu Jan 16, 2014 5:28 am

AlfieMachica123 wrote:uhmm can i ask something,

How do I make the Ace Attorney style typing sound work? The SFX only plays once using the code in the FAQ
Have you tried making a callback that triggers the sound to play on "show_done"

http://www.renpy.org/doc/html/character_callbacks.html

If that doesn't work, you could try and make a looping sound that begins on "show" and stops on "slow_done".

User avatar
AlfieMachica123
Regular
Posts: 56
Joined: Sun Jun 30, 2013 10:15 pm
Contact:

Re: why ren'py? WHY ?!!

#8 Post by AlfieMachica123 » Thu Jan 16, 2014 9:59 am

base from the code you have given me, where do i insert the loop?

Code: Select all

def beepy_voice(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "show_done":
            renpy.sound.play("beeps.ogg")
        elif event == "slow_done":
            renpy.sound.stop()
and also, is it possible to make the sound play accordingly with every word (one word plays one beep sound)? just to make the sound not so constant, just like ace attorney., i hope you understand what i am trying to say here, :) thank you so much, opinion is much appreciated.

Crazy Li
Regular
Posts: 113
Joined: Fri Jan 03, 2014 3:35 pm
Contact:

Re: why ren'py? WHY ?!!

#9 Post by Crazy Li » Thu Jan 16, 2014 3:24 pm

AlfieMachica123 wrote:base from the code you have given me, where do i insert the loop?

Code: Select all

def beepy_voice(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "show_done":
            renpy.sound.play("beeps.ogg")
        elif event == "slow_done":
            renpy.sound.stop()
and also, is it possible to make the sound play accordingly with every word (one word plays one beep sound)? just to make the sound not so constant, just like ace attorney., i hope you understand what i am trying to say here, :) thank you so much, opinion is much appreciated.
To loop, just add in a Loop=True. So it becomes...

Code: Select all

def beepy_voice(event, interact=True, **kwargs):
        if not interact:
            return
        if event == "show_done":
            renpy.sound.play("beeps.ogg", loop=True)
        elif event == "slow_done":
            renpy.sound.stop()
Though that doesn't sync of with the word display, it just keeps repeating the sound until the text finishes displaying. If you can change your text speed to a CPS that makes one word appear at a time, it might get close.

Post Reply

Who is online

Users browsing this forum: Google [Bot]