View difference between Paste ID: iARcUze9 and jU9cCM6t
SHOW: | | - or go back to the newest paste.
1
        character_attributes = ["languages", "speaking", "personal_scent", "reputation", "personality", "peoplecolor",
2
                                "speechcolor", "pose_default", "pose", "travelstring_default", "travelstring",
3
                                "voicetype", "voicedesc", "birthday", "armor", "covered", "bodyparts", "clothes",
4
                                "origin", "handedness", "age", "gender", "heritage", "background", "privatepast",
5
                                "desc", "height", "weight", "eyecolor", "skincolor", "haircolor", "hairstyle",
6
                                "handwriting", "skills", "stats", "currency"]
7
		string = ""
8
        string = "|R# CHARACTERS|n|/"
9-
        string += "|/limbo = caller.search('#2', global_search=True)|/|/"
9+
        string = f"{string}|/limbo = caller.search('#2', global_search=True)|/|/"
10
        char_id = 1
11
        for char in Character.objects.all():
12
            # collect the account it belongs to, in order to search out and attach to in the build
13
            if char.account:
14
                char_account_name = char.account.name
15
            else:
16
                char_account_name = "Aleph"
17
            # Set up string to create new character object
18-
            string += "|/character_%s = create_object(Character, key='%s', location=limbo)|/" % (char_id, char.key)
18+
            string = f"{string}|/character_{char_id}s = create_object(Character, key='{char.key}s', location=limbo)|/"
19
            # Attach the object to the right account
20-
            string += "|/for player in Account.objects.all():|/" \
20+
            string = f"{string}|/for player in Account.objects.all():|/" \
21-
                      "|-if player.key == '%s':|/" \
21+
                      f"|-if player.key == '{char_account_name}':|/" \
22-
                      "|-|-player.db._playable_characters.append(character_%s)|/" % (char_account_name, char_id)
22+
                      f"|-|-player.db._playable_characters.append(character_{char_id}s)|/"
23
            # Fix the attributes of the new object
24
            for attribute in character_attributes:
25-
                string += "character_%s.db.%s = %s|/"%(str(char_id), attribute, char.attributes.get(attribute))
25+
                string = f"{string}character_{str(char_id)}.db.{attribute} = {char.attributes.get(attribute)}|/"
26
            char_id = char_id + 1
27
28
        self.caller.msg(string)
29