- 18
- Posts
- 7
- Years
- Age 26
- California
- Seen Jan 29, 2023
I found the error. It occurs when a pokemon is holding an item. I added extra sections in the textpos array, so i just removed them and its working fine for now.
Here's the error. It happens when I;m on the pokemon's summary page and scroll down to the sixth pokemon in the party
Since I didn't edit anything on the SpriteWindow section, it would mean that the error is coming from the Summary section. I didn't edit much on the Summary screen though, just added another stat to show up.
From what I can tell, the error states that one of the variables in the textpos array is not convert to Color. In the SpriteWindow section, that would be i[6]. However, I can't pinpoint it out specifically in the pbDrawPageThree section.
Where's the error? Thank you.
Spoiler:
Exception: TypeError
Message: can't convert TrueClass into Color
SpriteWindow:1177:in `=='
SpriteWindow:1177:in `pbDrawTextPositions'
SpriteWindow:1168:in `each'
SpriteWindow:1168:in `pbDrawTextPositions'
PScreen_Summary:645:in `drawPageThree'
PScreen_Summary:1326:in `pbScene'
PScreen_Summary:1253:in `loop'
PScreen_Summary:1335:in `pbScene'
PScreen_Summary:1349:in `pbStartScreen'
PScreen_Party:790:in `pbSummary'
Message: can't convert TrueClass into Color
SpriteWindow:1177:in `=='
SpriteWindow:1177:in `pbDrawTextPositions'
SpriteWindow:1168:in `each'
SpriteWindow:1168:in `pbDrawTextPositions'
PScreen_Summary:645:in `drawPageThree'
PScreen_Summary:1326:in `pbScene'
PScreen_Summary:1253:in `loop'
PScreen_Summary:1335:in `pbScene'
PScreen_Summary:1349:in `pbStartScreen'
PScreen_Party:790:in `pbSummary'
Since I didn't edit anything on the SpriteWindow section, it would mean that the error is coming from the Summary section. I didn't edit much on the Summary screen though, just added another stat to show up.
Spoiler:
Code:
def drawPageThree(pokemon)
overlay=@sprites["overlay"].bitmap
overlay.clear
@sprites["background"].setBitmap("Graphics/Pictures/summary3")
imagepos=[]
if pbPokerus(pokemon)==1 || pokemon.hp==0 || @pokemon.status>0
status=6 if pbPokerus(pokemon)==1
[email protected] if @pokemon.status>0
status=5 if pokemon.hp==0
imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
end
if pokemon.isShiny?
imagepos.push([sprintf("Graphics/Pictures/shiny"),2,134,0,0,-1,-1])
end
if pbPokerus(pokemon)==2
imagepos.push([sprintf("Graphics/Pictures/summaryPokerus"),176,100,0,0,-1,-1])
end
[email protected] ? @pokemon.ballused : 0
ballimage=sprintf("Graphics/Pictures/summaryball%02d",@pokemon.ballused)
imagepos.push([ballimage,14,60,0,0,-1,-1])
pbDrawImagePositions(overlay,imagepos)
base=Color.new(248,248,248)
shadow=Color.new(104,104,104)
statshadows=[]
for i in 0...5; statshadows[i]=shadow; end
if !(pokemon.isShadow? rescue false) || pokemon.heartStage<=3
natup=(pokemon.nature/5).floor
natdn=(pokemon.nature%5).floor
statshadows[natup]=Color.new(136,96,72) if natup!=natdn
statshadows[natdn]=Color.new(64,120,152) if natup!=natdn
end
bases=Color.new(0,230,0)
shadows=Color.new(0,77,0)
pbSetSystemFont(overlay)
abilityname=PBAbilities.getName(pokemon.ability)
abilitydesc=pbGetMessage(MessageTypes::AbilityDescs,pokemon.ability)
[email protected]
textpos=[
[_INTL("SKILLS"),26,16,0,base,shadow],
[pokename,46,62,0,base,shadow],
[pokemon.level.to_s,46,92,0,base,shadow],
[_INTL("Lv."),16,92,0,base,shadow],
[_INTL("Item"),16,320,0,base,shadow],
[_INTL("StPt."),268,76,2,base,shadow],
[sprintf("%d",pokemon.statpoint),304,76,2,bases,shadows],
[_INTL("HP"),372,76,2,base,shadow],
[sprintf("%3d/%3d",pokemon.hp,pokemon.totalhp),462,76,1,base,shadow],
[_INTL("Attack"),248,120,0,base,statshadows[0]],
[sprintf("%d",pokemon.attack),456,120,1,base,shadow],
[_INTL("Defense"),248,152,0,base,statshadows[1]],
[sprintf("%d",pokemon.defense),456,152,1,base,shadow],
[_INTL("Sp. Atk"),248,184,0,base,statshadows[3]],
[sprintf("%d",pokemon.spatk),456,184,1,base,shadow],
[_INTL("Sp. Def"),248,216,0,base,statshadows[4]],
[sprintf("%d",pokemon.spdef),456,216,1,base,shadow],
[_INTL("Speed"),248,248,0,base,statshadows[2]],
[sprintf("%d",pokemon.speed),456,248,1,base,shadow],
[_INTL("Ability"),224,284,0,base,shadow],
[abilityname,362,284,0,base,shadow],
]
if pokemon.hasItem?
textpos.push([PBItems.getName(pokemon.item),16,352,0,base,shadow,base,shadow])
else
textpos.push([_INTL("None"),16,352,0,base,shadow])
end
if pokemon.isMale?
textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
elsif pokemon.isFemale?
textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
end
pbDrawTextPositions(overlay,textpos)
drawTextEx(overlay,224,316,282,2,abilitydesc,base,shadow)
drawMarkings(overlay,15,291,72,20,pokemon.markings)
if pokemon.hp>0
hpcolors=[
Color.new(122,255,73),Color.new(100,204,63), # Green
Color.new(233,255,2),Color.new(183,198,25), # Orange
Color.new(170,22,22),Color.new(255,35,35) # Red
]
hpzone=0
hpzone=1 if pokemon.hp<=(@pokemon.totalhp/2).floor
hpzone=2 if pokemon.hp<=(@pokemon.totalhp/4).floor
overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,hpcolors[hpzone*2+1])
overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,hpcolors[hpzone*2])
end
end
textpos.push([_INTL("None"),16,352,0,base,shadow])
end
if pokemon.isMale?
textpos.push([_INTL("♂"),178,62,0,Color.new(24,112,216),Color.new(136,168,208)])
elsif pokemon.isFemale?
textpos.push([_INTL("♀"),178,62,0,Color.new(248,56,32),Color.new(224,152,144)])
end
pbDrawTextPositions(overlay,textpos)
drawTextEx(overlay,224,316,282,2,abilitydesc,base,shadow)
drawMarkings(overlay,15,291,72,20,pokemon.markings)
if pokemon.hp>0
hpcolors=[
Color.new(122,255,73),Color.new(100,204,63), # Green
Color.new(233,255,2),Color.new(183,198,25), # Orange
Color.new(170,22,22),Color.new(255,35,35) # Red
]
hpzone=0
hpzone=1 if pokemon.hp<=(@pokemon.totalhp/2).floor
hpzone=2 if pokemon.hp<=(@pokemon.totalhp/4).floor
overlay.fill_rect(360,110,pokemon.hp*96/pokemon.totalhp,2,hpcolors[hpzone*2+1])
overlay.fill_rect(360,112,pokemon.hp*96/pokemon.totalhp,4,hpcolors[hpzone*2])
end
end
From what I can tell, the error states that one of the variables in the textpos array is not convert to Color. In the SpriteWindow section, that would be i[6]. However, I can't pinpoint it out specifically in the pbDrawPageThree section.
Where's the error? Thank you.
Last edited: