General Category > Game creators corner

Jim's problems

<< < (2/8) > >>

prock:
Hi Jim,

No worries about where you are posting your questions.  Sounds like you uncovered a bug with FIFErpg.  Beliar is the creator of FIFErpg so you are in good hands!

Beliar:
Hi Jim,

I just pushed a commit that should fix the error you got. Please update to the latest git version and try again.

ChrisOelmueller:
Unrelated: instead of

--- Code: ---callback=lambda: actions["PickUp"].execute()
--- End code ---
you can just use this (without the parens):

--- Code: ---callback=actions["PickUp"].execute
--- End code ---
lambda is only necessary if you want to pass certain arguments as well, and don't want to use either functools.partial or the callback classes.

Jim:
Works perfectly now, thanks!

In the meantime I have another problem which I now also think might be a bug (though I'm probably just doing something wrong). I was beginning to try some basic things with the dialogue controller in order to eventually add the example dialogue to the demo and this kept popping up:

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\fife\extensions\fife_timer.py", line 125, in updateEvent
    self._callback()
  File "C:\Python27\lib\site-packages\fife\extensions\pychan\tools.py", line 83, in real_callback
    callback(*args,**kwargs)
  File "C:\Python27\lib\site-packages\fife\extensions\pychan\events.py", line 164, in delayed_f
    f( event )
  File "C:\Python27\lib\site-packages\fife\extensions\pychan\events.py", line 327, in captured_f
    tools.applyOnlySuitable(self_ref().callbacks[group_name][event_name],event=event,widget=self_ref().widget_ref())
  File "C:\Python27\lib\site-packages\fife\extensions\pychan\tools.py", line 60, in applyOnlySuitable
    return func(*args,**kwargs)
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\demo_game_scene.py", line 101, in <lambda>
    'talkButton' : lambda: self.onTalkButtonPress(player, entity),
  File "C:\Program Files (x86)\FIFE\demos\fiferpg demo\demo_game_scene.py", line 167, in onTalkButtonPress
    dlg = DialogueController(world, application, "dialogue/example.yaml")
  File "C:\Python27\lib\site-packages\fife_rpg\dialogue.py", line 223, in __init__
    self.dialogue = Dialogue(self.application.world, dialogue)
  File "C:\Python27\lib\site-packages\fife_rpg\dialogue.py", line 81, in __init__
    self.create_sections(sections_data)
  File "C:\Python27\lib\site-packages\fife_rpg\dialogue.py", line 183, in create_sections
    section = self.create_section(section_data)
  File "C:\Python27\lib\site-packages\fife_rpg\dialogue.py", line 172, in create_section
    section.text = _(section.text).format(**variables)
  File "C:\Python27\lib\site-packages\bGrease\entity.py", line 90, in __getattr__
    component = getattr(self.world.components, name)
AttributeError: 'ComponentParts' object has no attribute 'description'

upon pressing the talk button in the context menu like so:

    def onTalkButtonPress(self):         
        application = self.gamecontroller.application
        world = application.world
        dlg = DialogueController(world, application, "dialogue/example.yaml")
        dlg.select_response("no_introduce")
        print dlg.current_section.text

Beliar:
Ah, yeah, I just noticed that I haven't kept the demo in the repository up-to date as I didn't really liked it the way its anyway. Its stull using old names for component fields, here is the updated dialogue file:


--- Code: ---# This is an example dialogue file

Greetings:
 
  - talker: David
    text: Hey, I've seen you before, haven't I?
    conditions:
      - Type: Knows
        Args: [David, PlayerCharacter]
    responses:
      - "yes"
      - yes_bye
         
  - talker: David
    text: Hi, I don't know you, do I?
    conditions:
      - Type: Not_Knows
        Args: [David, PlayerCharacter]
    responses:
      - no_introduce
      - no_bye

Sections:
  no_introduce:
    talker: PlayerCharacter
    text: No. I am {DialogueTalker.Description.view_name}
    commands:
        - Name: AddKnowledge
          Args: [David, PlayerCharacter]
    responses:
      - introduce_reply
  no_bye:
    talker: PlayerCharacter
    text: No, and I don't want to change that.
  "yes":
    talker: PlayerCharacter
    text: Yes, I am {DialogueTalker.Description.view_name}. Remember?
    responses:
      - yes_reply
  yes_bye:
     talker: PlayerCharacter
     text: Yes, but I am in a hurry. Bye.
  introduce_reply:
    talker: David
    text: Nice to meet you, my name is {DialogueTalker.Description.real_name}
    commands:
      - Name: SetComponentValue
        Args: [David, Description, view_name, "{DialogueTalker.Description.real_name}"]
      - Name: AddKnowledge
        Args: [PlayerCharacter, David]
  yes_reply:
    talker: David
    text: Ah, right.
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version