Search found 236 matches

by drKlauz
Thu Oct 20, 2016 10:36 pm
Forum: Ren'Py Questions and Announcements
Topic: Need help with a indenting issue
Replies: 6
Views: 753

Re: Need help with a indenting issue

Something like: define c = Character('Celestia') define l = Character('Luna') image Canterlot = "Celestia_s_throne_room.png" image Celestia = "celestia_standing.png" image Luna = "princess_luna_smiling.png" image Celestiaserious = "celestia_serious.png" label start: scene Canterlot show Celestia at ...
by drKlauz
Thu Oct 20, 2016 3:32 pm
Forum: Ren'Py Questions and Announcements
Topic: Need help with a indenting issue
Replies: 6
Views: 753

Re: Need help with a indenting issue

Python and RenPy is very indentation-sensitive and your whole indentation is wrong. https://www.renpy.org/doc/html/language_basics.html#indentation-and-blocks Labels should be same indentation level. Jump should be indented only if inside another block, like menu choice. Next time, please use code b...
by drKlauz
Thu Oct 20, 2016 9:39 am
Forum: Ren'Py Questions and Announcements
Topic: Can't seem to remove an item from a list
Replies: 6
Views: 691

Re: Can't seem to remove an item from a list

You remove item from list while iterating over it, common bug. Instead of this if self.wearing != []: for item in self.wearing: if item.tag == clothes.tag: self.wearing.remove(item) use list comprehension: self.wearing=[item for item in self.wearing if item.tag!=clothes.tag]
by drKlauz
Mon Sep 26, 2016 4:45 pm
Forum: Ren'Py Questions and Announcements
Topic: Stucked at inventory [solved]
Replies: 5
Views: 629

Re: Stucked at inventory [solved]

qty function return "None", not 0, if there no such item in inventory. Guess this is why you got errors.
Have fun :D
by drKlauz
Mon Sep 26, 2016 4:30 pm
Forum: Ren'Py Questions and Announcements
Topic: Stucked at inventory [solved]
Replies: 5
Views: 629

Re: Stucked at inventory

Try this

Code: Select all

init python:
  def InvCount(Item):
    rv=player_inv.qty(Item)
    return 0 if rv is None else rv

#...

label yoghurtroll1:
    if InvCount(yoghurt)>=1 and InvCount(roll)>=1:
      jump yoghurt2
    else:
      jump nocomponent
by drKlauz
Thu Sep 22, 2016 3:51 pm
Forum: Asset Creation: Art
Topic: How to create an textbox and namebox from scratch?
Replies: 4
Views: 1581

Re: How to create an textbox and namebox from scratch?

I'm 100% sure Photoshop is able more than circles. Check ellipse options. In CS6 it's gear icon, near "align edges", click it. There should be "unconstrained" option.
by drKlauz
Wed Sep 21, 2016 5:06 pm
Forum: Ren'Py Questions and Announcements
Topic: How to continue the game After jumping to a label?
Replies: 2
Views: 574

Re: How to continue the game After jumping to a label?

If you call label, you have to write "return" somewhere, so it can get back to place of call. Return doesn't need to be exactly at yes label, just somewhere on path. label yes: r "YES!" return label no: r "NO!" return #... menu: "do you?" "mmm, ok..": call yes "no way": call no "next scene" renpy.re...
by drKlauz
Tue Sep 20, 2016 1:07 pm
Forum: Ren'Py Questions and Announcements
Topic: Random choice that doesn't repeat
Replies: 3
Views: 1719

Re: Random choice that doesn't repeat

If you don't need original order of item list, you can simple shuffle it in-place:

Code: Select all

$renpy.random.shuffle(item_list)
No need for t_list.
by drKlauz
Tue Sep 20, 2016 11:27 am
Forum: Ren'Py Questions and Announcements
Topic: Random choice that doesn't repeat
Replies: 3
Views: 1719

Re: Random choice that doesn't repeat

Code: Select all

    $t_list=item_list[:]
    $renpy.random.shuffle(t_list)
instead of

Code: Select all

    $ t_list = []
    for Good in item_list:
        $ rand = renpy.random.choice(item_list)
        if rand not in t_list:
            $ t_list.append(renpy.random.choice(item_list))
by drKlauz
Mon Sep 19, 2016 2:30 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED]Question Regarding Classes in Buttons
Replies: 5
Views: 425

Re: Question Regarding Classes in Buttons

Your ruckSack.addItem broken, items were not adding. So sack was always empty, you probably tried to access some variable, it contained None, and as None have no name attribute, you got error. Quick fix/working sample: init python: class Item(object): def __init__(self, name, count=0): self.name = n...
by drKlauz
Mon Sep 19, 2016 1:29 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED]Question Regarding Classes in Buttons
Replies: 5
Views: 425

Re: Question Regarding Classes in Buttons

How you defined "item"? This code is showing how to access item.name init python: class TItem: #define item class def __init__(self): self.name='Giant Gilded Sword' screen Test: button: text "Item name is: [item.name]" #access "name" field of item class instance action Null() label start: $item=TIte...
by drKlauz
Mon Sep 19, 2016 1:03 pm
Forum: Ren'Py Questions and Announcements
Topic: [SOLVED]Question Regarding Classes in Buttons
Replies: 5
Views: 425

Re: Question Regarding Classes in Buttons

Quite likely you ask "name" of class "item", but should ask "name" of instance of class "item".
Hard to tell, provide more code.
by drKlauz
Mon Sep 19, 2016 5:39 am
Forum: Ren'Py Questions and Announcements
Topic: how to random quiz question in python?
Replies: 2
Views: 932

Re: how to random quiz question in python?

renpy.random.shuffle could help label QuizStart: $QuizScore=0 $Questions=[n+1 for n in range(10)] #change 10 to other number $renpy.random.shuffle(Questions) label Quiz: $Question=Questions.pop() if Question==1: menu:... ... if Question==10: menu:... if Questions!=[]: jump Quiz label ShowQuizResults...
by drKlauz
Mon Sep 19, 2016 4:56 am
Forum: Ren'Py Questions and Announcements
Topic: Should I manage mutable menus with one screen or many?
Replies: 5
Views: 382

Re: Should I manage mutable menus with one screen or many?

Global variables/functions/etc are visible inside screens, shouldn't be a problem. If really concerned, test if variable exist, then use it, if not, then use some placeholder.