Changing the Font in the Console & My First new game.

Just starting out? Need help? Post your questions and find answers here.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Changing the Font in the Console & My First new game.

Post by infratec »

Do you use EnableExplicit ?

Then you see if a variable is not defined.

But best practice is: don't use global variables.
Use a structure with all your needed stuff inside and use it as parameter for your procedures.

Also: avoid gotos

Example:

Code: Select all

If Hands_req = 2                         
  Enemy1_Lefthand = Enemy1_Righthand
Else
  If Enemy1_Lefthand = #Empty$
    Repeat
      Randomize_Enemy_Weapon_Selection()
    Until Hands_req = 1 And WPN_name <> #Empty$                 
    Set_Enemy_Weapons()
    PrintN(" ========================================================")
    PrintN(" Enemy #1 Category: > "+WPN_Catagory+" <  2nd Weapon: > "+WPN_name+" <")
    PrintN(" ========================================================")
    Display_Selected_Weapon()
    
    PrintN(" HANDS VALUE IS:"+Hands_req+"")
    Enemy1_Lefthand = WPN_name
  EndIf
EndIf
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

I am not using EnableExplicit since I have a lot of variables that start at either "0" or are blank strings. Many are just temporary storage for all the Random() results in my procedures.

Many thanks again, after your tweak the enemies are no longer receiving two handed weapons when they shouldn't. I could have easily wrote it like that but I must have fried my brain overthinking it...
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

I broke it again... I combined all the basics into one file for error checking the logic line by line. I noticed the cause of my lock up was the ELSE statement in my section for handling what weapon is selected after a category is picked. But now my code is failing to pass the "selected weapon" into the variables to contain the data. Which is odd because the only thing I changed other than adding more strict "And" statements to the weapon selection I changed the weapons ID's to constants. That way everytime I add a new item in the middle of the list I don't have to incriment all the weapons from 1 to 60. I instead just say hey there are 6 smallguns and they are 1 to 6 or how many rifles are there? There are 10 so pick from these 10 instead.

Part#1

Code: Select all

OpenConsole()
ConsoleTitle ("THE BATTLE ENGINE")      ; Title of application.                                            
EnableGraphicalConsole(1)               ; Enable Graphical Consoles.
ConsoleColor(7, 0)                      ; Console Color.



;------------------------------
Global EnemyForce = 0                ; This is the cotainer for what Enemy character type is selected during the dice roll. Had to make it global so Enemy_Randomize_Weapon_Selection() could see it.
;------------------------------
; :: ENEMY FORCES ID LABEL   ::      This is for the "EnemyForces" roll and the Enemy_Randomize_Weapon_Selection() to make it easier to read code wise and limit certain enemy types from recieving all weapons within an allowed weapon catagory.
;------------------------------
#Lone_Bandit=1
Global MaxEnemies = 1                   ; This number should always = the highest enemy monster ID label.

Global Eamt_max.i = 20                  ; This is used to calculate the maximum number of enemies in the dice roll.
Global Eamt_min.i = 1                   ; This is used to calculate the minumum number of enemies in the dice roll.
Global Enemy_Max_init.i = 100           ; This determines an enemies maximum initiative roll. You only have to roll higher than the enemy to win this check to see who goes first.
Global Player_Max_init.i = 100          ; The Players maximum intiative. Items can raise this, but damage and disease can lower this skill.
Global EnemyTitle.s =#Empty$            ; The Enemy Name.
Global Enem_desc_line1.s =#Empty$       ; Short description of enemy.
Global Enem_desc_line2.s =#Empty$       ; Additonal description...
Global Enem_desc_line3.s =#Empty$       ; Additonal description...

; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; THE WEAPON VARIABLES
; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Global WPN_Selected.i=#False   ;What weapon is selected.
Global WPN_Category.s=#Empty$  ;Unarmed / Armed / Thrown / Bite / Small Guns / Shotguns / Rifles / Assault Rifles / Machine Guns / Heavy Weapons / Energy Weapons / Explosive Weapons
Global WPN_name.s=#Empty$      ;Name of the weapon.
Global WPN_desc.s=#Empty$      ;Short description of the weapon.
Global Atk_Variety.i=#False    ;How many types of attacks can the weapon do? Example: Knives have Stabbing & Slashing attacks.
Global Damage_type1.s=#Empty$  ;Blunt/Piercing/Slashing/Kinetic/Energy/Fire/Explosive/Eletrical
Global Damage_type2.s=#Empty$  ;Blunt/Piercing/Slashing/Kinetic/Energy/Fire/Explosive/Eletrical
Global Damage_Mx.i=#False      ;This shows the max damage caused by a single attack of your weapon.
Global Damage_Mn.i=#False      ;This shows the max damage caused by a single attack of your weapon.
Global APcost.i=#False         ;How many Action Point does it cost to use per turn?
Global WPNRange.i=#False       ;Maximum reached distance of ranged fire.
Global ThrwWPNRange.i=#False   ;Maximum range of thrown weapon. This can be augmented by Strength and higher Skill Traits.
Global Min_ST.i=#False         ;Strength required to wield the weapon optimally.
Global Ammunition.s=#Empty$    ;The type of ammunition used by the weapon.
Global Hands_req.i=#False      ;Hands required to wield the weapon.
Global Magazine_Size.i=#False  ;The magazine capacity of the firearm. Basically, how many shots you can fire before having to reload.
Global Value.i=#False          ;The value of the weapon in the games currency.
Global Item_lb.i=#False        ;The weight of item.

;******************************
; Weapon ID               START
;******************************


;------------------------------
;Unarmed Basic Attacks
;------------------------------
#Bite=1           ;piercing damage
#Claw=2           ;slashing damage
#Fists=3          ;blunt damage
#Kick=4           ;blunt damage
;------------------------------
;Unarmed Skilled Attacks
;------------------------------
#FistJab=5
#FistUppercut=6
#FistHaymaker=7
#SupermanPunch=8
#Frontkick=9
#RoundhouseKick=10
#Axekick=11
;------------------------------
;Bladed Weapons ; ARMED
;------------------------------
#SmallKnife=1
#CombatKnife=2
#Wakizashi=3
#Katana=4
#Axe=5
;------------------------------
;Blunt Weapons
;------------------------------
#Wrench=6
#Crowbar=7
#BaseballBat=8
#Club=9
#SledgeHammer=10
#WoodStaff=11
#Brassknuckles=12
#SpikedBrassKnuckles=13
#CattleProd=14 
;----------------------------------------------------------------------------- THROWN WEAPONS
#Tomahawk=1               
#CombatTomahawk=2       
#SharpenedPole=3
#CrudeSpear=4
#FineSpear=5
;----------------------------------------------------------------------------- THROWN WEAPONS



;------------------------------
;Pistols
;------------------------------
#CrudePipePistol=1      
#Revolver=2
#RareRevolver=3
#BerretaM9Pistol=4

;------------------------------
;Shotguns
;------------------------------
#CrudePipeShotgun=1
#Blunderbuss=2
#WornSawedoffShotgun=3
#SawedoffShotgun=4
#Shotgun=5
#CombatShotgun=6
#PancorJackhammer=7


;------------------------------
;Rifles
;------------------------------
#HomeMadeRifle=1
#BoltActionRifle=2

;------------------------------
;Assault Rifles
;------------------------------
#M16=1
;------------------------------
;Machine Guns
;------------------------------
#M60=2

;------------------------------
;Heavy Weapons
;------------------------------
#ImprovisedFlameThrower=1
#M9A17FlameThrower=2

;------------------------------
;Energy Weapons
;------------------------------
#LaserPistol=1
#LaserRifle=2
#EnhancedLaserPistol=3
#EnhancedLaserRifle=4
#PhasedPlasmaPulseGun40Watt=5
#PhasedPlasmaPulseGun80Watt=6
#PhasedPlasmaPulseGun100Watt=7
#PhasedPlasmaPulseGun200Watt=8


;------------------------------
;Explosives
;------------------------------
#MolotovCocktail=1
#ConcussionGrenade=2        ;high chance to STUN enemies.
#FragGrenade=3
#Dyamite=4
#TNTbundle=5

;******************************
; Weapon ID                 END
;******************************


;------------------------------------------------------------------------------------------------------------------------------
; This is used for Randomizing the weapon selection for the ENEMIES. It provides the integer for the DICE ROLL.
; See Randomize_Enemy_Weapon_Selection()  procedure in the BATTLE ENGINE.
;------------------------------------------------------------------------------------------------------------------------------
Global Selected_Category.i = 0
#creaturebite=1
#creatureclaws=2
#unarmed=3
#armed=4
#thrown=5
#smallguns=6
#shotguns=7
#rifles=8
#assault_rifles=9
#machineguns=10
#heavyweapons=11
#energyweapons=12
#explosiveweapons=13

;------------------------------
; :: ENEMY SELECTED WEAPONS ::
;------------------------------
Global Enemy1_Righthand.s=#Empty$
Global Enemy1_Lefthand.s=#Empty$

Global Enemy2_Righthand.s=#Empty$
Global Enemy2_Lefthand.s=#Empty$

;------------------------------------------------------------------------------------------------------------------------------
; This is the switch for Enemies in order for them to use weapons within the specified category
;------------------------------------------------------------------------------------------------------------------------------
Global Enemy_CanUse_bite = #False
Global Enemy_CanUse_claws = #False
Global Enemy_CanUse_unarmed = #False
Global Enemy_CanUse_armed = #False
Global Enemy_CanUse_thrown = #False
Global Enemy_CanUse_smallguns = #False
Global Enemy_CanUse_shotguns = #False
Global Enemy_CanUse_rifles = #False
Global Enemy_CanUse_assault_rifles = #False
Global Enemy_CanUse_machineguns = #False
Global Enemy_CanUse_heavyweapons = #False
Global Enemy_CanUse_energyweapons = #False
Global Enemy_CanUse_explosiveweapons = #False


; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; THESE ENTRIES ARE IN PROCEDURES FILE
; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Global DisplayClearingB = #False        ; If true it shows the values being cleared in the BATTLE ENGINE. Related to 'Procedures.pb' Clear_Battlefield()
Global Display_non_created_EM = #False  ; If true it shows a message for what enemies havent been created. The maximum is 20.
Global Display_pos_EM_Artibutes = #False; If true it shows the possible attribute value range for a the selected enemy type. The attribute range of each enemy type and amount is randomized.
Global LoopCounter.i = 0                ; This is used to check a Goto loop. If it runs more than 1000 times then display ERROR and totally restart the loop. Check the logic to why this is happening!
                                        ; -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Procedure AttributeRange_Enemy_LoneBandit()
  ;---------------------------------------- 
  ; HEALTH
  Enemy_Max_Health_diceroll.i = 100
  Enemy_Min_Health_diceroll.i = 50
  ;----------------------------------------
  ; STRENGTH
  Enemy_Max_STR_diceroll.i = 15
  Enemy_Min_STR_diceroll.i = 5
  ;----------------------------------------
  ; AGILITY
  Enemy_Max_AGI_diceroll.i = 10
  Enemy_Min_AGI_diceroll.i = 2
  ;----------------------------------------
  ; ENDURANCE
  Enemy_Max_EDU_diceroll.i = 10
  Enemy_Min_EDU_diceroll.i = 4
  ;----------------------------------------
  ; CHARISMA
  Enemy_Max_CHR_diceroll.i = 8
  Enemy_Min_CHR_diceroll.i = 1
  ;----------------------------------------
  ; INTELIGENCE
  Enemy_Max_INT_diceroll.i = 7
  Enemy_Min_INT_diceroll.i = 1
  ;---------------------------------------- 
EndProcedure


; Weapon Inventory List.
Procedure Weapon_Lookup()
  Select_Weapon:
  ;ClearConsole()
  If WPN_Selected = #Fists And WPN_Catagory = #unarmed And Enemy_CanUse_unarmed = #True  ; BIG FIX!!! Without the extra logic the code is seeing any 1 it encounters as a fist instead of seeing what catagory is selected.
  WPN_name      ="Fists"                              ;Name of the weapon.
  WPN_desc      ="Your bare hands."                   ;Short description of the weapon.
  Atk_Variety   = 1                                   ;How many types of attacks can the weapon do? Example: Knives have Stabbing & Slashing attacks.
  Damage_type1  ="Blunt"                              ;Blunt/Penetration/Slashing/kinetic/Energy/Fire/Explosive
  Damage_type2  = #Empty$                             ;Blunt/Penetration/Slashing/kinetic/Energy/Fire/Explosive
  Damage_Mx     = 5                                   ;This shows the max damage caused by a single attack of your weapon.
  Damage_Mn     = 1                                   ;This shows the min damage caused by a single attack of your weapon.
  APcost        = 0                                   ;How many Action Point does it cost to use per turn?
  WPNRange      = 3                                   ;Maximum reached distance of attack in FT(feet).
  ThrwWPNRange  = 0                                   ;Maximum range of thrown weapon. This can be augmented by Strength and higher Skill Traits.
  Min_ST        = 1                                   ;Strength required to wield the weapon optimally.
  Ammunition    = #Empty$                             ;The type of ammunition used by the weapon.
  Hands_req     = 1                                   ;Hands required to wield the weapon.
  Magazine_Size = 0                                   ;The magazine capacity of the firearm. Basically, how many shots you can fire before having to reload.
  Value         = 0                                   ;The value of the weapon in the games currency.
  Item_lb       = 0                                   ;The weight of item.
  ;--------------------------------------------------------------------------------------------------------------------------------
  ; The level of damage from a bite is calculated by using STR as a variable.
  ElseIf WPN_Selected = #Bite And WPN_Catagory = #creaturebite And Enemy_CanUse_bite = #True 
  WPN_name      ="Bite"
  WPN_desc      ="A close quarters biting attack."
  Atk_Variety   = 1
  Damage_type1  ="Piercing"
  Damage_type2  = #Empty$
  Damage_Mx     = 10
  Damage_Mn     = 1
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 0
  Item_lb       = 0
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Claw And WPN_Catagory = #creatureclaws And Enemy_CanUse_claws = #True
  WPN_name      ="Claws"
  WPN_desc      ="A close range swipe."
  Atk_Variety   = 1
  Damage_type1  ="Piercing"
  Damage_type2  = #Empty$
  Damage_Mx     = 12
  Damage_Mn     = 3
  APcost        = 1
  WPNRange      = 3
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 0
  Item_lb       = 0
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #SmallKnife And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Small Knife"
  WPN_desc      ="A close quarter knife."
  Atk_Variety   = 1
  Damage_type1  ="Slashing"
  Damage_type2  ="Piercing"
  Damage_Mx     = 8
  Damage_Mn     = 3
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 0
  Min_ST        = 0
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 1
  Item_lb       = 1
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CombatKnife And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Combat Knife"
  WPN_desc      ="A very sharp military grade knife."
  Atk_Variety   = 2
  Damage_type1  ="Slashing"
  Damage_type2  ="Piercing"
  Damage_Mx     = 15
  Damage_Mn     = 5
  APcost        = 2
  WPNRange      = 1
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 15
  Item_lb       = 1
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Wakizashi And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Wakizashi"
  WPN_desc      ="A nicely balanced Japanese short sword."
  Atk_Variety   = 2
  Damage_type1  ="Slashing"
  Damage_type2  ="Piercing"
  Damage_Mx     = 18
  Damage_Mn     = 8
  APcost        = 2
  WPNRange      = 2
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 35
  Item_lb       = 2
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Katana And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Katana"
  WPN_desc      =" A samurai side arm featuring an exremely sharp and lightweight blade."
  Atk_Variety   = 2
  Damage_type1  ="Slashing"
  Damage_type2  ="Piercing"
  Damage_Mx     = 25
  Damage_Mn     = 8
  APcost        = 2
  WPNRange      = 3
  ThrwWPNRange  = 0
  Min_ST        = 2
  Ammunition    = #Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 55
  Item_lb       = 2
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Axe And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Axe"
  WPN_desc      ="A useful tool for chopping through wood and bones."
  Atk_Variety   = 2
  Damage_type1  ="Slashing"
  Damage_type2  ="Blunt"
  Damage_Mx     = 20
  Damage_Mn     = 12
  APcost        = 4
  WPNRange      = 6
  ThrwWPNRange  = 40
  Min_ST        = 6
  Ammunition    = #Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 20
  Item_lb       = 8
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Tomahawk And WPN_Catagory = #thrown And Enemy_CanUse_thrown = #True
  WPN_name      ="Tomahawk"
  WPN_desc      ="A light weight tool, close range and thrown weapon."
  Atk_Variety   = 1
  Damage_type1  ="Slashing"
  Damage_type2  = #Empty$
  Damage_Mx     = 10
  Damage_Mn     = 5
  APcost        = 1
  WPNRange      = 3
  ThrwWPNRange  = 30
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 8
  Item_lb       = 1
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CombatTomahawk And WPN_Catagory = #thrown And Enemy_CanUse_thrown = #True
  WPN_name      ="CombatTomahawk"
  WPN_desc      ="A professionaly made, close range and thrown weapon."
  Atk_Variety   = 1
  Damage_type1  ="Slashing"
  Damage_type2  = #Empty$
  Damage_Mx     = 15
  Damage_Mn     = 8
  APcost        = 1
  WPNRange      = 3
  ThrwWPNRange  = 40
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 20
  Item_lb       = 1
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #SharpenedPole And WPN_Catagory = #thrown And Enemy_CanUse_thrown = #True
  WPN_name      ="Sharpened Pole"
  WPN_desc      ="A long piece of wood with the end sharpened to a point. A make shift spear."
  Atk_Variety   = 1
  Damage_type1  ="Piercing"
  Damage_type2  = #Empty$
  Damage_Mx     = 15
  Damage_Mn     = 1
  APcost        = 2
  WPNRange      = 6
  ThrwWPNRange  = 40
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 5
  Item_lb       = 3
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CrudeSpear And WPN_Catagory = #thrown And Enemy_CanUse_thrown = #True
  WPN_name      ="Crude Spear"
  WPN_desc      ="A long piece of wood with sharpened metal tip. A basic hunting spear."
  Atk_Variety   = 1
  Damage_type1  ="Piercing"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 5
  APcost        = 2
  WPNRange      = 6
  ThrwWPNRange  = 60
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 5
  Item_lb       = 4
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #FineSpear And WPN_Catagory = #thrown And Enemy_CanUse_thrown = #True
  WPN_name      ="Fine Spear"
  WPN_desc      ="A high quality spear with a very sharp tip."
  Atk_Variety   = 1
  Damage_type1  ="Piercing"
  Damage_type2  = #Empty$
  Damage_Mx     = 20
  Damage_Mn     = 10
  APcost        = 2
  WPNRange      = 6
  ThrwWPNRange  = 60
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 5
  Item_lb       = 4
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Wrench And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Wrench"
  WPN_desc      ="A tool for fixing things or bashing in heads?"
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 10
  Damage_Mn     = 5
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 20
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 8
  Item_lb       = 5
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Crowbar And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Crowbar"
  WPN_desc      ="A versatile tool for getting into things and makeshift club."
  Atk_Variety   = 2
  Damage_type1  ="Blunt"
  Damage_type2  ="Piercing"
  Damage_Mx     = 18
  Damage_Mn     = 8
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 20
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 15
  Item_lb       = 3
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #BaseballBat And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Baseball Bat"
  WPN_desc      ="A nice club for slugging your foes."
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 15
  Damage_Mn     = 5
  APcost        = 2
  WPNRange      = 3
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 12
  Item_lb       = 3
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Club And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Police Baton"
  WPN_desc      ="A great crowd control weapon."
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 8
  APcost        = 1
  WPNRange      = 2
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 20
  Item_lb       = 4
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #SledgeHammer And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="SledgeHammer"
  WPN_desc      ="For when you like to bash things like Thor."
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 25
  Damage_Mn     = 10
  APcost        = 4
  WPNRange      = 3
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 20
  Item_lb       = 4
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #WoodStaff And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Wood Staff"
  WPN_desc      ="A long stick made of hard wood."
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 15
  Damage_Mn     = 1
  APcost        = 1
  WPNRange      = 5
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 2
  Magazine_Size = 0
  Value         = 5
  Item_lb       = 2
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Brassknuckles And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Brass Knuckles"
  WPN_desc      ="Brass in the shape of fists."
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 15
  Damage_Mn     = 3
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 10
  Item_lb       = 1
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #SpikedBrassKnuckles And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Spiked Knuckle Dusters"
  WPN_desc      ="Spiked Brass in the shape of fists."
  Atk_Variety   = 1
  Damage_type1  ="Blunt"
  Damage_type2  = #Empty$
  Damage_Mx     = 20
  Damage_Mn     = 3
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 25
  Item_lb       = 1
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CattleProd And WPN_Catagory = #armed And Enemy_CanUse_armed = #True
  WPN_name      ="Cattleprod"
  WPN_desc      ="A farmers tool to guide livestock. Also works great on people."
  Atk_Variety   = 2
  Damage_type1  ="Blunt"
  Damage_type2  ="Electrical"
  Damage_Mx     = 5
  Damage_Mn     = 10
  APcost        = 1
  WPNRange      = 3
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    =#Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 150
  Item_lb       = 3
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CrudePipePistol And WPN_Catagory = #smallguns And Enemy_CanUse_smallguns = #True
  WPN_name      ="Pipe Pistol"
  WPN_desc      ="An improvised homemade single shot pistol."
  Atk_Variety   = 2
  Damage_type1  ="Blunt"
  Damage_type2  ="Electrical"
  Damage_Mx     = 20
  Damage_Mn     = 10
  APcost        = 1
  WPNRange      = 60
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="bullets"
  Hands_req     = 1
  Magazine_Size = 1
  Value         = 30
  Item_lb       = 3
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CrudePipePistol And WPN_Catagory = #smallguns And Enemy_CanUse_smallguns = #True
  WPN_name      ="Pipe Pistol"
  WPN_desc      ="An improvised homemade single shot pistol."
  Atk_Variety   = 2
  Damage_type1  ="Blunt"
  Damage_type2  ="Electrical"
  Damage_Mx     = 20
  Damage_Mn     = 10
  APcost        = 1
  WPNRange      = 60
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="bullets"
  Hands_req     = 1
  Magazine_Size = 1
  Value         = 30
  Item_lb       = 3
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Revolver And WPN_Catagory = #smallguns And Enemy_CanUse_smallguns = #True
  WPN_name      ="Revolver"
  WPN_desc      ="A very old and worn small resovler."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 10
  APcost        = 2
  WPNRange      = 60
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="bullets"
  Hands_req     = 1
  Magazine_Size = 6
  Value         = 15
  Item_lb       = 2
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #RareRevolver And WPN_Catagory = #smallguns And Enemy_CanUse_smallguns = #True
  WPN_name      ="Fancy Revolver"
  WPN_desc      ="A rare 8 shot revolver with a ivory handle."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 10
  APcost        = 2
  WPNRange      = 60
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="bullets"
  Hands_req     = 1
  Magazine_Size = 8
  Value         = 45
  Item_lb       = 2
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #BerretaM9Pistol And WPN_Catagory = #smallguns And Enemy_CanUse_smallguns = #True
  WPN_name      ="Berreta M9"
  WPN_desc      ="A reliable military grade pistol. It uses 9mm rounds."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 10
  APcost        = 2
  WPNRange      = 165
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="bullets"
  Hands_req     = 1
  Magazine_Size = 15
  Value         = 100
  Item_lb       = 2
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CrudePipeShotgun And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Pipe Shotgun"
  WPN_desc      ="An improvised homemade shotgun."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 10
  APcost        = 2
  WPNRange      = 165
  ThrwWPNRange  = 0
  Min_ST        = 2
  Ammunition    ="slugs"
  Hands_req     = 2
  Magazine_Size = 1
  Value         = 20
  Item_lb       = 8
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Blunderbuss And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Blunderbuss"
  WPN_desc      ="A large hand canon capable of firing a variety of projectiles."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 30
  Damage_Mn     = 5
  APcost        = 6
  WPNRange      = 30
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="buckshot"
  Hands_req     = 2
  Magazine_Size = 1
  Value         = 180
  Item_lb       = 12
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #WornSawedoffShotgun And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Worn Sawedoff Shotgun"
  WPN_desc      ="A heavily used shotgun. Its been modified to be fired with one hand.";This weapons has 50% chance of mis-firing.
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 30
  Damage_Mn     = 10
  APcost        = 4
  WPNRange      = 30
  ThrwWPNRange  = 0
  Min_ST        = 3
  Ammunition    ="buckshot"
  Hands_req     = 1
  Magazine_Size = 2
  Value         = 35
  Item_lb       = 5
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #SawedoffShotgun And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Sawedoff Shotgun"
  WPN_desc      ="A modified shotgun to be fired with one hand."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 40
  Damage_Mn     = 10
  APcost        = 3
  WPNRange      = 30
  ThrwWPNRange  = 0
  Min_ST        = 3
  Ammunition    ="buckshot"
  Hands_req     = 1
  Magazine_Size = 2
  Value         = 45
  Item_lb       = 5
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #Shotgun And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Shotgun"
  WPN_desc      ="A shotgun that is effectice at close range"
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 30
  Damage_Mn     = 10
  APcost        = 3
  WPNRange      = 60
  ThrwWPNRange  = 0
  Min_ST        = 3
  Ammunition    ="buckshot"
  Hands_req     = 2
  Magazine_Size = 2
  Value         = 55
  Item_lb       = 7
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #CombatShotgun And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Combat Shotgun"
  WPN_desc      ="A military grade with a variety of features."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 35
  Damage_Mn     = 12
  APcost        = 3
  WPNRange      = 70
  ThrwWPNRange  = 0
  Min_ST        = 3
  Ammunition    ="slugs"
  Hands_req     = 2
  Magazine_Size = 8
  Value         = 135
  Item_lb       = 6
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #PancorJackhammer And WPN_Catagory = #shotguns And Enemy_CanUse_shotguns = #True
  WPN_name      ="Pancor Jackhammer"
  WPN_desc      ="A rare prototype shotgun."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 35
  Damage_Mn     = 20
  APcost        = 3
  WPNRange      = 100
  ThrwWPNRange  = 0
  Min_ST        = 3
  Ammunition    ="slugs"
  Hands_req     = 2
  Magazine_Size = 10
  Value         = 500
  Item_lb       = 6
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #HomeMadeRifle And WPN_Catagory = #rifles And Enemy_CanUse_rifles = #True
  WPN_name      ="Crude Rifle"
  WPN_desc      ="A crude home-made rifle."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 20
  Damage_Mn     = 1
  APcost        = 3
  WPNRange      = 150
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="7.62mm"
  Hands_req     = 2
  Magazine_Size = 1
  Value         = 30
  Item_lb       = 8
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #BoltActionRifle And WPN_Catagory = #rifles And Enemy_CanUse_rifles = #True
  WPN_name      ="Bolt Action Rifle"
  WPN_desc      ="A fine crafted bolt action rifle. Most likely used for hunting."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 30
  Damage_Mn     = 10
  APcost        = 3
  WPNRange      = 400
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="7.62mm"
  Hands_req     = 2
  Magazine_Size = 1
  Value         = 30
  Item_lb       = 8
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #M16 And WPN_Catagory = #assault_rifles And Enemy_CanUse_assault_rifles = #True
  WPN_name      ="M16"
  WPN_desc      ="A stanard issue US military battle rifle."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 30
  Damage_Mn     = 10
  APcost        = 3
  WPNRange      = 1800
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="5.56mm"
  Hands_req     = 2
  Magazine_Size = 20
  Value         = 500
  Item_lb       = 8
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #M60 And WPN_Catagory = #machineguns And Enemy_CanUse_machineguns = #True
  WPN_name      ="M60"
  WPN_desc      ="It's a real pig but it can hurl a ton of heavy rounds toward the enemy."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 45
  Damage_Mn     = 30
  APcost        = 3
  WPNRange      = 3600
  ThrwWPNRange  = 0
  Min_ST        = 8
  Ammunition    ="7.62 mm"
  Hands_req     = 2
  Magazine_Size = 200
  Value         = 1000
  Item_lb       = 20
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #ImprovisedFlameThrower And WPN_Catagory = #heavyweapons And Enemy_CanUse_heavyweapons = #True
  WPN_name      ="Crude Flamethrower"
  WPN_desc      ="A home made mini-napalm cooker."
  Atk_Variety   = 1
  Damage_type1  ="Fire"
  Damage_type2  = #Empty$
  Damage_Mx     = 30
  Damage_Mn     = 20
  APcost        = 3
  WPNRange      = 50
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="Fuel"
  Hands_req     = 2
  Magazine_Size = 4
  Value         = 130
  Item_lb       = 25
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #M9A17FlameThrower And WPN_Catagory = #heavyweapons And Enemy_CanUse_heavyweapons = #True
  WPN_name      ="M9A1-7 Flamethrower"
  WPN_desc      ="A military grade flame thrower. Roast your enemies!"
  Atk_Variety   = 1
  Damage_type1  ="Fire"
  Damage_type2  = #Empty$
  Damage_Mx     = 50
  Damage_Mn     = 20
  APcost        = 3
  WPNRange      = 80
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="Fuel"
  Hands_req     = 2
  Magazine_Size = 8
  Value         = 130
  Item_lb       = 20
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #LaserPistol And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Laser Pistol"
  WPN_desc      ="A experimnetal laser pistol."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 50
  Damage_Mn     = 10
  APcost        = 8
  WPNRange      = 500
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="Cell"
  Hands_req     = 1
  Magazine_Size = 15
  Value         = 1500
  Item_lb       = 5
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #LaserRifle And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Laser Rifle"
  WPN_desc      ="A experimnetal laser rifle."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 50
  Damage_Mn     = 10
  APcost        = 8
  WPNRange      = 1000
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="Cell"
  Hands_req     = 2
  Magazine_Size = 30
  Value         = 3500
  Item_lb       = 8
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #EnhancedLaserPistol And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Laser Pistol MK2"
  WPN_desc      ="A heavily modified experimnetal laser pistol with eletronic scope."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 50
  Damage_Mn     = 20
  APcost        = 5
  WPNRange      = 1000
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="Cell"
  Hands_req     = 1
  Magazine_Size = 20
  Value         = 4500
  Item_lb       = 6
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #EnhancedLaserRifle And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Laser Rifle MK2"
  WPN_desc      ="A heavily modified experimnetal laser rifle with eletronic scope."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 60
  Damage_Mn     = 25
  APcost        = 6
  WPNRange      = 2000
  ThrwWPNRange  = 0
  Min_ST        = 5
  Ammunition    ="Cell"
  Hands_req     = 2
  Magazine_Size = 50
  Value         = 6500
  Item_lb       = 10
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #PhasedPlasmaPulseGun40Watt And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Phased Plasma Rifle 40W"
  WPN_desc      ="A phased Plasma Rifle in 40 Watt range."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 100
  Damage_Mn     = 50
  APcost        = 5
  WPNRange      = 3000
  ThrwWPNRange  = 0
  Min_ST        = 6
  Ammunition    ="Fusion Cell"
  Hands_req     = 2
  Magazine_Size = 30
  Value         = 8500
  Item_lb       = 15
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #PhasedPlasmaPulseGun80Watt And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Phased Plasma Rifle 80W"
  WPN_desc      ="A phased Plasma Rifle in 80 Watt range."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 120
  Damage_Mn     = 60
  APcost        = 5
  WPNRange      = 3500
  ThrwWPNRange  = 0
  Min_ST        = 6
  Ammunition    ="Fusion Cell"
  Hands_req     = 2
  Magazine_Size = 30
  Value         = 8500
  Item_lb       = 15
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #PhasedPlasmaPulseGun100Watt And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Phased Plasma Rifle 100W"
  WPN_desc      ="A phased Plasma Rifle in 100 Watt range. The barel length is extended to help with cooling."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 150
  Damage_Mn     = 80
  APcost        = 5
  WPNRange      = 3800
  ThrwWPNRange  = 0
  Min_ST        = 8
  Ammunition    ="Fusion Cell"
  Hands_req     = 2
  Magazine_Size = 30
  Value         = 12000
  Item_lb       = 20
  ;--------------------------------------------------------------------------------------------------------------------------------
  ElseIf WPN_Selected = #PhasedPlasmaPulseGun200Watt And WPN_Catagory = #energyweapons And Enemy_CanUse_energyweapons = #True
  WPN_name      ="Phased Plasma Rifle 200W"
  WPN_desc      ="A phased Plasma Rifle boosted to 200 Watt output with a very large heatsink below the main barel. The words B.F.G. are eetched into the side of the stock."
  Atk_Variety   = 1
  Damage_type1  ="Energy"
  Damage_type2  = #Empty$
  Damage_Mx     = 300
  Damage_Mn     = 100
  APcost        = 5
  WPNRange      = 5000
  ThrwWPNRange  = 0
  Min_ST        = 8
  Ammunition    ="Fusion Cell"
  Hands_req     = 2
  Magazine_Size = 20
  Value         = 35000
  Item_lb       = 30
  ;--------------------------------------------------------------------------------------------------------------------------------
  ;Else                              <--- PROGRAM IS GETTING TRIPPED UP HERE ON THE ELSE!
    ;ClearWeaponData()                <--- move up up above with other procedures otherwise cant call the code until its defined!!!
    ;WPN_Selected = 0                 <--- THINK THIS WAS THE CAUSE OF THE ROUNTINE FREEZING!!!! ARGH!!!!
    ;WPN_Category = #Empty$
    ;WPN_name      =#Empty$
    ;WPN_desc      =#Empty$
    ;Atk_Variety   =0
    ;Damage_type1  =#Empty$
    ;Damage_type2  =#Empty$
    ;Damage_Mx     =0
    ;Damage_Mn     =0
    ;APcost        =0
    ;WPNRange      =0
    ;ThrwWPNRange  =0
    ;Min_ST        =0
    ;Ammunition    =#Empty$
    ;Hands_req     =0
    ;Magazine_Size =0
    ;Value         =0
    ;Item_lb       =0 
    ;Input()
     PrintN(" Made it to the ELSE of WeaponLookup().")  ; <--- PROGRAM IS GETTING TRIPPED UP HERE ON THE ELSE!
    Goto Select_Weapon
  EndIf
  PrintN(" At the end of WeaponLookup().")
  ;Input()
  EndProcedure

Last edited by Vernostonos on Mon Jul 27, 2020 4:33 pm, edited 1 time in total.
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

Part#2 please combine it with the above code.
When you run it you will see that it randomly picks a category and weapon based upon the enemy selected. Which in this case is the "Lone Bandit". I took out all the other types for testing. Please hit "Z" and enter to restart the sequence.

Code: Select all

; What weapon was selected and show description.
Procedure Display_Selected_Weapon()
    PrintN(" Weapon name: "+WPN_name+"")
    PrintN(" Description: "+WPN_desc+"")
    PrintN(" Attack variety: "+Atk_Variety+"")
    PrintN(" Damage type 1: "+Damage_type1+"")
    
    If Damage_type2 <> #Empty$
    PrintN(" Damage type 2: "+Damage_type2+"")
    EndIf
    
    PrintN(" Max damage: "+Damage_Mx+"")
    PrintN(" Min damage: "+Damage_Mn+"")
    PrintN(" AP cost:"+APcost+"")
    PrintN(" Weapon Range: "+WPNRange+" ft")
    
    If ThrwWPNRange <> 0
    PrintN(" Thrown Range:"+ThrwWPNRange+"ft")
    EndIf
    
    PrintN(" Min STR needed: "+Min_ST+"")
    If Ammunition <> ""
      PrintN(" Ammunition: "+Ammunition+"")
    EndIf

    If Hands_req <> 0
    PrintN(" Hands required: "+Hands_req+"")
    EndIf

    If Magazine_Size <> 0
    PrintN(" Magazine size: "+Magazine_Size+"")
    EndIf

    If Value <> 0
    PrintN(" Item value: "+Value+"")
    EndIf

    If Item_lb <> 0
    PrintN(" Item weight: "+Item_lb+" lbs")
  EndIf
  
  EndProcedure 




; Randomize selected Category.
Procedure Randomize_Enemy_Weapon_WPN_Category()
PrintN(" *Randomizing Category Selection*")
  RandomEMweapon:
  ;Result = 0
  ;WPN_Selected = #False
  ;-----------------------------------------------
  ;Pick a catagory
  ;-----------------------------------------------
  Result = Random(12,1)     ; change 12 to 13 later - have no explosive users yet!
  
  If Result = #creaturebite And Enemy_CanUse_bite = #True
    WPN_Category = "Creature Bite"
    Selected_Category = #creaturebite
    
  ElseIf Result = #creatureclaws And Enemy_CanUse_claws = #True
    WPN_Category = "Creature Claws"
    Selected_Category = #creatureclaws
    
  ElseIf Result = #unarmed And Enemy_CanUse_unarmed = #True
    WPN_Category = "Unarmed"
    Selected_Category = #unarmed
    
  ElseIf Result = #armed And Enemy_CanUse_armed = #True
    WPN_Category = "Armed"
    Selected_Category = #armed
    
  ElseIf Result = #thrown And Enemy_CanUse_thrown = #True
    WPN_Category = "Thrown"
    Selected_Category = #thrown
    
  ElseIf Result = #smallguns And Enemy_CanUse_smallguns = #True
    WPN_Category = "Smallguns"
    Selected_Category = #smallguns
    
  ElseIf Result = #shotguns And Enemy_CanUse_shotguns = #True
    WPN_Category = "Shotguns"
    Selected_Category = #shotguns
    
  ElseIf Result = #rifles And Enemy_CanUse_rifles = #True
    WPN_Category = "Rifles"
    Selected_Category = #rifles
    
  ElseIf Result = #assault_rifles And Enemy_CanUse_assault_rifles = #True   ;<--- Watch for spelling errors! This is what was causing the error of it failing to reset and giving the wrong items out!!!! Did not match Global name.
    WPN_Category = "Assault Rifles"
    Selected_Category = #assault_rifles
    
  ElseIf Result = #assault_rifles And Enemy_CanUse_machineguns = #True
    WPN_Category = "Machineguns"
    Selected_Category = #machineguns
    
  ElseIf Result = #heavyweapons And Enemy_CanUse_heavyweapons = #True
    WPN_Category = "Heavyweapons"
    Selected_Category = #heavyweapons
    
  ElseIf Result = #energyweapons And Enemy_CanUse_energyweapons = #True
    WPN_Category = "Energyweapons"
   Selected_Category = #energyweapons
        
  ElseIf Result = #explosiveweapons And Enemy_CanUse_explosiveweapons = #True
    WPN_Category = "Explosive weapons"
   Selected_Category = #explosiveweapons
    
  Else
    ; TURN THIS ON IF YOU WANT TO SEE THE REROLLING ON CONDITION. Sometimes the game appears STUCK here...
    ;PrintN(" Failed result: " +Result+"")
    ;Delay(10)
    ;PrintN(" No valid condition...")
    ;Delay(10)
    ;PrintN(" Re-rolling...")
    LoopCounter + 1     ; For the error checking routine at bottom.

      If LoopCounter => 500 ; I put this error check in because sometimes the simulation seems to get stuck.
      PrintN(" ERROR COUNTER HAS RAN: " +GotoLoopCounter+" TIMES FOR CATEGORY SELECTION...")
      Delay(500)
      PrintN(" The enemy selected: "+EnemyTitle+"")
      PrintN(" Current Weapon Catagory: "+WPN_Category+"")
      PrintN(" Bite= "+Enemy_CanUse_bite+"")
      PrintN(" Claws= "+Enemy_CanUse_claws+"")
      PrintN(" Unarmed= "+Enemy_CanUse_unarmed+"")
      PrintN(" Armed= "+Enemy_CanUse_armed+"")
      PrintN(" Thrown= "+Enemy_CanUse_thrown+"")
      PrintN(" Smallguns= "+Enemy_CanUse_smallguns+"")
      PrintN(" Shotguns= "+Enemy_CanUse_shotguns+"")
      PrintN(" Rifles= "+Enemy_CanUse_rifles+"")
      PrintN(" AssaultRifles= "+Enemy_CanUse_assault_rifles+"")
      PrintN(" Machineguns= "+Enemy_CanUse_machineguns+"")
      PrintN(" Heavyweapons= "+Enemy_CanUse_heavyweapons+"")
      PrintN(" Energyweapons= "+Enemy_CanUse_energyweapons+"")
      PrintN(" Explosives= "+Enemy_CanUse_explosiveweapons+"")
      PrintN(" Check this routine for logic errors, spelling errors, or missing data!!!")
      Input()
      End
      EndIf
      
      Goto RandomEMweapon
    
  EndIf
  
  Delay(100)
  PrintN(" DONE... Result is: "+Result+"  Category: "+Selected_Category+" Selected type:"+WPN_Category+"")   ;       <--- This shows If the catagory integer is actually changing. 

EndProcedure
; Randomize weapon based on category.
Procedure Set_Randomized_Weapon()
PrintN(" *Randomizing Weapon Selection*")
PrintN(" Selected Category: "+WPN_Category+"")   ;       <--- This shows If the catagory integer is actually changing.


PickEMweapon:
  
If Selected_Category = #creaturebite                      ; does not work with CONSTANTS in place! #creaturebite      
Result = Random(1,1)
    If Result = #Bite  
    WPN_Selected = #Bite
    EndIf

ElseIf Selected_Category = #creatureclaws
Result = Random(1,1)
    If Result = #Claw 
    WPN_Selected = #Claw
    EndIf

ElseIf Selected_Category = #unarmed
Result = Random(1,1)
    If Result =1
    WPN_Selected = #Fists
    EndIf
          
ElseIf Selected_Category = #armed
Category_Armed:
Result = Random(14,1)                      ;Pick between these weapons
    If Result = #SmallKnife                     ; <-- This way is easier to read instead of using integers.
    WPN_Selected = #SmallKnife                ; <-- The WEAPON ID in Globals MUST MATCH or this wont work.
    ElseIf Result = #CombatKnife
    WPN_Selected = #CombatKnife
    ElseIf Result = #Wakizashi ;And EnemyForce <> #TribalWomen
    WPN_Selected = #Wakizashi
    ElseIf Result = #Katana ;And EnemyForce <> #TribalWomen
    WPN_Selected = #Katana
    ElseIf Result = #Axe
    WPN_Selected = #Axe 
    ElseIf Result = #Wrench ;EnemyForce <> #TribalWomen      ; Dont allow this enemy to use this and if Wrench is selected then re-roll the ARMED category.
    WPN_Selected = #Wrench
    ElseIf Result = #Crowbar 
    WPN_Selected = #Crowbar
    ElseIf Result = #BaseballBat ;And EnemyForce <> #TribalWomen
    WPN_Selected = #BaseballBat
    ElseIf Result = #Club
    WPN_Selected = #Club
    ElseIf Result = #SledgeHammer
    WPN_Selected = #SledgeHammer
    ElseIf Result = #WoodStaff
    WPN_Selected = #WoodStaff
    ElseIf Result = #Brassknuckles ;And EnemyForce <> #TribalWomen
    WPN_Selected = #Brassknuckles
    ElseIf Result = #SpikedBrassKnuckles
    WPN_Selected = #SpikedBrassKnuckles
    ElseIf Result = #CattleProd ;And EnemyForce <> #TribalWomen
    WPN_Selected = #CattleProd
    EndIf 

ElseIf Selected_Category = #thrown
Result = Random(5,1);Pick between these weapons 17 and 21
    If Result = #Tomahawk
    WPN_Selected = #Tomahawk
    ElseIf Result = #CombatTomahawk
    WPN_Selected = #CombatTomahawk
    ElseIf Result = #SharpenedPole
    WPN_Selected = #SharpenedPole
    ElseIf Result =#CrudeSpear
    WPN_Selected=#FineSpear
    EndIf   
      
ElseIf Selected_Category = #smallguns
    Result = Random(4,1);Pick between these weapons     
    If Result = #CrudePipePistol
    WPN_Selected = #CrudePipePistol 
    ElseIf Result = #Revolver
    WPN_Selected = #Revolver
    ElseIf Result = #RareRevolver
    WPN_Selected = #RareRevolver
    ElseIf Result = #BerretaM9Pistol
    WPN_Selected = #BerretaM9Pistol
    EndIf

ElseIf Selected_Category = #shotguns
Result = Random(7,1);Pick between these weapons
    If Result = #CrudePipeShotgun
    WPN_Selected = #CrudePipeShotgun
    ElseIf Result = #Blunderbuss
    WPN_Selected = #Blunderbuss
    ElseIf Result = #WornSawedoffShotgun
    WPN_Selected = #WornSawedoffShotgun
    ElseIf Result = #SawedoffShotgun
    WPN_Selected = #SawedoffShotgun
    ElseIf Result = #Shotgun
    WPN_Selected = #Shotgun
    ElseIf Result = #CombatShotgun
    WPN_Selected = #CombatShotgun
    ElseIf Result = #PancorJackhammer
    WPN_Selected = #PancorJackhammer
    EndIf
    
ElseIf Selected_Category = #rifles
Result = Random(2,1);Pick between these weapons
    If Result = #HomeMadeRifle
    WPN_Selected = #HomeMadeRifle
    ElseIf Result = #BoltActionRifle
    WPN_Selected = #BoltActionRifle
    EndIf
    
ElseIf Selected_Category = #assault_rifles
Result = Random(1,1)    
    If Result = #M16
    WPN_Selected = #M16
    EndIf

ElseIf Selected_Category = 10
Result = Random(1,1)
    If Result = #M60
    WPN_Selected = #M60
    EndIf

ElseIf Selected_Category = #machineguns
Result = Random(2,1);Pick between these weapons
    If Result = #ImprovisedFlameThrower
    WPN_Selected = #ImprovisedFlameThrower  
    ElseIf Result = #M9A17FlameThrower
    WPN_Selected = #M9A17FlameThrower
    EndIf

ElseIf Selected_Category = #heavyweapons
Result = Random(8,1);Pick between these weapons      
    If Result = #LaserPistol
    WPN_Selected = #LaserPistol 
    ElseIf Result = #LaserRifle
    WPN_Selected = #LaserRifle
    ElseIf Result = #EnhancedLaserPistol
    WPN_Selected = #EnhancedLaserPistol
    ElseIf Result = #EnhancedLaserRifle
    WPN_Selected = #EnhancedLaserRifle
    ElseIf Result = #PhasedPlasmaPulseGun40Watt
    WPN_Selected = #PhasedPlasmaPulseGun40Watt
    ElseIf Result = #PhasedPlasmaPulseGun80Watt
    WPN_Selected = #PhasedPlasmaPulseGun80Watt
    ElseIf Result = #PhasedPlasmaPulseGun100Watt
    WPN_Selected = #PhasedPlasmaPulseGun100Watt
    ElseIf Result = #PhasedPlasmaPulseGun200Watt
    WPN_Selected = #PhasedPlasmaPulseGun200Watt
    EndIf


     ElseIf WPN_Selected = 0 
     PrintN(" OOPS! NO WEAPON WAS SELECTED!!!")
     ;WPN_Selected = 0 ; Is this really needed? Added this because enemies are recieving weapons they shouldnt still. < Cause was incorrect label in string.
     ;Delay(200)
     PrintN(" Restarting...")
     ;Delay(200)
      LoopCounter + 1     ; For the error checking routine at bottom.

        If LoopCounter => 500 ; I put this error check in because sometimes the simulation seems to get stuck.
        PrintN(" ERROR COUNTER HAS RAN: " +GotoLoopCounter+" TIMES FOR WEAPON SELECTION...")
        Delay(500)
        PrintN(" The enemy selected: "+EnemyTitle+"")
        PrintN(" Current Weapon Catagory: "+WPN_Category+"")
        PrintN(" Bite= "+Enemy_CanUse_bite+"")
        PrintN(" Claws= "+Enemy_CanUse_claws+"")
        PrintN(" Unarmed= "+Enemy_CanUse_unarmed+"")
        PrintN(" Armed= "+Enemy_CanUse_armed+"")
        PrintN(" Thrown= "+Enemy_CanUse_thrown+"")
        PrintN(" Smallguns= "+Enemy_CanUse_smallguns+"")
        PrintN(" Shotguns= "+Enemy_CanUse_shotguns+"")
        PrintN(" Rifles= "+Enemy_CanUse_rifles+"")
        PrintN(" AssaultRifles= "+Enemy_CanUse_assault_rifles+"")
        PrintN(" Machineguns= "+Enemy_CanUse_machineguns+"")
        PrintN(" Heavyweapons= "+Enemy_CanUse_heavyweapons+"")
        PrintN(" Energyweapons= "+Enemy_CanUse_energyweapons+"")
        PrintN(" Explosives= "+Enemy_CanUse_explosiveweapons+"")
        PrintN(" Check this routine for logic errors, spelling errors, or missing data!!!")
        Input()
        End
        EndIf
        ;PrintN(" made is here.")
        Goto PickEMweapon:
   EndIf
   PrintN(" Made it too End of Randomize Weapon selection.")
   PrintN(" Weapon Selected:"+WPN_Selected+"")
   LoopCounter = 0 ; Reset the loop counter
   ;Weapon_Lookup()
   ;Display_Selected_Weapon()
   
   
     PrintN(" Weapon name: "+WPN_name+"")
    PrintN(" Description: "+WPN_desc+"")
    PrintN(" Attack variety: "+Atk_Variety+"")
    PrintN(" Damage type 1: "+Damage_type1+"")
    
    If Damage_type2 <> #Empty$
    PrintN(" Damage type 2: "+Damage_type2+"")
    EndIf
    
    PrintN(" Max damage: "+Damage_Mx+"")
    PrintN(" Min damage: "+Damage_Mn+"")
    PrintN(" AP cost:"+APcost+"")
    PrintN(" Weapon Range: "+WPNRange+" ft")
    
    If ThrwWPNRange <> 0
    PrintN(" Thrown Range:"+ThrwWPNRange+"ft")
    EndIf
    
    PrintN(" Min STR needed: "+Min_ST+"")
    If Ammunition <> ""
      PrintN(" Ammunition: "+Ammunition+"")
    EndIf

    If Hands_req <> 0
    PrintN(" Hands required: "+Hands_req+"")
    EndIf

    If Magazine_Size <> 0
    PrintN(" Magazine size: "+Magazine_Size+"")
    EndIf

    If Value <> 0
    PrintN(" Item value: "+Value+"")
    EndIf

    If Item_lb <> 0
    PrintN(" Item weight: "+Item_lb+" lbs")
  EndIf

EndProcedure


; Put the weapons into the enemies hands.
Procedure Enemy1_Hands()

      PrintN(" ========================================================")
      PrintN(" Enemy #1 Category: > "+WPN_Category+" <  1st Weapon: > "+WPN_name+" <")
      PrintN(" ========================================================")
      Display_Selected_Weapon() ;<--- Show 1st weapon in right hand.
      

      Enemy1_Righthand = WPN_name               ; Put a weapon in ENEMY1's right hand.

      
      
      If Hands_req = 2                         
      Enemy1_Lefthand = Enemy1_Righthand
      Else
        If Enemy1_Lefthand = #Empty$
          Repeat
          Randomize_Enemy_Weapon_WPN_Category()
          Until Hands_req = 1 And WPN_name <> #Empty$               
          Weapon_Lookup() ;<-- Check the list of valid weapons.
          Enemy1_Lefthand = WPN_name
          PrintN(" ========================================================")
          PrintN(" Enemy #1 Category: > "+WPN_Category+" <  2nd Weapon: > "+WPN_name+" <")
          PrintN(" ========================================================")
          Display_Selected_Weapon(); <--- Show 2nd weapon in left hand.
          ;PrintN(" HANDS VALUE IS:"+Hands_req+"")
          EndIf
        EndIf
EndProcedure

; Display the weapons in right and left hands.   
Procedure DisplayEnemy_Weapons()
  PrintN(" ========================================================")
  PrintN(" [ ENEMY #1 ] R_Hand:"+Enemy1_Righthand+"   L_Hand:"+Enemy1_Lefthand+"")
  
  If TotalEnemyForce > 1
  PrintN(" [ ENEMY #2 ] R_Hand:"+Enemy2_Righthand+"   L_Hand:"+Enemy2_Lefthand+"")
  EndIf
  
  
EndProcedure

Procedure BattleEngine() 
Start:
ClearConsole()
EnemyTitle = #Empty$               ;Clear the enemy title.
Enem_desc_line1.s =#Empty$         ;Clear enemy description.
Enem_desc_line2.s =#Empty$
Enem_desc_line3.s =#Empty$ 
Eamt_max = 20                  ;Defaults
Eamt_min = 1                   ;Defaults
Max_init_dice = 100            ;Defaults

; WHAT TYPE OF COMBAT? -------------------------------------------------------------------------------------------
CombatType = Random(2, 1)
If CombatType = 1
PrintN(" «« GROUND COMBAT »»")
ElseIf CombatType = 2
PrintN(" «« VEHICLE COMBAT »»")
EndIf

; WHAT IS THE ENEMY FORCE ATTACKING? -----------------------------------------------------------------------------
EnemyForce_Dice:
EnemyForce = Random(MaxEnemies, 1)               ; 21,1    Max number here determines how many enemies TYPES there are to pick from.
                                                 ; If no enemy is found with defined attributes then everything SHOULD equal zero.
If EnemyForce = #Lone_Bandit And CombatType = 1
  EnemyTitle ="A lone bandit."
  Enem_desc_line1.s ="test1"
  Enem_desc_line2.s ="test2"
  Enem_desc_line3.s ="test3"
  ;---------------------------------------
  Eamt_max = 1                                 ; Max amount that can be in this group.
  Eamt_min = 1                                  ; Min amount that can be in this group.
  ;---------------------------------------
  Max_init_dice = 70                            ; Enemies Max Initative Roll.
  Enemy_CanUse_unarmed = #True                  ; Can be assigned an attack from this catagory of weapons.
  Enemy_CanUse_armed = #True
  Enemy_CanUse_thrown = #True
  Enemy_CanUse_smallguns = #True
  Enemy_CanUse_rifles = #True
  AttributeRange_Enemy_LoneBandit()        ; Randomly roll the attributes for this enemy type. The variables are handled in the procedures above.

Else
  
  PrintN(" No valid condition met...") 
  Delay(200)
  PrintN(" Re-rolling...") 
  Delay(200)
  Goto Start
  
EndIf



EndProcedure
Begin:
BattleEngine() 
;-----------------------------------------------------------------------------------------
; Show the end result of what enemy type was picked!
;-----------------------------------------------------------------------------------------
PrintN(" Enemy type: "+EnemyTitle+"")
;-----------------------------------------------------------------------------------------
Randomize_Enemy_Weapon_WPN_Category()
Set_Randomized_Weapon()
Weapon_Lookup()
;Display_Selected_Weapon()
;DisplayEnemy_Weapons()








String$ = Input()
If String$ = "z"
  PrintN(" Restarting!")
  Delay(300)
  Goto Begin
Else

  End
EndIf



If you mess with the procedure order at the bottom its supposed to function like this:
Image
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Changing the Font in the Console & My First new game.

Post by Mijikai »

Had no time to look at the code but i strongly suggest to use EnableExplicit to make sure everything is defined properly before going forward.
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

Got it working inconsistently and displaying the wrong values by switching back on the "ELSE" and changing If WPN_Selected = #Fists;And WPN_Catagory = #unarmed And Enemy_CanUse_unarmed = #True
It should be displaying a weapon from the Rifle category and only picking between 1 of the 2 available. I suppose its picking the first "1" it see's in the list of weapons because I removed the check for the category (WPN_Catagory).

Image


If I put back in the two "AND" statements it does find the weapon. In this case its SMALL GUNS and 3 meaning it should show a "RareRevolver" because #RareRevolver=3
Image

Code: Select all

  ElseIf WPN_Selected = #RareRevolver And WPN_Catagory = #smallguns And Enemy_CanUse_smallguns = #True
  WPN_name      ="Fancy Revolver"
  WPN_desc      ="A rare 8 shot revolver with a ivory handle."
  Atk_Variety   = 1
  Damage_type1  ="Kinnetic"
  Damage_type2  = #Empty$
  Damage_Mx     = 18
  Damage_Mn     = 10
  APcost        = 2
  WPNRange      = 60
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    ="bullets"
  Hands_req     = 1
  Magazine_Size = 8
  Value         = 45
  Item_lb       = 2

If I call the WeaponLookUp() procedure after the Category and Weapon randomization completes it hangs. The only thing I see different from my earlier code base is #constants defining the weapons were numbered 1 to 60. But this made it a chore to add in new weapons if I wanted the list to stay incremented.
Image

What I find most troubling is this area of my code I had no issues with until now so I feel like I'm going backwards redoing the same thing over and over.
User avatar
mrv2k
User
User
Posts: 53
Joined: Fri Jan 20, 2012 3:40 pm
Location: SE England
Contact:

Re: Changing the Font in the Console & My First new game.

Post by mrv2k »

You could simplifly your code and speed it up by using select..case rather than if..elseif..endif. e.g.

Code: Select all

Result = Random(12,1)     ; change 12 to 13 later - have no explosive users yet!

Select Result

  Case #creaturebite
    If Enemy_CanUse_bite ; Assumed that this is a bool constant
    WPN_Category = "Creature Bite"
    Selected_Category = #creaturebite
    EndIf
    
  Case #creatureclaws 
    If Enemy_CanUse_claws
    WPN_Category = "Creature Claws"
    Selected_Category = #creatureclaws
    EndIf
   
  Case #unarmed 
    If Enemy_CanUse_unarmed
    WPN_Category = "Unarmed"
    Selected_Category = #unarmed
    EndIf
   
  Case #armed 
    If Enemy_CanUse_armed
    WPN_Category = "Armed"
    Selected_Category = #armed
    EndIf
   
  Case #thrown 
    If Enemy_CanUse_thrown
    WPN_Category = "Thrown"
    Selected_Category = #thrown
    EndIf
   
  Case #smallguns 
    If Enemy_CanUse_smallguns
    WPN_Category = "Smallguns"
    Selected_Category = #smallguns
    EndIf
   
  Case #shotguns 
    If Enemy_CanUse_shotguns
    WPN_Category = "Shotguns"
    Selected_Category = #shotguns
    EndIf
   
  Case #rifles 
    If Enemy_CanUse_rifles
    WPN_Category = "Rifles"
    Selected_Category = #rifles
    EndIf
   
  Case #assault_rifles 
    If Enemy_CanUse_assault_rifles   ;<--- Watch for spelling errors! This is what was causing the error of it failing to reset and giving the wrong items out!!!! Did not match Global name.
    WPN_Category = "Assault Rifles"
    Selected_Category = #assault_rifles
    EndIf
   
  Case #assault_rifles 
    If Enemy_CanUse_machineguns
    WPN_Category = "Machineguns"
    Selected_Category = #machineguns
    EndIf
   
  Case #heavyweapons 
    If Enemy_CanUse_heavyweapons
    WPN_Category = "Heavyweapons"
    Selected_Category = #heavyweapons
    EndIf
   
  Case #energyweapons 
    If Enemy_CanUse_energyweapons
    WPN_Category = "Energyweapons"
    Selected_Category = #energyweapons
    EndIf
       
  Case #explosiveweapons 
    If Enemy_CanUse_explosiveweapons
    WPN_Category = "Explosive weapons"
    Selected_Category = #explosiveweapons
    EndIf
    
EndSelect
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

Switched everything to case statements and its working great until it gets to my WeaponLook() procedure. It will run infinitely and never find an item.

Image

Code: Select all

Procedure Weapon_Lookup()
  
  Case #Bite
  If WPN_Catagory = #creaturebite And Enemy_CanUse_bite = #True 
  WPN_name      ="Bite"
  WPN_desc      ="A close quarters biting attack."
  WPN_desc1.s   =#Empty$
  WPN_desc2.s   =#Empty$
  WPN_desc3.s   =#Empty$
  WPN_desc4.s   =#Empty$
  WPN_desc5.s   =#Empty$
  WPN_desc6.s   =#Empty$
  Atk_Variety   = 1
  Damage_type1  ="Piercing"
  Damage_type2  = #Empty$
  Damage_Mx     = 10
  Damage_Mn     = 1
  APcost        = 1
  WPNRange      = 1
  ThrwWPNRange  = 0
  Min_ST        = 1
  Ammunition    = #Empty$
  Hands_req     = 1
  Magazine_Size = 0
  Value         = 0
  Item_lb       = 0
  EndIf


Default
   PrintN(" IF THIS RUNS NO CONDITION ABOVE IS TRUE ERROR!!!!..")
EndSelect

  ; Incriment the error check routine.
  If WPN_name = #Empty$
  LoopCounter + 1
  EndIf
  
  ; Error Checking
  If LoopCounter > 500
    PrintN(" This has ran over 500 times... Something went wrong...")
    Delay(500)
    PrintN(" Check the LOGIC & VARIABLES for errors.")
    Delay(500)
    PrintN(" ANYKEY to quit...")
    Input()
    End
  EndIf
  
;Display_Selected_Weapon()
          
 EndProcedure

Image

In this case it should be finding the EnhancedLaserPistol since it = 3.

Code: Select all

;------------------------------
;ENERGY: Energy Weapons
;------------------------------
#LaserPistol=1
#LaserRifle=2
#EnhancedLaserPistol=3
#EnhancedLaserRifle=4
#PhasedPlasmaPulseGun40Watt=5
#PhasedPlasmaPulseGun80Watt=6
#PhasedPlasmaPulseGun100Watt=7
#PhasedPlasmaPulseGun200Watt=8
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Changing the Font in the Console & My First new game.

Post by Demivec »

Code: Select all

  If WPN_Catagory = #creaturebite And Enemy_CanUse_bite = #True
The variable WPN_Category appears to be misspelled. Perhaps this is part of the problem.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Changing the Font in the Console & My First new game.

Post by infratec »

Code: Select all

EnableExplicit
:!: :!: :!:

Such things are the result of ignoring this.

Code: Select all

Global WPN_Category.s=#Empty$
Then sometimes:

Code: Select all

If WPN_Catagory = #creaturebite And Enemy_CanUse_bite = #True
Look at a and e.

My main Program uses Define.
In procedures I always use Protected.

And I avoid Global.

You need 10 minutes more to define the variables, but hours to find such a bug.
So what is better :?:
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

Thanks once again everyone. My spelling error was a result of me going back to earlier version of my Procedure file before it was fixed. Soon as that was pointed out I also released I was calling the wrong variable. It should have been "Selected_Category" and not "WPN_Category" being compared.

To my dismay I did spend hours trying to figure this out but in the end I think it helped me learn a lot more. I see your point in using Protected instead of Globals.

Everything is now smooth sailing. :)
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

Reached a new milestone!
I let my code run for awhile and it had no issues. Now I can move on to creating the next part of my game, the turn based combat! 8)
Image
User avatar
Vernostonos
User
User
Posts: 61
Joined: Thu Jul 02, 2020 9:52 pm

Re: Changing the Font in the Console & My First new game.

Post by Vernostonos »

I would like to increase the console window and buffer size. I found the API function but have no idea how to implement it, does anyone have a simple example?
The complexity of my program has exceeded the usefulness of what a 80x25 character display can offer.

https://docs.microsoft.com/en-us/window ... windowinfo
Last edited by Vernostonos on Sun Aug 02, 2020 2:34 pm, edited 1 time in total.
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Changing the Font in the Console & My First new game.

Post by Mijikai »

Here is what i tried, its not reliable thought:
viewtopic.php?f=13&t=75712
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Changing the Font in the Console & My First new game.

Post by Demivec »

Vernostonos wrote:I would like to increase the console window and buffer size. I found the API function but have no idea how to implement it, does anyone have a simple example?
The complexity of my program has exceeded the usefulness of what a 80x25 character display can offer.

https://docs.microsoft.com/en-us/window ... windowinfo
From my observations it doesn't seem as if you are using any of the other functions of a console besides display and keyboard input. Perhaps it may be useful to create your own mock console. You would only have to implement functions that you specifically need and doing so would give you the added benefit of using a custom font easily. In addition I think it would allow porting of your game to Linux or MAC OS, if that is desired, a little easier.
Post Reply