You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CharActor/README.md
+34-15
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,16 @@
1
1
# Import CharActor as ca
2
2
3
3
Importing `CharActor as ca` is just a convention. But it's a good one. It's short and sweet. Upon doing so you are granted public access to the following:
4
-
4
+
5
5
*`ca.character_bank` - The character bank will have no public attributes until you create a character.
6
-
*`ca.create` - The create function can, you guessed it, create a character. It accepts a number of parameters, but none are necessary, they are as follows; `obj_name`, `name`, `role`, `race`, `background`, `alignment` and `grid`.
7
-
`obj_name` will designate the identifier assigned to `ca.character_bank`.
8
-
*`ca.load_dict` - The load_dict function can be used to load one of the many json file is the `CharActor/_charactor/actor/dicts/` directory. It accepts a single parameter, `dict_name`, which is the name of the json file you wish to load.
9
-
*`ca.load_list` - See above, but for lists saved as json.
10
-
*`ca.load_dicts` - Returns a dictionary of all the json files.
11
-
*`ca.Catalogues` - Provides access to the `ca.Catalogues.get` method, which can be used to produce an Item object from either `ca.Catalogues.Goods` or `ca.Catalogues.Armory`.
12
-
13
-
## Creating a Character
6
+
*`ca.create` - The create function can, you guessed it, create a character. It accepts a number of parameters, but none are necessary, they are as follows; `obj_name`, `name`, `role`, `race`, `background`, `alignment` and `grid`.
7
+
8
+
## ca.create()
9
+
14
10
Creating a character is easy. You can do it in one line. But first, let's look at the parameters.
15
11
16
-
*`obj_name` - This is the identifier that will be assigned to the character. It is not necessary, but it is recommended. If you do not provide one, the character will be assigned a sequenced identifier, (e.g. `char1`, `char2`, etc.)
17
-
*`name` - The name of the character. Will default to 'Unnamed' if not provided.
12
+
*`obj_name` - This is the identifier that will be assigned to the character. It is not necessary, but it is recommended. If you do not provide one, the character will be assigned a sequenced identifier, (e.g. `char1`, `char2`, etc.)
13
+
*`name` - The name of the character will default to 'Unnamed' if not provided.
18
14
*`role` - A string, representative of the character's role(traditionally referred to as 'class'). Will be randomly selected if not provided. The available roles are as follows:
19
15
* 'Barbarian'
20
16
* 'Bard'
@@ -38,7 +34,7 @@ Creating a character is easy. You can do it in one line. But first, let's look a
38
34
* 'Halfling'
39
35
* 'Human'
40
36
* 'Tiefling'
41
-
*`background` - A string, representative of the character's background. Will be randomly selected if not provided. The available backgrounds are as follows:
37
+
*`background` - A string, representative of the character's background. Will be randomly selected if not provided. The available backgrounds are as follows:
42
38
* 'Acolyte'
43
39
* 'Charlatan'
44
40
* 'Criminal'
@@ -52,7 +48,7 @@ Creating a character is easy. You can do it in one line. But first, let's look a
52
48
* 'Sailor'
53
49
* 'Soldier'
54
50
* 'Urchin'
55
-
*`alignment` - A string, representative of the character's alignment. Will be randomly selected if not provided. The available alignments are as follows:
51
+
*`alignment` - A string, representative of the character's alignment. Will be randomly selected if not provided. The available alignments are as follows:
56
52
* 'Lawful Good'
57
53
* 'Neutral Good'
58
54
* 'Chaotic Good'
@@ -67,7 +63,7 @@ Creating a character is easy. You can do it in one line. But first, let's look a
67
63
68
64
Depending on your shell, you may be able to use tab completion once you've created a character. If you're using a shell that doesn't support tab completion, you can use the `dir` function to see what attributes are available to you. Upon creating an a character instance, if you prepare a statement with the character's identifier, followed by a period, and then press tab, you will be presented with a list of attributes and methods available to you.
Some of the attributes you will see are dynamically generated based on the parameters(see above) you provided when creating the character. For example, if you created a character with the role of 'Bard', you will see the attribute `char1.Bard`. This dynamic attribute has a static counterpart, which is always available. For example, `char1.Bard`and`char1._Role` are the same attribute. The dynamic attributes are there for convenience.
83
+
84
+
## ca.character_bank
85
+
86
+
The character bank is a dictionary of all the characters you've created. You can access it directly, but it's recommended that you use the `ca.character_bank` attribute instead. The character bank is a dictionary of character instances, with the keys being the identifiers you assigned to them. For example, if you created a character with the identifier of 'char1', you can access it by calling `ca.character_bank.char1`. You can easily assign a character to a new variable using the usual syntax. For example, `char1 = ca.character_bank.char1`.
87
+
88
+
### ca.character_bank Example
89
+
90
+
```python
91
+
>>>import CharActor as ca
92
+
>>> ca.create() # Creates a character with the identifier 'char1'
93
+
>>>char1= ca.character_bank.char1
94
+
>>> char1.name
95
+
'Unnamed'
96
+
>>> char1.name ='Bob'
97
+
>>> char1.name
98
+
'Bob'
99
+
```
100
+
101
+
## Using CharActor with other modules
102
+
103
+
CharActor is designed to be used in conjunction with gridengine_framework, CharObj, CharTask,
0 commit comments