Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 58, in script
menu:
File "game/script.rpy", line 13, in show_money_overlay
if first_time_showing_this:
NameError: global name 'goldcoins' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 58, in script
menu:
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\ast.py", line 652, in execute
renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\exports.py", line 1180, in say
who(what, *args, **kwargs)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\character.py", line 1016, in __call__
self.do_display(who, what, cb_args=self.cb_args, **display_args)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\character.py", line 817, in do_display
**display_args)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\character.py", line 566, in display_say
rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\ui.py", line 287, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\display\core.py", line 2635, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\display\core.py", line 2890, in interact_core
self.compute_overlay()
File "C:\Users\monkey\Downloads\renpy-6.99.14.1-sdk\renpy\display\core.py", line 2307, in compute_overlay
i()
File "game/script.rpy", line 13, in show_money_overlay
if first_time_showing_this:
NameError: global name 'goldcoins' is not defined
Windows-8-6.2.9200
Ren'Py 6.99.14.3.3347
test 1.0
Tue May 22 20:34:45 2018
Code: Select all
# The script of the game goes in this file.
# Declare characters used by this game. The color argument colorizes the
# name of the character.
init python:
first_time_showing_this = False
show_gold_coins = False
def show_money_overlay():
global first_time_showing_this, show_gold_coins;
if show_gold_coins:
cash_widget = Text( str(goldcoins) );
if first_time_showing_this:
cash_widget = Alpha(0,1.0,1.0)( cash_widget ); # makes a fade_in effect
first_time_showing_this = False; # remember to don't show the fade in effect again
ui.at( Position(xalign=.9, yalign=.9) ); # positions it on the screen
ui.add(cash_widget); # add the widget to the screen
# a convenient way of showing this =D
def show_money():
global first_time_showing_this, show_gold_coins;
first_time_showing_this = True;
show_gold_coins = True;
config.overlay_functions.append(show_money_overlay);
label start:
jump morning
label morning:
$ goldcoins = 100
$ _game_menu_screen = None
$ show_button_game_menu = False
window show dissolve
$ show_button_game_menu = True
scene color_black
$ show_money(); # ← this line over here
jump afternoon
label afternoon:
scene color_black ## Make screen black
$ goldcoins = 100 ## Shit so goldcoins
$ _game_menu_screen = None ## bye right click
$ show_button_game_menu = False ## Hide In-Game Menu
## Change BG image to store_afternoon
window show #Show dialogue box
$ show_button_game_menu = True ## Show In-Game Menu
"Hello Uncle Pacundo!... Today, I make much much money! See!?"
$ show_money(); ## Show me the money!
show gui_goldcoins #Show fancy window around goldcoins Text
"Oho!... This much!?... You are very good girl today!"
"buy something bitch"
label shop:
"buy.."
menu:
"Dog. Just a whole ass dog." if goldcoins>= 200:
$ goldcoins -=200
if goldcoins<=200:
jump bitchnomoney
jump boughtdog
"two forty dog." if goldcoins>=3000:
$ goldcoins -=3000
if goldcoins<=3000:
jump nonomoney
label boughtdog:
"you bought a whole ass dog."
label nonomoney:
"Cant afford it..."
jump shop
return ## Go back to main menu?... I dunno