[SOLVED]Making hp heal potions

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.
Message
Author
leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

[SOLVED]Making hp heal potions

#1 Post by leoxhurt » Tue Aug 29, 2017 10:12 am

I was trying to make a rpg frame and want to know. how to make a potion to heal hp? i followed the example of a script but it need a define to "gain" someone can help me?
Last edited by leoxhurt on Sun Sep 17, 2017 9:38 am, edited 1 time in total.

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making hp heal potions

#2 Post by DannyGMaster » Tue Aug 29, 2017 12:37 pm

For an introduction to how to create items and an inventory to hold them, among other good things, check here:
viewtopic.php?f=51&t=44730

As for the HP Healing part, you need to create a function that will add up a specific number to the variable that holds the HP parameter of a character, without exceeding his/her maximum HP, supposing your battler has that stat defined.

A quick example:

Code: Select all

init python:
    class Battler(object):
        def __init__(self, name, max_hp):
            self.name = name
            self.max_hp = max_hp
            self.hp = self.max_hp

            
default adam = Battler("Adam", 100)
In this code I give max_hp and hp as separate single stats, you will see why in a moment.

The function for changing a battler's HP would be something like this:

Code: Select all

init python:
    def heal_hp(battler, amount):
        battler.hp += amount
        if battler.hp > battler.max_hp:
            battler.hp = battler.max_hp
This function receives a battler object as first argument, and an amount (a number) as a second parameter. It takes the battler's HP value, increases it with the number specified, then it checks if the hp variable exceeds the max_hp value. If it does, it resets it, so HP can never normally exceed whatever max HP the character may have.

You can then call this function from your Item object's code, or from your battle menu, or anywhere, that really depends on you and how you code your game.
The silent voice within one's heart whispers the most profound wisdom.

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#3 Post by leoxhurt » Wed Aug 30, 2017 11:08 am

DannyGMaster wrote:
Tue Aug 29, 2017 12:37 pm
For an introduction to how to create items and an inventory to hold them, among other good things, check here:
viewtopic.php?f=51&t=44730

As for the HP Healing part, you need to create a function that will add up a specific number to the variable that holds the HP parameter of a character, without exceeding his/her maximum HP, supposing your battler has that stat defined.

A quick example:

Code: Select all

init python:
    class Battler(object):
        def __init__(self, name, max_hp):
            self.name = name
            self.max_hp = max_hp
            self.hp = self.max_hp

            
default adam = Battler("Adam", 100)
In this code I give max_hp and hp as separate single stats, you will see why in a moment.

The function for changing a battler's HP would be something like this:

Code: Select all

init python:
    def heal_hp(battler, amount):
        battler.hp += amount
        if battler.hp > battler.max_hp:
            battler.hp = battler.max_hp
This function receives a battler object as first argument, and an amount (a number) as a second parameter. It takes the battler's HP value, increases it with the number specified, then it checks if the hp variable exceeds the max_hp value. If it does, it resets it, so HP can never normally exceed whatever max HP the character may have.

You can then call this function from your Item object's code, or from your battle menu, or anywhere, that really depends on you and how you code your game.
the ""defeault adam init python:
class Battler(object):
def __init__(self, name, max_hp):
self.name = name
self.max_hp = max_hp
self.hp = self.max_hp


i will try to add this in my code, thanks

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#4 Post by leoxhurt » Wed Aug 30, 2017 1:46 pm

DannyGMaster wrote:
Tue Aug 29, 2017 12:37 pm
For an introduction to how to create items and an inventory to hold them, among other good things, check here:
viewtopic.php?f=51&t=44730

As for the HP Healing part, you need to create a function that will add up a specific number to the variable that holds the HP parameter of a character, without exceeding his/her maximum HP, supposing your battler has that stat defined.

A quick example:

Code: Select all

init python:
    class Battler(object):
        def __init__(self, name, max_hp):
            self.name = name
            self.max_hp = max_hp
            self.hp = self.max_hp

            
default adam = Battler("Adam", 100)
In this code I give max_hp and hp as separate single stats, you will see why in a moment.

The function for changing a battler's HP would be something like this:
i

Code: Select all

init python:
    def heal_hp(battler, amount):
        battler.hp += amount
        if battler.hp > battler.max_hp:
            battler.hp = battler.max_hp
This function receives a battler object as first argument, and an amount (a number) as a second parameter. It takes the battler's HP value, increases it with the number specified, then it checks if the hp variable exceeds the max_hp value. If it does, it resets it, so HP can never normally exceed whatever max HP the character may have.

You can then call this function from your Item object's code, or from your battle menu, or anywhere, that really depends on you and how you code your game.
i got this error in the code:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/wtg_rpg.rpy", line 180: expected an indented block
            self->.HP = self.maxHP
                ^
    

Ren'Py Version: Ren'Py 6.99.12.4.2187
obs: the self.HP and maxHP of my char script is in this way

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#5 Post by leoxhurt » Wed Aug 30, 2017 8:07 pm

leoxhurt wrote:
Wed Aug 30, 2017 1:46 pm
DannyGMaster wrote:
Tue Aug 29, 2017 12:37 pm
For an introduction to how to create items and an inventory to hold them, among other good things, check here:
viewtopic.php?f=51&t=44730

As for the HP Healing part, you need to create a function that will add up a specific number to the variable that holds the HP parameter of a character, without exceeding his/her maximum HP, supposing your battler has that stat defined.

A quick example:

Code: Select all

init python:
    class Battler(object):
        def __init__(self, name, max_hp):
            self.name = name
            self.max_hp = max_hp
            self.hp = self.max_hp

            
default adam = Battler("Adam", 100)
In this code I give max_hp and hp as separate single stats, you will see why in a moment.

The function for changing a battler's HP would be something like this:
i

Code: Select all

init python:
    def heal_hp(battler, amount):
        battler.hp += amount
        if battler.hp > battler.max_hp:
            battler.hp = battler.max_hp
This function receives a battler object as first argument, and an amount (a number) as a second parameter. It takes the battler's HP value, increases it with the number specified, then it checks if the hp variable exceeds the max_hp value. If it does, it resets it, so HP can never normally exceed whatever max HP the character may have.

You can then call this function from your Item object's code, or from your battle menu, or anywhere, that really depends on you and how you code your game.
i got this error in the code:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/wtg_rpg.rpy", line 180: expected an indented block
            self->.HP = self.maxHP
                ^
    

Ren'Py Version: Ren'Py 6.99.12.4.2187
obs: the self.HP and maxHP of my char script is in this way
this error was solved, but i setted the item as:

Code: Select all

$ pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)
but when i try to activate it, only active if i click on it and my mouse leave the icon area, how to fix it?

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making hp heal potions

#6 Post by DannyGMaster » Thu Aug 31, 2017 8:34 am

leoxhurt wrote:
Wed Aug 30, 2017 1:46 pm
this error was solved, but i setted the item as:

Code: Select all

$ pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)
but when i try to activate it, only active if i click on it and my mouse leave the icon area, how to fix it?
If I understand correctly, you have a Potion icon in some sort of item screen, and when you click on it, it only activates when you take the mouse out of it?

I don't know if this is the cause but I assume you created the pot inside a label (from the $ mark you put before it), in your script. If that's the case, maybe you should define it outside of a label, using the default statement.

Code: Select all

default pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)

label start:

    # The game starts here.
    
    # And continues on.
The silent voice within one's heart whispers the most profound wisdom.

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#7 Post by leoxhurt » Thu Aug 31, 2017 8:40 am

DannyGMaster wrote:
Thu Aug 31, 2017 8:34 am
leoxhurt wrote:
Wed Aug 30, 2017 1:46 pm
this error was solved, but i setted the item as:

Code: Select all

$ pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)
but when i try to activate it, only active if i click on it and my mouse leave the icon area, how to fix it?
If I understand correctly, you have a Potion icon in some sort of item screen, and when you click on it, it only activates when you take the mouse out of it?

I don't know if this is the cause but I assume you created the pot inside a label (from the $ mark you put before it), in your script. If that's the case, maybe you should define it outside of a label, using the default statement.

Code: Select all

default pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)

label start:

    # The game starts here.
    
    # And continues on.
[/quote]

yes, i used a $ to define, but i setted now on defeault and the same trouble keeps until i used the defeault thing you said, but i can show the code if nedded to solve this

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#8 Post by leoxhurt » Thu Aug 31, 2017 8:41 am

leoxhurt wrote:
Thu Aug 31, 2017 8:40 am
DannyGMaster wrote:
Thu Aug 31, 2017 8:34 am
leoxhurt wrote:
Wed Aug 30, 2017 1:46 pm
this error was solved, but i setted the item as:

Code: Select all

$ pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)
but when i try to activate it, only active if i click on it and my mouse leave the icon area, how to fix it?
If I understand correctly, you have a Potion icon in some sort of item screen, and when you click on it, it only activates when you take the mouse out of it?

I don't know if this is the cause but I assume you created the pot inside a label (from the $ mark you put before it), in your script. If that's the case, maybe you should define it outside of a label, using the default statement.

Code: Select all

default pot = Item("Small Potion", "A Small Potion that heals 20 hp", "potevida.png", act=heal_hp)

label start:

    # The game starts here.
    
    # And continues on.
yes, i used a $ to define, but i setted now on defeault and the same trouble keeps until i used the defeault thing you said, but i can show the code if nedded to solve this

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making hp heal potions

#9 Post by DannyGMaster » Thu Aug 31, 2017 8:49 am

leoxhurt wrote:
Thu Aug 31, 2017 8:41 am
yes, i used a $ to define, but i setted now on defeault and the same trouble keeps until i used the defeault thing you said, but i can show the code if nedded to solve this
Yes, If you can show the relevant code, it may help us understand what the problem is.
The silent voice within one's heart whispers the most profound wisdom.

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#10 Post by leoxhurt » Thu Aug 31, 2017 8:54 am

DannyGMaster wrote:
Thu Aug 31, 2017 8:49 am
leoxhurt wrote:
Thu Aug 31, 2017 8:41 am
yes, i used a $ to define, but i setted now on defeault and the same trouble keeps until i used the defeault thing you said, but i can show the code if nedded to solve this
Yes, If you can show the relevant code, it may help us understand what the problem is.

Code: Select all

class Item(store.object):
        def __init__(self, name, desc, icon=False, player=None, value=0, act=None, action=None, heal_hp= 0, type="item", recipe=False):
            global cookbook
            self.name = name
            self.desc = desc
            self.actions = []
            self.heal_hp = heal_hp
            self.player=player
            self.action = action
            self.icon = icon
            self.value = value               
            self.act = act # screen action
            self.type = type # type of item
            self.recipe = recipe # nested list of [ingredient, qty]   
        def use(self): #here we define what should happen when we use the item
            if self.hp>0: #healing item
                self.hp = self.hp+self.hp
                if self.hp > self.maxhp: # can't heal beyond max HP
                    self.hp = self.maxhp  
                inventory.drop(self) # consumable item - drop after use
            if recipe:
                cookbook.append(self)
                cookbook.sort(key=lambda i: i.name) #alpha order

        def change(self, name, heal_hp, desc=False, icon=False, value=False, act=False, recipe=False, action=False): 
            self.name = name
            if desc:
                self.desc = desc
            if icon:
                self.icon = icon
            if value:
                self.value = value   
            if act:
                self.act = act
            if action:
                self.action = action
            if heal_hp:
                self.heal_hp = heal_hp
            if recipe:
                self.recipe = recipe                
            
    class Inventory(store.object):
        def __init__(self, name, money=0, barter=100):
            self.name = name
            self.money = money
            self.barter = barter #percentage of value paid for items            
            self.inv = []  # items stored in nested list [item object, qty]
            self.sort_by = self.sort_name
            self.sort_order = True #ascending, descending
            self.grid_view = True
            
        def buy(self, item, price):            
            self.deposit(price)            
            self.take(item[0])                
    
        def check(self, item):
            if self.qty(item):
                for i in self.inv:
                    if i[0] == item:        
                        return self.inv.index(i) # returns item index (location) 
this is the item/inventory script and the call for hp_heal is this

Code: Select all

def heal_hp():
        wtg_player.HP += 6
        if wtg_player.HP > wtg_player.maxHP:
            wtg_player.HP = wtg_player.maxHP

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making hp heal potions

#11 Post by DannyGMaster » Thu Aug 31, 2017 9:11 am

The problem doesn't seem to be here. I was referring also to the code of the screen, where the icon is shown
(I presume as an imagebutton) and when the clicking process occurs.
The silent voice within one's heart whispers the most profound wisdom.

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#12 Post by leoxhurt » Thu Aug 31, 2017 9:41 am

DannyGMaster wrote:
Thu Aug 31, 2017 9:11 am
The problem doesn't seem to be here. I was referring also to the code of the screen, where the icon is shown
(I presume as an imagebutton) and when the clicking process occurs.
i don't created a specific screen to the potion, the icon appears in the inventory screen by the call "icon" in the item and inventory code, but if you want to see the screeen inventory i will leave it here

Code: Select all

screen inventory_screen(first_inventory, second_inventory=False, trade_mode=False, bank_mode=False):
    default crafting_screen = False
    tag menu
    modal False
    
    frame yalign 0.41 xalign 1.0:
        hbox:
            textbutton "{color=#FFFFFF}Fechar Inventário{/color}" action [ Hide("inventory_screen"), Show("mochila")]    
    frame yalign 0.0 xalign 0.367:
        style_group "invstyle"          
        hbox:
            spacing 25
            vbox:
                label first_inventory.name      
                if not second_inventory:
                    text "Ouro: [first_inventory.money]"
                if second_inventory:
                    use money(first_inventory, second_inventory, bank_mode) 
                use inventory_view(first_inventory, second_inventory, trade_mode)                          
                use view_nav(first_inventory)
                use sort_nav(first_inventory)
                if not second_inventory:
                    textbutton "Modo de Criação" action ToggleScreenVariable("crafting_screen")
                
            if second_inventory:
                vbox:
                    label second_inventory.name  
                    use money(second_inventory, first_inventory, bank_mode)                       
                    use inventory_view(second_inventory, first_inventory, trade_mode)
                    use view_nav(second_inventory)
                    use sort_nav(second_inventory)
            if crafting_screen:
                use crafting(first_inventory)
                
screen inventory_view(inventory, second_inventory=False, trade_mode=False):     
    side "c r":
        style_group "invstyle"
        area (0, 0, 400, 360) 
        vpgrid id ("vp"+inventory.name):
            draggable True   
            mousewheel True
            xsize 350 ysize 460
            if inventory.grid_view:
                cols 3 spacing 10
            else:
                cols 1 spacing 25
            for item in inventory.inv:
                $ name = item[0].name
                $ desc = item[0].desc
                $ value = item[0].value
                $ qty = str(item[1])
                hbox:
                    if item[0].icon:
                        $ icon = item[0].icon
                        $ hover_icon = im.Sepia(icon)                              
                        imagebutton:
                            idle LiveComposite((100,100), (0,0), icon, (0,0), Text(qty))
                            hover LiveComposite((100,100), (0,0), hover_icon, (0,0), Text(qty))
                            action (If(not second_inventory, item[0].act, (If(trade_mode, Function(trade,inventory, second_inventory, item), Function(transaction,inventory, second_inventory, item)))))
                            hovered Show("tooltip",item=item,seller=second_inventory)
                            unhovered Hide("tooltip")
                        if not inventory.grid_view:
                            vbox:
                                text name
                                if not trade_mode:
                                    text "Lista de Valor: [value]"                                        
                                    if second_inventory:                                            
                                        text ("Valor de venda: " + str(calculate_price(item, second_inventory)) + ")")
                    
                    else:                               
                        textbutton "[Nome] ([Nº])" action (If(not second_inventory, item[0].act,(If(trade_mode, Function(trade,inventory, second_inventory, item), Function(transaction,inventory, second_inventory, item))))) hovered Show("tooltip",item=item,seller=second_inventory) unhovered Hide("tooltip")
                        if not inventory.grid_view:
                            vbox:                        
                                text "Lista de Valor: [value]"
                                if not trade_mode and second_inventory:
                                    text "Valor de venda: " + str(calculate_price(item, second_inventory)) + ")"
            
            ## maintains spacing in empty inventories.
            if len(inventory.inv) == 0:
                add Null(height=100,width=100)
                                    
        vbar value YScrollValue("vp"+inventory.name)

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making hp heal potions

#13 Post by DannyGMaster » Thu Aug 31, 2017 10:05 am

Okay, the only suspicious part I see is still the $ marks here:

Code: Select all

$ name = item[0].name
$ desc = item[0].desc
$ value = item[0].value
$ qty = str(item[1])
hbox:
    if item[0].icon:
        $ icon = item[0].icon
        $ hover_icon = im.Sepia(icon) 
Remove them and see if it now works correctly. If it doesn't, then the problem is somewhere else and if that were the case, I wouldn't really know how to help you.
The silent voice within one's heart whispers the most profound wisdom.

leoxhurt
Regular
Posts: 34
Joined: Fri Aug 04, 2017 6:25 pm
Contact:

Re: Making hp heal potions

#14 Post by leoxhurt » Thu Aug 31, 2017 11:02 am

DannyGMaster wrote:
Thu Aug 31, 2017 10:05 am
Okay, the only suspicious part I see is still the $ marks here:

Code: Select all

$ name = item[0].name
$ desc = item[0].desc
$ value = item[0].value
$ qty = str(item[1])
hbox:
    if item[0].icon:
        $ icon = item[0].icon
        $ hover_icon = im.Sepia(icon) 
Remove them and see if it now works correctly. If it doesn't, then the problem is somewhere else and if that were the case, I wouldn't really know how to help you.
he give me a error

Code: Select all


[code]
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 113, in script
    "Você se encontra em uma vila vazia, que parece estar abandonada, pois apesar de ser dia não se vê uma pessoa nas ruas e há diversos pertences abandonados."
  File "game/inventory.rpy", line 161, in execute
    screen inventory_screen(first_inventory, second_inventory=False, trade_mode=False, bank_mode=False):
  File "game/inventory.rpy", line 161, in execute
    screen inventory_screen(first_inventory, second_inventory=False, trade_mode=False, bank_mode=False):
  File "game/inventory.rpy", line 169, in execute
    frame yalign 0.0 xalign 0.367:
  File "game/inventory.rpy", line 171, in execute
    hbox:
  File "game/inventory.rpy", line 173, in execute
    vbox:
  File "game/inventory.rpy", line 179, in execute
    use inventory_view(first_inventory, second_inventory, trade_mode)
  File "game/inventory.rpy", line 195, in execute
    screen inventory_view(inventory, second_inventory=False, trade_mode=False):
  File "game/inventory.rpy", line 195, in execute
    screen inventory_view(inventory, second_inventory=False, trade_mode=False):
  File "game/inventory.rpy", line 196, in execute
    side "c r":
  File "game/inventory.rpy", line 199, in execute
    vpgrid id ("vp"+inventory.name):
  File "game/inventory.rpy", line 207, in execute
    for item in inventory.inv:
  File "game/inventory.rpy", line 209, in execute
    imagebutton:
  File "game/inventory.rpy", line 209, in keywords
    imagebutton:
NameError: name 'qty' is not defined

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

Full traceback:
  File "game/script.rpy", line 113, in script
    "Você se encontra em uma vila vazia, que parece estar abandonada, pois apesar de ser dia não se vê uma pessoa nas ruas e há diversos pertences abandonados."
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\ast.py", line 613, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\exports.py", line 1147, in say
    who(what, interact=interact)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\character.py", line 877, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\character.py", line 716, in do_display
    **display_args)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\character.py", line 508, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\ui.py", line 285, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\core.py", line 2526, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\core.py", line 2793, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\core.py", line 495, in visit_all
    d.visit_all(callback)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\screen.py", line 399, in visit_all
    callback(self)
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\core.py", line 2793, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\screen.py", line 409, in per_interact
    self.update()
  File "D:\Documentos\Games\renpy-6.99.1-sdk\renpy\display\screen.py", line 578, in update
    self.screen.function(**self.scope)
  File "game/inventory.rpy", line 161, in execute
    screen inventory_screen(first_inventory, second_inventory=False, trade_mode=False, bank_mode=False):
  File "game/inventory.rpy", line 161, in execute
    screen inventory_screen(first_inventory, second_inventory=False, trade_mode=False, bank_mode=False):
  File "game/inventory.rpy", line 169, in execute
    frame yalign 0.0 xalign 0.367:
  File "game/inventory.rpy", line 171, in execute
    hbox:
  File "game/inventory.rpy", line 173, in execute
    vbox:
  File "game/inventory.rpy", line 179, in execute
    use inventory_view(first_inventory, second_inventory, trade_mode)
  File "game/inventory.rpy", line 195, in execute
    screen inventory_view(inventory, second_inventory=False, trade_mode=False):
  File "game/inventory.rpy", line 195, in execute
    screen inventory_view(inventory, second_inventory=False, trade_mode=False):
  File "game/inventory.rpy", line 196, in execute
    side "c r":
  File "game/inventory.rpy", line 199, in execute
    vpgrid id ("vp"+inventory.name):
  File "game/inventory.rpy", line 207, in execute
    for item in inventory.inv:
  File "game/inventory.rpy", line 209, in execute
    imagebutton:
  File "game/inventory.rpy", line 209, in keywords
    imagebutton:
  File "<screen language>", line 211, in <module>
NameError: name 'qty' is not defined

Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.4.2187
A Tale of Truths and Lies Demo 1.4.5

User avatar
DannyGMaster
Regular
Posts: 113
Joined: Fri Sep 02, 2016 11:07 am
Contact:

Re: Making hp heal potions

#15 Post by DannyGMaster » Thu Aug 31, 2017 11:10 am

Okay, you probably did not understand, sorry about that.

Just to be sure, I wanted you to take out only the $, not the entire lines. It would end up looking like this:

Code: Select all

name = item[0].name
desc = item[0].desc
value = item[0].value
qty = str(item[1])
hbox:
    if item[0].icon:
        icon = item[0].icon
        hover_icon = im.Sepia(icon) 
The silent voice within one's heart whispers the most profound wisdom.

Post Reply

Who is online

Users browsing this forum: No registered users