ID:143363
 
Code:
mob/UpgradeHQ/verb
Upgrade_HQ()
var/obj/towns/town/CV = src.cv
if(CV.research1&CV.research2&CV.research3&CV.research4&CV.research5)
src << "To many reserve upgrades."
return
switch(alert("Upgrade Village HQ? Village HQ is at level [CV.Village_HQ]","Upgrade","Yes","No"))
if("Yes")
if(!CV.research1)
CV.research1 = "Village HQ [CV.Village_HQ]"
CV.research1t = (round((CV.Village_HQ*600)/Speed))
CV.Upgrade("VHQ")
else if(!CV.research2)
CV.research2 = "Village HQ"
else if(!CV.research3)
CV.research3 = "Village HQ"
else if(!CV.research4)
CV.research4 = "Village HQ"
else if(!CV.research5)
CV.research5 = "Village HQ"
if("No")
return

obj/towns
town
proc/Upgrade(item)
if(src.isupgrading)
return
retake:
sleep(10)
research1t -= 1
if(research1t >= 1)
goto retake
switch(item)
if("VHQ")
++Village_HQ
if("BAR")
++Barracks
if(research2)
research1 = research2
research1t = research2t
if(research3)
research2 = research3
research2 = research3t
if(research4)
research3 = research4
research3 = research4t
if(research5)
research4 = research5
research4 = research5t
research5 = null
research5 = null
else
research4 = null
research4 = null
else
research3 = null
research3 = null
else
research2 = null
research2 = null
else
research1 = null
research1t = null


Problem description:

whenever I tried to upgrade more than one thing at a time, i get:
runtime error: type mismatch
proc name: Upgrade HQ (/mob/UpgradeHQ/verb/Upgrade_HQ)
usr: KingCold999 (/mob)
src: KingCold999 (/mob)
call stack:
KingCold999 (/mob): Upgrade HQ()


Very sorry that my code is so messy, i just couldn't figure out amother way
put the code in debug mode, so i can see what line is causeing it to bugg out.
In response to Tubutas
Tubutas wrote:
put the code in debug mode, so i can see what line is causeing it to bugg out.

noob question, but How?
In response to KingCold999
#define DEBUG


look up stuff before you ask T_T. put that code anyweres in your code.