Now, what's curious to me is that the error in question did not pop up in the log file until I fixed the previous errors. I tried to look for information about it but came across none, so I was hoping someone more intelligent than myself would be able to look at the code and tell me what's wrong with it.sgd_v20-pre-r405.pk3:zscript/hud.txt, line 45: Unable to resolve str as type.
Entire code for the HUD is in the spoiler below.
Spoiler:Code: Select all
class SGDStatusBar : BaseStatusBar { HUDFont sfont, invfont, msgfont; InventoryBarState diparms; transient cvar finisherbar; transient cvar finisherprompt; transient cvar hazmatbar; override void Init() { super.Init(); SetSize(0,320,240); Font fnt = "SGDHUDFONT"; sfont = HUDFont.Create(fnt,1,Mono_Off,1,1); fnt = "SMALLFONT"; invfont = HUDFont.Create(fnt,0,Mono_Off,0,0); msgfont = HUDFont.Create(fnt,1,Mono_Off,0,0); diparms = InventoryBarState.Create(); } override void Draw(int state, double TicFrac) { super.Draw(state,TicFrac); DrawHUD(); } void DrawHealthAndArmor() { DrawImage("HAFRAME",(52,208),DI_ITEM_OFFSETS); DrawString(sfont,FormatNumber(CPlayer.health,3),(85,211),DI_TEXT_ALIGN_LEFT); DrawString(sfont,FormatNumber(GetArmorAmount(),3),(121,211),DI_TEXT_ALIGN_LEFT); } void DrawWeaponsAndAmmo() { DrawImage("AMMFRAME",(288,186),DI_ITEM_OFFSETS); DrawImage("WEPFRAME",(196,208),DI_ITEM_OFFSETS); Inventory ammo = GetCurrentAmmo(); DrawString(sfont,FormatNumber(ammo.Amount,3),(232,211),DI_TEXT_ALIGN_CENTER); let selweap = CPlayer.mo.ReadyWeapon.GetClassName(); str ammoicon; // This is the line that produces the error according to the log. switch(selweap) { case "SGDRifle": ammoicon = "ICON_ARF"; break; case "SGDShotgun": case "SGDSuperShotgun": ammoicon = "ICON_SHL"; break; case "SGDMinigun": ammoicon = "ICON_MNG"; break; case "SGDBazooka": ammoicon = "ICON_BAZ"; break; case "SGDFlamethrower": ammoicon = "ICON_FLM"; break; case "SGDArgentRifle": ammoicon = "ICON_AOH"; break; case "SGDDarkMatterCannon": ammoicon = "ICON_DMC"; break; default: ammoicon = null; break; } DrawImage(ammoicon,(278,192),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(1)? "WEPLIGHT" : "",(203,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(2)? "WEPLIGHT" : "",(209,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(3)? "WEPLIGHT" : "",(215,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(4)? "WEPLIGHT" : "",(221,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(5)? "WEPLIGHT" : "",(227,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(6)? "WEPLIGHT" : "",(233,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(7)? "WEPLIGHT" : "",(239,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(8)? "WEPLIGHT" : "",(245,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(9)? "WEPLIGHT" : "",(251,226),DI_ITEM_OFFSETS); DrawImage(CPlayer.HasWeaponsInSlot(0)? "WEPLIGHT" : "",(257,226),DI_ITEM_OFFSETS); } void DrawFinisherBar() { finisherbar = CVar.FindCVar('sgd_displayfbar'); bool drawfbar = finisherbar.GetBool(); if(drawfbar) { DrawImage("FTBARFRM",(4,4),DI_ITEM_OFFSETS); DrawBar("FTBAR_FG","FTBAR_BG",GetAmount("FinisherToken"),GetMaxAmount("FinisherToken"),(10,10),0,0); } } void DrawFinisherPrompt() { finisherprompt = CVar.FindCVar('sgd_finisherprompt'); int prompttype = finisherprompt.GetInt(); if(prompttype > 0) { if(CPlayer.mo.CountInv("FinisherToken") >= 300 && CPlayer.mo.CountInv("FinisherToken") < 600) { DrawString(msgfont,StringTable.Localize("$SGD_FMSG_LVL1READY"),(27,8),DI_TEXT_ALIGN_LEFT,Font.CR_GREEN); if(prompttype == 2) { DrawString(msgfont,StringTable.Localize("$SGD_FMSG_USE"),(36,8),DI_TEXT_ALIGN_LEFT,Font.CR_GREEN); } } else if(CPlayer.mo.CountInv("FinisherToken") >= 600 && CPlayer.mo.CountInv("FinisherToken") < 900) { DrawString(msgfont,StringTable.Localize("$SGD_FMSG_LVL2READY"),(27,8),DI_TEXT_ALIGN_LEFT,Font.CR_GREEN); if(prompttype == 2) { DrawString(msgfont,StringTable.Localize("$SGD_FMSG_USE"),(36,8),DI_TEXT_ALIGN_LEFT,Font.CR_GREEN); } } else if(CPlayer.mo.CountInv("FinisherToken") >= 900) { DrawString(msgfont,StringTable.Localize("$SGD_FMSG_LVL3READY"),(27,8),DI_TEXT_ALIGN_LEFT,Font.CR_GREEN); if(prompttype == 2) { DrawString(msgfont,StringTable.Localize("$SGD_FMSG_USE"),(36,8),DI_TEXT_ALIGN_LEFT,Font.CR_GREEN); } } } } void DrawInvItem() { DrawImage("INVFRAME",(4,186),DI_ITEM_OFFSETS); if(CPlayer.mo.InvSel != null) { DrawInventoryIcon(CPlayer.mo.InvSel,(10,192),DI_DIMDEPLETED); if(CPlayer.mo.InvSel.Amount > 1) { DrawString(invfont,FormatNumber(CPlayer.mo.InvSel.Amount,3),(12,194),DI_TEXT_ALIGN_LEFT); } } } void DrawHazmatTimer() { hazmatbar = CVar.FindCVar('sgd_displayhsbar'); bool drawhsbar = hazmatbar.GetBool(); if(drawhsbar && CPlayer.mo.ChecInventory("RadSuitTimer")) { DrawBar("HSBAR_FG","HSBAR_BG",GetAmount("RadSuitTimer"),GetMaxAmount("RadSuitTimer"),(231,8),0,0); DrawShader(SHADER_HORZ|SHADER_REVERSE,(231,8),(80,6)); } } void DrawDemonizerTimers() { DrawBar("DBARL_FG","DBARL_BG",GetAmount("DemonizerTimer"),GetMaxAmount("DemonizerTimer"),(55,221),0,0); DrawBar("DBARR_FG","DBARR_BG",GetAmount("DemonizerTimer"),GetMaxAmount("DemonizerTimer"),(165,221),0,0); DrawShader(SHADER_HORZ|SHADER_REVERSE,(165,221),(100,12)); } void DrawHUD() { if(CPlayer.mo.CheckInventory("DemonizerTimer")) { DrawDemonizerTimers(); } else { DrawHealthAndArmor(); DrawWeaponsAndAmmo(); DrawFinisherBar(); DrawFinisherPrompt(); DrawInvItem(); DrawHazmatTimer(); } } }