Re: How to change ui.input into a button?
Posted: Sat Mar 14, 2015 11:59 pm
Aah, ok, they are just using the enable on hover... hold on.
Supporting creators of visual novels and story-based games since 2003.
https://lemmasoft.renai.us/forums/
Post your full code, this should not happen.namastaii wrote:It's not even storing the names. hmm
Code: Select all
init python:
dressup_button_show = False
skinColor, hair, hairColor, top, topColor, bottom, bottomColor, eyes, eyesColor = 1, 1, 1, 1, 1, 1, 1, 1, 1 # default dressup items
skin_color_num, hair_styles_num, hair_color_num, top_num, top_color_num, bottom_num, bottom_color_num, eyes_num, eyes_color_num = 1, 4, 15, 5, 5, 5, 5, 3, 10 # number of styles (files) for each dressup item
def draw_char(st, at):
return LiveComposite(
(100, 630), # image size
(0, 0), "create_character/base_female.png",
(0, 0), "create_character/bottoms_female/bottom%s_%s.png"%(bottom, bottomColor),
(0, 0), "create_character/tops_female/top%s_%s.png"%(top, topColor),
(0, 0), "create_character/eyes_female/eyes%s_%s.png"%(eyes, eyesColor),
(0, 0), "create_character/eyebrows_female/eyebrows_1.png",
(0, 0), "create_character/mouth_female/mouth_2.png",
(0, 0), "create_character/hair_female/hair%s_%s.png"%(hair, hairColor),
),.1
def draw_char_side(st, at):
return LiveComposite(
(100, 630),
(2, 500), im.FactorScale("create_character/base_female.png", .45, .45),
(2, 500), im.FactorScale("create_character/bottoms_female/bottom%s_%s.png"%(bottom, bottomColor), .45, .45),
(2, 500), im.FactorScale("create_character/tops_female/top%s_%s.png"%(top, topColor), .45, .45),
(2, 500), im.FactorScale("create_character/eyes_female/eyes%s_%s.png"%(eyes, eyesColor), .45, .45),
(2, 500), im.FactorScale("create_character/eyebrows_female/eyebrows_1.png", .45, .45),
(2, 500), im.FactorScale("create_character/mouth_female/mouth_2.png", .45, .45),
(2, 500), im.FactorScale("create_character/hair_female/hair%s_%s.png"%(hair, hairColor), .45, .45),
),.1
init:
image char = DynamicDisplayable(draw_char) # using DynamicDisplayable ensures that any changes are visible immedietly
$ character = Character('Koma', color="#c8ffc8", window_left_padding=180, show_side_image=DynamicDisplayable(draw_char_side))
image bg create_character_background = "create_character/create_character_background.jpg"
label start:
show screen dressup_button
$ dressup_button_show = True
screen dressup_button: # a button to call the dressup game
if dressup_button_show:
vbox xalign 0.1 yalign 0.01:
textbutton "Create Character." action ui.callsinnewcontext("create_character")
####
init python:
def name_func(newstring):
store.var = newstring
screen name_input():
button xalign 0.3 yalign 0.12:
id "name_input"
xysize (250, 25)
action NullAction()
add Input(size=30,color="#ff0066",changed=name_func,length=10,button=renpy.get_widget("name_input","name_input")) yalign 1.0
button xalign 0.3 yalign 0.213:
id "name_input"
xysize (250, 25)
action NullAction()
add Input(size=30,color="#ff0066",default=lastName,changed=name_func,length=15,button=renpy.get_widget("name_input","name_input")) yalign 1.0
label create_character:
scene bg create_character_background
show char:
xpos 830
ypos -20
hide screen dressup_button
$ firstName =""
$ lastName = ""
$ player = firstName
show screen name_input()
python:
y = 20
ui.text("[hair]",size=25,color="#330033", ypos=277,xpos=310)
ui.text("[hairColor]",size=25,color="#330033", ypos=325,xpos=364)
ui.text("[top]",size=25,color="#330033", ypos=553,xpos=428)
ui.text("[topColor]",size=25,color="#330033", ypos=553,xpos=732)
ui.text("[bottom]",size=25,color="#330033", ypos=598,xpos=486)
ui.text("[bottomColor]",size=25,color="#330033", ypos=598,xpos=732)
ui.text("[eyes]",size=25,color="#330033", ypos=425,xpos=276)
ui.text("[eyesColor]",size=25,color="#330033", ypos=425,xpos=502)
ui.imagebutton("create_character/arrowL.png", "create_character/arrowLhover.png", clicked=ui.returns("topL"), ypos=550, xpos=377)
ui.imagebutton("create_character/arrowR.png", "create_character/arrowRhover.png", clicked=ui.returns("topR"), ypos=550, xpos=457)
y += 80
ui.imagebutton("create_character/arrowL.png", "create_character/arrowLhover.png", clicked=ui.returns("bottomL"), ypos=591, xpos=434)
ui.imagebutton("create_character/arrowR.png", "create_character/arrowRhover.png", clicked=ui.returns("bottomR"), ypos=591, xpos=514)
ui.imagebutton("create_character/arrowL.png", "create_character/arrowLhover.png", clicked=ui.returns("topColorL"), ypos=550, xpos=680)
ui.imagebutton("create_character/arrowR.png", "create_character/arrowRhover.png", clicked=ui.returns("topColorR"), ypos=550, xpos=760)
ui.imagebutton("create_character/arrowL.png", "create_character/arrowLhover.png", clicked=ui.returns("bottomColorL"), ypos=591, xpos=680)
ui.imagebutton("create_character/arrowR.png", "create_character/arrowRhover.png", clicked=ui.returns("bottomColorR"), ypos=591, xpos=760)
ui.imagebutton("create_character/arrowL.png", "create_character/arrowLhover.png", clicked=ui.returns("hairL"), ypos=274, xpos=256)
ui.imagebutton("create_character/arrowR.png", "create_character/arrowRhover.png", clicked=ui.returns("hairR"), ypos=274, xpos=336)
ui.imagebutton("create_character/arrowL.png", "create_character/arrowLhover.png", clicked=ui.returns("hairColorL"), ypos=320, xpos=310)
ui.imagebutton("create_character/arrowR.png", "create_character/arrowRhover.png", clicked=ui.returns("hairColorR"), ypos=320, xpos=410)
ui.imagebutton("create_character/arrowDown.png", "create_character/arrowDownhover.png", clicked=ui.returns("eyesL"), ypos=460, xpos=262)
ui.imagebutton("create_character/arrowUp.png", "create_character/arrowUphover.png", clicked=ui.returns("eyesR"), ypos=380, xpos=262)
ui.imagebutton("create_character/arrowDown.png", "create_character/arrowDownhover.png", clicked=ui.returns("eyesColorL"), ypos=460, xpos=498)
ui.imagebutton("create_character/arrowUp.png", "create_character/arrowUphover.png", clicked=ui.returns("eyesColorR"), ypos=380, xpos=498)
ui.textbutton("Return", clicked=ui.returns("goback")) # image button version: ui.imagebutton("return.png", "return_hover.png", clicked=ui.returns("goback"), ypos=0, xpos=0)
ui.textbutton("Continue", clicked=ui.returns("continue_toStart"), ypos=100, xpos=800)
$ picked = ui.interact()
if picked == "hairColorR":
$ hairColor += 1
if picked == "hairColorL":
$ hairColor -= 1
if hairColor < 1:
$ hairColor = 1
if hairColor > hair_color_num:
$ hairColor = hair_color_num
if picked == "hairL":
$ hair -= 1
if picked == "hairR":
$ hair += 1
if hair < 1:
$ hair = 1
if hair > hair_styles_num:
$ hair = hair_styles_num
if picked == "topR":
$ top += 1
if picked == "topL":
$ top -= 1
if top < 1:
$ top = 1
if top > top_num:
$ top = top_num
if picked == "topColorR":
$ topColor += 1
if picked == "topColorL":
$ topColor -= 1
if topColor < 1:
$ topColor = 1
if topColor > top_color_num:
$ topColor = top_color_num
if picked == "bottomR":
$ bottom += 1
if picked == "bottomL":
$ bottom -= 1
if bottom < 1:
$ bottom = 1
if bottom > bottom_num:
$ bottom = bottom_num
if picked == "bottomColorR":
$ bottomColor += 1
if picked == "bottomColorL":
$ bottomColor -= 1
if bottomColor < 1:
$ bottomColor = 1
if bottomColor > bottom_color_num:
$ bottomColor = bottom_color_num
if picked == "eyesR":
$ eyes += 1
if picked == "eyesL":
$ eyes -= 1
if eyes < 1:
$ eyes = 1
if eyes > eyes_num:
$ eyes = eyes_num
if picked == "eyesColorR":
$ eyesColor += 1
if picked == "eyesColorL":
$ eyesColor -= 1
if eyesColor < 1:
$ eyesColor = 1
if eyesColor > eyes_color_num:
$ eyesColor = eyes_color_num
if picked == "goback":
return
if picked == "continue_toStart":
jump begin_story
jump create_character # we don't want to return on every click, this jump loops until we click on "back" button
returnCode: Select all
init python:
def name_func(newstring):
store.firstname = newstring
def lastname_func(newstring):
store.lastname = newstring
screen name_input():
button xalign 0.3 yalign 0.12:
id "name_input1"
xysize (250, 25)
action NullAction()
add Input(size=30, color="#ff0066", default=firstname, changed=name_func, length=10, button=renpy.get_widget("name_input","name_input1")) yalign 1.0
button xalign 0.3 yalign 0.213:
id "name_input2"
xysize (250, 25)
action NullAction()
add Input(size=30, color="#ff0066", default=lastname, changed=lastname_func, length=15, button=renpy.get_widget("name_input","name_input2")) yalign 1.0
label start:
$ firstname = "Curious"
$ lastname = "Cat"
show screen name_input()
"[firstname] [lastname]"
"[firstname] [lastname]"
"[firstname] [lastname]"
"[firstname] [lastname]"