[solved]Show Money, AP at Imagemap(Custom 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
Lydenia
Newbie
Posts: 13
Joined: Mon Apr 08, 2013 11:32 pm
Contact:

[solved]Show Money, AP at Imagemap(Custom menu)

#1 Post by Lydenia »

Hay,

im back with the 3rd topic (*sight* feeling like a noob).

Im working at a custom menu that will appears whenever i want it.
This so far is no problem. Just done this with the imagemap.
But. Now i try to display 3 things at the background that i drawed.
AP (action points), money and day.
How to add/remove and ask how much and so on is no problem
couse i found this: http://lemmasoft.renai.us/forums/viewto ... f=8&t=4205
But i have no idear how to show it up at the menu.

(Its in german so i will translate some words for u)
Schlafen = Sleeping (Button)
Arbeiten = Work (Button)
Achievements (Button)
(The buttons are not important at this point)
AP = Actionpoints
Geld = Money
Tag = Days
(This three are what i want to see at there)

Hope you understand what i want! =)

Edit: I now found this:

Code: Select all

screen DisplayMoney:
    frame:
        xalign 1.0
        yalign 0.0
        vbox:
            text "Money: [money]"
But this will show a ugly box. And the value willl not be displayed. Only [money]
or %(money)s. At the normal dialoges the %(money)s works.
I realy got no idear.

PLEASE somebody help me X.x
end edit.

Here a screen from it:
Image
Last edited by Lydenia on Fri Apr 12, 2013 3:21 pm, edited 1 time in total.

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#2 Post by apricotorange »

The code you showed appears to work as intended for me. What version of Ren'Py are you using?

Lydenia
Newbie
Posts: 13
Joined: Mon Apr 08, 2013 11:32 pm
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#3 Post by Lydenia »

apricotorange wrote:The code you showed appears to work as intended for me. What version of Ren'Py are you using?
Im using the german Ren'Py v6.11.0

Edit:
I now got the latest Ren'Py Version. The Displaying now works but
now a code that i used befor dont want to work.

Code: Select all

    $ player_name = renpy.input("Enter name: ").strip()
    $ P = Character(player_name, color="#1d61cc")
This enable to pick a name by the player himself.
The 2nd line is for transforming it to a Character that i can
use infront of messages like:

Code: Select all

P "The name you can see above this text i picked myself!"
Traceback.txt

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 237, in script
  File "game/script.rpy", line 237, in python
  File "game/screens.rpy", line 116, in python
Exception: Screen u'quick_menu' is not known.

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

Full traceback:
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\execution.py", line 288, in run
    node.execute()
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\ast.py", line 718, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\python.py", line 1297, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 237, in <module>
    $ player_name = renpy.input("Enter name: ").strip()
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\exports.py", line 464, in input
    rv = renpy.ui.interact(mouse='prompt', type="input", roll_forward=roll_forward)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\ui.py", line 237, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\core.py", line 1864, in interact
    scene_lists.replace_transient()
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\core.py", line 558, in replace_transient
    self.remove(layer, tag)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\core.py", line 832, in remove
    self.hide_or_replace(layer, remove_index, "hide")
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\core.py", line 756, in hide_or_replace
    d = oldsle.displayable._hide(now - st, now - at, prefix)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\screen.py", line 189, in _hide
    hid.update()
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\screen.py", line 266, in update
    self.screen.function(**self.scope)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\screenlang.py", line 1217, in __call__
    renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\python.py", line 1297, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/screens.rpy", line 116, in <module>
    use quick_menu
  File "C:\Dokumente und Einstellungen\Holger\Desktop\renpy-6.15.4-sdk\renpy\display\screen.py", line 579, in use_screen
    raise Exception("Screen %r is not known." % name)
Exception: Screen u'quick_menu' is not known.

Windows-XP-5.1.2600-SP2
Ren'Py 6.15.4.320
Sim Date Lydenia 0.0

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#4 Post by apricotorange »

The error means that your "screen input" has a line like "use quick_menu", but your game doesn't include the definition of quick_menu. I'm not entirely sure how you managed that, but maybe try replacing your screens.rpy with the default screens.rpy from a new Ren'Py 6.15 project?

Lydenia
Newbie
Posts: 13
Joined: Mon Apr 08, 2013 11:32 pm
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#5 Post by Lydenia »

apricotorange wrote:The error means that your "screen input" has a line like "use quick_menu", but your game doesn't include the definition of quick_menu. I'm not entirely sure how you managed that, but maybe try replacing your screens.rpy with the default screens.rpy from a new Ren'Py 6.15 project?
Im starting to get pissed off.
I replaced the "screens.rpy" files with some new. This so far now work.
But now i saw that the "displaying money" dont want to work at the imagemap.

I have 3 Codes for the stats (money, day, ap):

Code: Select all

#(script.rpy)At the label start to define them this:
    $ actionpoints = 100
    $ day = 1
    $ money = 150

#(screens.rpy)To define the screens:
screen DisplayActionpoints:
    vbox:
        xpos 614
        ypos 153
        text "[actionpoints]"
            
screen DisplayMoney:
    vbox:
        xpos 633
        ypos 187
        text "[money]"
            
screen DisplayDay:
    vbox:
        xpos 627
        ypos 218
        text "[day]"

#(custom_menu.rpy)At the menu to call the screens:
    show screen DisplayActionpoints
    show screen DisplayMoney
    show screen DisplayDay
#I tryed the command "call screen" too.
Edit:
Well, im just tryed to call the "Display..." first and it looks like im just
doing something wrong with the screens command. Only the first screen
that i call will appear.
Maybe i need sonething to do like a new screen with the screens in it?

Code: Select all

screen collection:
    add screen custom_menu
    add screen DisplayActionpoints
    add screen DisplayMoney
    add screen DisplayDay
With this i would only have to call 1 screen but... omg the screen collection
would call the 4 others... so i would have the same problem. Or im just to stupid?

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#6 Post by apricotorange »

The syntax to include one screen in another is "use"; see http://www.renpy.org/doc/html/screens.html#use . That should do what you want, I think.

Lydenia
Newbie
Posts: 13
Joined: Mon Apr 08, 2013 11:32 pm
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#7 Post by Lydenia »

Jea. I try to understand that site a few times ago. My english is to bad for that.
Thats the reason why i had the german ren'py version befor.

Would be cool if someone can help me out with it.
The only thing im total not understand is the hole "screens" thing.
All other site's i helped my self with the translate page from google.

RangerDanger
Regular
Posts: 45
Joined: Wed Jun 27, 2012 11:36 pm
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#8 Post by RangerDanger »

Could you post your entire screens.rpy file?

Given that, we could probably be able to give you more accurate suggestions.

Lydenia
Newbie
Posts: 13
Joined: Mon Apr 08, 2013 11:32 pm
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#9 Post by Lydenia »

I packed all the files with code's for the imagemap and the
stats with winrar and uploaded them to the attchements.
(script.rpy|script.rpyc|script.rpy~|screens.rpy|screens.rpyc|
screens.rpy~|screens.rpy.bak|custom_menu.rpy|custom_menu.rpyc|
custom_menu.rpy~)

The game is far away from getting completet. So, pls dont say
"label XXX missing". I know that.
Hope this helps to solve the problem. :)

#attachements deleted#
Last edited by Lydenia on Fri Apr 12, 2013 3:22 pm, edited 1 time in total.

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#10 Post by apricotorange »

Try something like this:

Code: Select all

screen menu_oversite:
    imagemap:
        ground "custom_menu.jpg"
        hover "custom_menu_hover.jpg"
        
        hotspot (576, 37, 187, 30) clicked Return("schlafen")
        hotspot (576, 68, 187, 30) clicked Return("arbeiten")
        hotspot (576, 99, 187, 30) clicked Return("achievements")
        hotspot (41, 43, 101, 101) clicked Return("yukio")
        hotspot (163, 43, 101, 101) clicked Return("togama")
        hotspot (285, 43, 101, 101) clicked Return("lydenia")
        hotspot (407, 43, 101, 101) clicked Return("hina")
    vbox:
        xpos 614
        ypos 153
        text "[actionpoints]"
    vbox:
        xpos 633
        ypos 187
        text "[money]"
    vbox:
        xpos 627
        ypos 218
        text "[day]"

Lydenia
Newbie
Posts: 13
Joined: Mon Apr 08, 2013 11:32 pm
Contact:

Re: Show Money, AP at Imagemap(Custom menu)

#11 Post by Lydenia »

apricotorange wrote:Try something like this:

Code: Select all

screen menu_oversite:
    imagemap:
        ground "custom_menu.jpg"
        hover "custom_menu_hover.jpg"
        
        hotspot (576, 37, 187, 30) clicked Return("schlafen")
        hotspot (576, 68, 187, 30) clicked Return("arbeiten")
        hotspot (576, 99, 187, 30) clicked Return("achievements")
        hotspot (41, 43, 101, 101) clicked Return("yukio")
        hotspot (163, 43, 101, 101) clicked Return("togama")
        hotspot (285, 43, 101, 101) clicked Return("lydenia")
        hotspot (407, 43, 101, 101) clicked Return("hina")
    vbox:
        xpos 614
        ypos 153
        text "[actionpoints]"
    vbox:
        xpos 633
        ypos 187
        text "[money]"
    vbox:
        xpos 627
        ypos 218
        text "[day]"
So freaking simple. X.x Thank you so much!
I can't beleive that i stucked at a problem with such a simple... damn.
Thank you so much! :D

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Draida