Disable Click Advancement
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.
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.
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Disable Click Advancement
Say I wanted to have screens that acted like point and click games. I don't want the click to advance the story, but would like image maps that are clickable on the screen. How can I make it so a click anywhere doesn't advance to the next image, but only if they click on what I want them to click on?
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Disable Click Advancement
put the image maps on a screen, in the screen make sure modal is true.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
Can you explain to me (x0, y0, x1, y1). Is this to plot a square?
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
Wait, that's corners.. I'm going to need a little help with this. I see how to design a imagemap, but not how to place it where I want. There's bugs here too.
Basically I have a full screen image which is 800x600 and a button which is 80x80... I wasn't sure how to set the image where I want. I figured you would place the button where you want, and then set the hotspot based on its location...
Errors
[/code]
Basically I have a full screen image which is 800x600 and a button which is 80x80... I wasn't sure how to set the image where I want. I figured you would place the button where you want, and then set the hotspot based on its location...
Code: Select all
screen screen_test():
frame:
xfill True
yfill True
has vbox:
$backgroundImage = renpy.imagemap("images/full_screen.jpg", "images/full_screen.jpg",[(0,0, 600, 600, "nothing")]);
$buttonImage = renpy.imagemap("images/button.jpg", "images/button.jpg", [80,80,80,80, "something"]);
# The game starts here.
label start:
call screen screen_test()
"hello"
return
Code: Select all
[code]
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 65, in script
call screen screen_test(control)
File "renpy/common/000statements.rpy", line 463, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "game/script.rpy", line 47, in execute
screen screen_test(control):
File "game/script.rpy", line 47, in execute
screen screen_test(control):
File "game/script.rpy", line 49, in execute
frame:
File "game/script.rpy", line 52, in execute
has vbox:
File "game/script.rpy", line 53, in execute
$backgroundImage = renpy.imagemap("images/full_screen.jpg", "images/full_screen.jpg",[(0,0, 600, 600, "nothing")]);
File "game/script.rpy", line 53, in <module>
$backgroundImage = renpy.imagemap("images/full_screen.jpg", "images/full_screen.jpg",[(0,0, 600, 600, "nothing")]);
Exception: ui.interact called with non-empty widget/layer stack. Did you forget a ui.close() somewhere?
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 65, in script
call screen screen_test(control)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\ast.py", line 1697, in execute
self.call("execute")
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\ast.py", line 1715, in call
return renpy.statements.call(method, parsed, *args, **kwargs)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\statements.py", line 144, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 463, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\exports.py", line 2475, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\ui.py", line 277, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 2437, in interact
scene_lists.replace_transient()
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 727, in replace_transient
self.remove(layer, tag)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 1014, in remove
self.hide_or_replace(layer, remove_index, "hide")
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\display\core.py", line 938, in hide_or_replace
d = oldsle.displayable._hide(now - st, now - at, prefix)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\display\screen.py", line 430, in _hide
self.update()
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\display\screen.py", line 565, in update
self.screen.function(**self.scope)
File "game/script.rpy", line 47, in execute
screen screen_test(control):
File "game/script.rpy", line 47, in execute
screen screen_test(control):
File "game/script.rpy", line 49, in execute
frame:
File "game/script.rpy", line 52, in execute
has vbox:
File "game/script.rpy", line 53, in execute
$backgroundImage = renpy.imagemap("images/full_screen.jpg", "images/full_screen.jpg",[(0,0, 600, 600, "nothing")]);
File "game/script.rpy", line 53, in <module>
$backgroundImage = renpy.imagemap("images/full_screen.jpg", "images/full_screen.jpg",[(0,0, 600, 600, "nothing")]);
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\exports.py", line 1177, in imagemap
roll_forward=roll_forward)
File "C:\Users\client\Desktop\renpy-6.99.10-sdk\renpy\ui.py", line 271, in interact
raise Exception("ui.interact called with non-empty widget/layer stack. Did you forget a ui.close() somewhere?")
Exception: ui.interact called with non-empty widget/layer stack. Did you forget a ui.close() somewhere?
Windows-8-6.2.9200
Ren'Py 6.99.10.1227
testclass 0.0
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
Actually I've updated a little..
I'm confused at action. I'd like the button to hide the current screen, and maybe return a value.
I'm confused at action. I'd like the button to hide the current screen, and maybe return a value.
Code: Select all
screen screen_test():
frame:
xfill True
yfill True
imagemap:
xpos 0
ypos 0
ground "images/full_screen.png"
imagemap:
xpos 370
ypos 270
ground "images/button.png"
hotspot (370, 270, 450, 350) action
# The game starts here.
label start:
call screen screen_test()
return
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
I've tried something like the code below, but it's sloppy, and it says my function takes no arguement but one was given.
Code: Select all
class Control():
def cliked_button():
Hide(screen_test)
screen screen_test(control):
modal True
frame:
xfill True
yfill True
add "images/full_screen.png" xpos -6 ypos -6
imagemap:
xpos 360
ypos 260
ground "images/button.png"
hotspot (360, 260, 440, 340) action control.cliked_button()
# The game starts here.
label start:
python:
control = Control()
call screen screen_test(control)
return
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
Hey, I'm getting closer. Was a Python error. Didn't know the function would pass the object. Anyway, I've updated. The game runs without errors, but the screen isn't hiding when I click the square button. Button is an 80x80 green box. I tried to center it in the window of 800x600. Is the hotspot wrong?
Code: Select all
class Control():
def clicked_button(self, screenName):
Hide(screenName)
screen screen_test(control):
modal True
frame:
xfill True
yfill True
add "images/full_screen.png" xpos -6 ypos -6
imagemap:
xpos 360
ypos 260
ground "images/button.png"
hotspot (360, 260, 440, 340) action control.clicked_button("screen_test")
# The game starts here.
label start:
python:
control = Control()
call screen screen_test(control)
return
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Disable Click Advancement
Um...you don't need to make your own class, just use the Hide Screen Action
https://www.renpy.org/doc/html/screen_actions.html#Hide
https://www.renpy.org/doc/html/screen_actions.html#Hide
Code: Select all
hotspot (360, 260, 440, 340) action Hide("screen_test")
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
This does nothing when I click the green box though
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
Edited code still didn't work. I had to change two values in hotspot code. I didn't know the last two arguments were image height and width.
Code: Select all
screen screen_test(control):
modal True
frame:
xfill True
yfill True
add "images/full_screen.png" xpos -6 ypos -6
imagemap:
xpos 360
ypos 260
ground "images/button.png"
hotspot (360, 260, 80, 80) action Hide("screen_test")
# The game starts here.
label start:
call screen screen_test()
return
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
I've attached the folder of the game in a rar. It would be great if you, or another user, could take a look.
- Attachments
-
- testclass.rar
- I've attached a rar with the renpy game folder in it. Maybe you could take a look?
- (439.39 KiB) Downloaded 29 times
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
Re: Disable Click Advancement
You've called the screen, so it must "return" anything to advance the playthrough. If you'll just hide the screen you'll be unable to progress.
So either "show" your screen, or use the "Return" action for the hotspot.
https://www.renpy.org/doc/html/screens. ... -statement
https://www.renpy.org/doc/html/screens. ... statements
https://www.renpy.org/doc/html/screen_a ... ol-actions
So either "show" your screen, or use the "Return" action for the hotspot.
https://www.renpy.org/doc/html/screens. ... -statement
https://www.renpy.org/doc/html/screens. ... statements
https://www.renpy.org/doc/html/screen_a ... ol-actions
- JeremyBenson
- Regular
- Posts: 65
- Joined: Tue Apr 30, 2013 10:46 am
- Projects: Fallen
- Organization: Terra Byte Studios
- Location: Quebec City
- Contact:
Re: Disable Click Advancement
Thanks, but the problem isn't with Hide or Return, although I appreciate the knowledge. I wasn't aware of that The real issue is that the hotspot isn't working altogether. I can't hide, or return. The click isn't registering on the tile.Alex wrote:You've called the screen, so it must "return" anything to advance the playthrough. If you'll just hide the screen you'll be unable to progress.
So either "show" your screen, or use the "Return" action for the hotspot.
https://www.renpy.org/doc/html/screens. ... -statement
https://www.renpy.org/doc/html/screens. ... statements
https://www.renpy.org/doc/html/screen_a ... ol-actions
Fallen - Current project: Developing logic for RPG mechanics.
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
"Abel Hayes is feeling a little inhuman."
Fledgling Startup: Terra Byte Studios.
https://www.tumblr.com/blog/terrabytestudio
Re: Disable Click Advancement
Are you shure that you need your hotspot at (720, 520) with width/height 80/80 pxls?
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Disable Click Advancement
Looking over your screen code...it is all messed up.
1, you don't want an imagemap, you want a screen with imagebuttons --because your button is a separate image from your background. See the imagebutton tutorial here:
viewtopic.php?f=51&t=22565
Imagemaps have everything already in one image...the background/imagebutton option allows you to place an button wherever you want on the screen.
2, you don't need both modal True and call. One or the other will due.
3, have you read the documentation on screens and screen language? Also have looked at the way screens are defined in the screens.rpy file of your tester? You should if you haven't:
https://www.renpy.org/doc/html/screens.html
Anyway, here is a bit of redone code that shows the difference between imagemaps and imagebuttons, and between calling and showing. I'm also attaching the files so you can run it yourself:
1, you don't want an imagemap, you want a screen with imagebuttons --because your button is a separate image from your background. See the imagebutton tutorial here:
viewtopic.php?f=51&t=22565
Imagemaps have everything already in one image...the background/imagebutton option allows you to place an button wherever you want on the screen.
2, you don't need both modal True and call. One or the other will due.
3, have you read the documentation on screens and screen language? Also have looked at the way screens are defined in the screens.rpy file of your tester? You should if you haven't:
https://www.renpy.org/doc/html/screens.html
Anyway, here is a bit of redone code that shows the difference between imagemaps and imagebuttons, and between calling and showing. I'm also attaching the files so you can run it yourself:
Code: Select all
init python:
class GCharacter(object):
def __init__(self, ac = 0):
self.items = []
self.ac = ac
def add_item(self, item):
# test if item is in items list. Do not re-add if present, just increase count.
self.items.append(item)
class Item(object):
def __init__(self):
self.name = ""
self.type = ""
self.thumbPath = ""
self.equipped = False
self.keyItem = False
self.usable = False
self.count = 0
class Weapon(Item):
def __init__(self, name = "", type = "", attackLower = 0, attackUpper = 10, count = 0):
super(Weapon, self).__init__()
self.name = name
self.type = type
self.attackLower = attackLower
self.attackUpper = attackUpper
class Armour(Item):
def __init__(self, name = "", ac = 0):
super(Armour, self).__init__()
self.ac = ac
init -2:
transform but_eff:
on idle:
easein 0.5 zoom 1.0
on hover:
easein 0.3 zoom 1.2
screen call_map_screen():
imagemap:
auto "images/full_screen_map_%s.png"
hotspot (360, 260, 80, 80) action Return() #with the hotspot, you have to know exactly where the part of the image is that you want to be the button: its xpos, ypos, width, and height
screen show_map_screen():
modal True
imagemap:
auto "images/full_screen_map_%s.png"
hotspot (360, 260, 80, 80) action Hide("show_map_screen") #with the hotspot, you have to know exactly where the part of the image is that you want to be the button: its xpos, ypos, width, and height
screen call_reg_screen1():
add "images/full_screen.png"
imagebutton auto "images/button_%s.png" xpos 360 ypos 260 action Return() #here you don't need to know the exact size of the button, you can just place the button image where you want
screen show_reg_screen1():
modal True
add "images/full_screen.png"
imagebutton auto "images/button_%s.png" xpos 360 ypos 260 action Hide("show_reg_screen1")
screen call_reg_screen2():
add "images/full_screen.png"
imagebutton auto "images/rbutton_%s.png" xanchor 0.5 xpos 0.1 yanchor 0.5 ypos 0.1 focus_mask True action Return() at but_eff #you can even just place the button image where you want using the looser percentages rather than exact pixels
# The game starts here.
label start:
scene black
"Calling an Imagemap...this goes to a new context."
call screen call_map_screen()
"So you did that and we've returned to the game. Now let's show the imagemap."
show screen show_map_screen()
"Notice that this text box is showing, we are still in the game. But you can't advance until you press that button."
"Now let's call a screen that uses an imagebutton instead of an imagemap."
call screen call_reg_screen1()
"Now we're back."
show screen show_reg_screen1()
"Let's show the imagebutton screen now instead. Press the button to advance."
"So the imagebutton and imagemap look the same. But imagebuttons give you more flexibility."
"For example, what if you decided you didn't want the button to be square, you just wanted it to be round? And what
if you don't want it in the center of the screen anymore? If you were using an imagemap, you'd have to change the entire imagemap.
If you are using an imagebutton, you can just change the imagebutton's shape, or put it in a new locaion."
"Also a thing that imagebuttons can do that imagemaps can't, is you can give the imagebutton a transform, like if you
wanted the button to get bigger when you hover over it. Check it out."
call screen call_reg_screen2()
"So. There you go."
python:
hero = GCharacter()
sword = Weapon('bastard','weapon', 10, 50, 0)
hero.add_item(sword)
"[hero.items[0].type]"
return
- Attachments
-
- testclass.zip
- (512.77 KiB) Downloaded 35 times
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Who is online
Users browsing this forum: Google [Bot], Ocelot