Help with points in the menu

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
yierqi
Newbie
Posts: 11
Joined: Wed May 23, 2018 7:50 pm
Completed: ~none~
Projects: ~many~
Organization: somewhere over the rainbow
IRC Nick: 127
Soundcloud: 127
itch: yierqi
Location: somewhere over the rainbow
Contact:

Help with points in the menu

#1 Post by yierqi »

Hello, i'm trying to get points to work but i'm not sure if i'm doing this right. I'm sorry if it's very obvious, I'm fairly new to coding ;;;
I'm getting an exception for the following code in my game:

Code: Select all

    $ guy = 0
    $ dude = 0 

menu:
    "hey guy :D":
        $ guy += 10
        jump heyheyguy
    "hi dude":
    	$ dude += 10
        jump imgayeveryone

label heyheyguy:
    guy "hii"
here's the thing i get:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 131, in script
    guy "hii"
Exception: Sayer guy is not a function or string.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 131, in script
    vika "hii"
  File "/Users/", line 631, in execute
    raise Exception("Sayer %s is not a function or string." % self.who.encode("utf-8"))
Exception: Sayer guy is not a function or string.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Help with points in the menu

#2 Post by Per K Grok »

yierqi wrote: Mon Sep 24, 2018 11:42 pm Hello, i'm trying to get points to work but i'm not sure if i'm doing this right. I'm sorry if it's very obvious, I'm fairly new to coding ;;;
I'm getting an exception for the following code in my game:

Code: Select all

    $ guy = 0
    $ dude = 0 

menu:
    "hey guy :D":
        $ guy += 10
        jump heyheyguy
    "hi dude":
    	$ dude += 10
        jump imgayeveryone

label heyheyguy:
    guy "hii"
here's the thing i get:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 131, in script
    guy "hii"
Exception: Sayer guy is not a function or string.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 131, in script
    vika "hii"
  File "/Users/", line 631, in execute
    raise Exception("Sayer %s is not a function or string." % self.who.encode("utf-8"))
Exception: Sayer guy is not a function or string.
You are using 'guy' as a variable holding a integer value.

On the last line you are using 'guy' as a character.

Maybe you have a definition earlier in the code like this?

Code: Select all

define guy=Character("Guy")
Don't use the same name for different things. Rename your variable i.e. 'guy_points' so you have 'guy' for the character and 'guy_points' for the variable.

User avatar
yierqi
Newbie
Posts: 11
Joined: Wed May 23, 2018 7:50 pm
Completed: ~none~
Projects: ~many~
Organization: somewhere over the rainbow
IRC Nick: 127
Soundcloud: 127
itch: yierqi
Location: somewhere over the rainbow
Contact:

Re: Help with points in the menu

#3 Post by yierqi »

Thank you, it works now!

Post Reply

Who is online

Users browsing this forum: No registered users