Page 1 of 1

"string indices must be integers, not tuple" [solved]

Posted: Wed Jan 15, 2014 9:12 am
by balldancing
I'm trying to figure out how to customize the in-game messaging system I retrieved from this thread and I came up with an error I'm unsure how to fix.

Code: Select all

            use mailbox_commands

screen mailbox_commands:
    hbox:
        if current_message and current_message.can_reply:
            imagebutton idle "reply_ground.png" hover "reply_hover.png" action current_message.reply
        else:
            imagebutton idle "reply_ground.png" hover "reply_hover.png" action None
        if current_message:
            imagebutton idle "delete_ground.png" hover "delete_hover.png" action [current_message.delete, SetScreenVariable("current_message", None)]
        else:
            imagebutton idle "delete_ground.png" hover "delete_hover.png" action None
        if new_messages > 0:
            imagebutton idle "mark_ground.png" hover "mark_hover.png" [mark_all_read, SetVariable("new_messages",0)]
        else:
            imagebutton idle "mark_ground.png" hover "mark_hover.png" action None
        imagebutton idle "restore_ground.png" hover "restore_hover.png" action restore_all
        imagebutton idle "exit_ground.png" hover "exit_hover.png" action Hide("mailbox")
This is where the error occured, and this is the traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 21, in script
  File "game/messages.rpy", line 94, in python
  File "game/messages.rpy", line 107, in python
TypeError: string indices must be integers, not tuple

Re: "string indices must be integers, not tuple"

Posted: Wed Jan 15, 2014 9:15 am
by Anima

Code: Select all

imagebutton idle "mark_ground.png" hover "mark_hover.png" Keyword! [mark_all_read, SetVariable("new_messages",0)]
Here is a keyword missing.
General pointer, when a traceback gives you the line number where things go wrong, you should mark the line in the posts, so people don't have to hunt trough the whole code to find the error.

Re: "string indices must be integers, not tuple"

Posted: Wed Jan 15, 2014 9:22 am
by balldancing
Oh goodness I didn't look hard enough ^^; and thank you so much!! I'll remember for next time.