if 'took turn':
for object in objects:
object.clear()
return 'took turn'
elif 'cancelled':
return 'didnt-take-turn'
... as I found out that I have to explicitly add a temporary value with the stored returned value in order for it to do if-elif statements. So as an example:Code: [Select]if 'took turn':
for object in objects:
object.clear()
return 'took turn'
elif 'cancelled':
return 'didnt-take-turn'
...
temp = shoot_arrow()
if temp == 'took turn':
for object in objects:
object.clear()
return 'took turn'
elif temp == 'cancelled':
return 'didnt-take-turn'
if game_state == 'playing' and player_action != 'didnt-take-turn':
for object in objects:
if object.ai:
object.ai.take_turn()
if len(string) == 0:
...
if string:
...
if True:
...
while True:
...
while (x > 0 and x < 10):
...
Few questions:
1) Why does it matter if I have a bunch of white spaces?
2) Doesn't the compiler/interpreter skip over them, much like they ignore comments?
3) I do intend to completely rebuild the codebase, with all my listed design requirements, at a later date (probably before the game reaches beta state), so why put all the effort into addressing white space/extra tabs with throwaway code?
3) I do intend to completely rebuild the codebase, with all my listed design requirements, at a later date (probably before the game reaches beta state), so why put all the effort into addressing white space/extra tabs with throwaway code?
The code is written with 4 spaces, and is consistent throughout. Anytime I accidentally place a tab, it causes a syntax error.
There may be tabs in the blank white spaces or tabs in the #comments ...
if True:
operation()
|(<-blinking cursor)(whitespace)
operation2()
if True:
operation()|(<-blinking cursor)(whitespace)
operation2()
#This function advances the player to the next level. You will regain 50% of your maximum HP before entering the next area.
global dungeon_level, Attuned_Status, Activation_Timer, Difficulty_Level, Monsters_Spawned
message('You take a moment to rest, and recover your strength.', libtcod.light_violet)
player.fighter.hp = player.fighter.hp + (player.fighter.max_hp / 2)
player.fighter.ep = player.fighter.ep + (player.fighter.max_ep / 2)
if player.fighter.hp > player.fighter.max_hp and player.fighter.ep > player.fighter.max_ep: #both above maximums
player.fighter.hp = player.fighter.max_hp
player.fighter.ep = player.fighter.max_ep
elif player.fighter.hp > player.fighter.max_hp: #only hp over maximum
player.fighter.hp = player.fighter.max_hp
elif player.fighter.ep > player.fighter.max_ep: #only ep over maximum
player.fighter.ep = player.fighter.max_ep
if player.fighter.hp > player.fighter.max_hp:
player.fighter.hp = player.fighter.max_hp
if player.fighter.ep > player.fighter.max_ep:
player.fighter.ep = player.fighter.max_ep
player.fighter.hp += (player.fighter.max_hp / 2)
player.fighter.ep += (player.fighter.max_ep / 2)
Holy Hand GrenadeExcellent :D
So, you are probably wondering what is Plan B?It's a birth control pill ;)
Birth Control = An exterminatus for your vagina. Or is that an abortion?
Well, I tried 2015, 2012, and 2008, redistributable packages, all 64 bit, and they all spouted the same error, so dunno.
As far as I can tell, it is a limitation with the libtcod library. You need to use, what I think is a sprite sheet, with all the various characters and symbols off a font file (included file is the font size 12 file). Why it has such large spaces in some words, and other times have like no spaces, I'm not entirely sure why that is.
I'm still quite new to programming and development. You have like 10 years of experience on me; things that seem simple to you, are likely nearly impossible to me...
pathsToTry = []
# 1. Try the directory this script is located in.
pathsToTry.append(os.path.join(__path__[0], libname))
# 2. Try the directory of the command-line script.
scriptFilePath = sys.argv[0]
scriptPath = os.path.dirname(scriptFilePath)
if len(scriptPath):
pathsToTry.append(os.path.join(scriptPath, libname))
else:
pathsToTry.append(os.path.join(os.getcwd(), libname))
# 3. Try the environment variable LIBTCOD_DLL_PATH.
if "LIBTCOD_DLL_PATH" in os.environ:
envPaths = os.environ["LIBTCOD_DLL_PATH"].split(";")
for envPath in envPaths:
if os.path.exists(envPath):
pathsToTry.append(os.path.join(envPath, libname))
# 4. Try the top-level path in the development tree.
potentialTopLevelPath = os.path.realpath(os.path.join(__path__[0], os.pardir
, os.pardir))
pythonPath = os.path.join(potentialTopLevelPath, "python")
if os.path.exists(pythonPath):
pathsToTry.append(os.path.join(potentialTopLevelPath, libname))
In most games, the name of a character is irrelevant. Even in story driven games like Mass Effect, your name is irrelevant except for your last name, which is Shepard. The reason I mention that the name has no relevance is that all the previous choices HAVE relevance. Thus, the player can name their character as they so please, and have no concern for the consequences.
Well, that is why I suggest doing the interactive tutorial. It has almost fully phased out the old textual tutorial (which is found in the escape menu if someone ever wants to read it) and helps to teach most players the basics of gameplay so that they can play the game successfully. After implementing the interactive tutorial, the number of complaints from brand new players about not knowing what is going on, has greatly been reduced. So, I suggest you do the interactive tutorial; if it is not active, go to Options at the Main Menu, and activate it (I made it an option to disable it for returning players that didn't want to redo the tutorial). Mouse information appears on a line above your health bar, by the way.
List = [Monster, Item, Crate]
Index = libtcod.random_get_int(0, 0, (len(List) - 1)) #So chooses an index between 0 and length of the list - 1; first 0 is indicating the type of stream used... haven't messed with other streams yet.
Object = List[Index] #Get whatever object is stored at the index in the List
MonsterList = [Monster0, Monster1, ..., Monster99]
minIndex = Max(0, level - 10) # Allow monsters up to 10 levels below current level (clipped at 0)
maxIndex = level # Allow monsters up to current level
monster = MonsterList[libtcod.random_get_int(0, minIndex, maxIndex)]
Other things have been a priority lately, namely my sanity.Sounds like you've been play testing your own game too much. ;)
Index = 0
while Index < len(LIST_Objects):
Object = LIST_Objects[Index]
if Object.fighter:
if Object.fighter.Encounter_Type == 0:
Illusionary_Death(Object)
else:
Index += 1
else:
Index += 1
for object in reversed(LIST_Objects):
if object.fighter:
if object.fighter.Encounter_Type == 0:
Illusionary_Death(object)
if booleanExpression:
flag = True
else:
flag = False
flag = booleanExpression
def Exploit_Fear(obj):
if obj.fighter and obj.fighter.feared == True:
FearAdvantage = True
else:
FearAdvantage = False
return FearAdvantage
def Exploit_Fear(obj):
return obj.fighter and obj.fighter.feared
if len(List_Equip) > 0:
for Equipment in List_Equip:
for Equipment in List_Equip:
if Equipment.equipment.melee_damage_bonus > 0:
Melee_Damage += Equipment.equipment.melee_damage_bonus
Melee_Damage += Equipment.equipment.melee_damage_bonus
def Distance_To_Object(Me, You):
'''This function determines the distance between two objects and. makes negative values positive.
It then determines which value is higher, and returns that value to the calling function.'''
X_Value = Me.x - You.x
if X_Value < 0:
X_Value = X_Value * -1
Y_Value = Me.y - You.y
if Y_Value < 0:
Y_Value = Y_Value * -1
if X_Value > Y_Value:
return X_Value
else: #less than or equal.
return Y_Value
X_Value = -X_Value
if X_Value < 0:
X_Value = -X_Value
X_Value = abs(X_Value)
X_Value = abs(Me.x - You.x)
Y_Value = abs(Me.y - You.y)
if X_Value > Y_Value:
return X_Value
else: #less than or equal.
return Y_Value
return max([X_Value, Y_Value])
def Distance(obj1, obj2):
return max([abs(obj1.x - obj2.x), abs(obj1.y - obj2.y)])
obj1.position - obj2.position
# Not valid syntax
(obj1.position.x - obj2.position.x, obj1.position.y - obj2.position.y)
def Distance(obj1, obj2):
return (obj1.position - obj2.position).length
def Distance_To_Coordinates(Me, X, Y):
X_Value = Me.x - X
if X_Value < 0:
X_Value = X_Value * -1
Y_Value = Me.y - Y
if Y_Value < 0:
Y_Value = Y_Value * -1
if X_Value > Y_Value:
return X_Value
else: #less than or equal.
return Y_Value
LIST_Map = [[ Tile(True)
for y in range(MAP_HEIGHT) ]
for x in range(MAP_WIDTH) ]
LIST_Map[x][y].blocked #with .blocked a member variable of class Tile
cdq ; Sign extend eax into edx (convert double word to quad word) (edx becomes 0 if eax is positive, and -1 if eax was negative)
xor eax, edx ; (conditionally flip bits: eax is unchanged when edx is 0 (eax is positive), and flipped when edx is -1)
sub eax, edx ; (conditionally add 1: eax is unchanged when edx is 0 (eax is positive), and adds 1 when edx is -1)
LIST_Map[position.x][position.y].blocked
To be fair, not a whole lot has happened on the forums in the past few weeks. I think the gog release of Outpost 2 has put a damper on a lot of projects, as those projects relied on the old exposed code, and now have to be somehow updated to the new form.The mission development API is what it is, so there's no "new form" that anything needs to be updated to. If anyone wanted to change it, they'd need to have access to the OP2 source code, and then also access to the source code for all the base missions, since those would also need to be updated to work with any hypothetical new API.
LIST_Weapons_Recipes = [
Crafting_Recipe('Metallic', 100, 'Equipment', 'Longsword'),
Crafting_Recipe('Metallic', 100, 'Equipment', 'Waraxe'),
Crafting_Recipe('Metallic', 100, 'Equipment', 'Warhammer'),
Crafting_Recipe('Metallic', 100, 'Equipment', 'Glaive'),
Crafting_Recipe('Metallic', 200, 'Equipment', 'Greatsword'),
Crafting_Recipe('Metallic', 200, 'Equipment', 'Greataxe'),
Crafting_Recipe('Metallic', 200, 'Equipment', 'Greathammer'),
Crafting_Recipe('Metallic', 200, 'Equipment', 'Halberd'),
Crafting_Recipe('Metallic', 100, 'Equipment', 'Crossbow'),
Crafting_Recipe('Both', 50, 'Equipment', 'Dagger'),
Crafting_Recipe('Both', 100, 'Equipment', 'Spear'),
Crafting_Recipe('Both', 50, 'Equipment', 'Nailer'),
Crafting_Recipe('Both', 50, 'Equipment', 'Slugger'),
Crafting_Recipe('Both', 50, 'Equipment', 'Shotgun'),
Crafting_Recipe('Both', 50, 'Equipment', 'Slicer'),
Crafting_Recipe('Organic', 100, 'Equipment', 'Stick'),
Crafting_Recipe('Organic', 100, 'Equipment', 'Sling'),
Crafting_Recipe('Organic', 200, 'Equipment', 'Staff'),
Crafting_Recipe('Organic', 100, 'Equipment', 'Wand'),
Crafting_Recipe('Organic', 100, 'Equipment', 'Rod'),
Crafting_Recipe('Organic', 100, 'Equipment', 'Scepter'),
Crafting_Recipe('Organic', 100, 'Equipment', 'Ankh')
]
def Exploit_Fear(obj):
if obj.AI.Fear_Duration > 0:
FearAdvantage = True
else:
FearAdvantage = False
return FearAdvantage
def Exploit_Fear(obj):
FearAdvantage = obj.AI.Fear_Duration > 0
return FearAdvantage
def Exploit_Fear(obj):
return obj.AI.Fear_Duration > 0
if x_dist < 0:
x_dist = x_dist * -1
if y_dist < 0:
y_dist = y_dist * -1
if x_dist > y_dist:
Distance = x_dist
if x_dist < y_dist:
Distance = y_dist
if x_dist == y_dist:
Distance = x_dist
Distance = max(abs(x_dist), abs(y_dist))