Which line is 128? Have you got anything else called Character, such as an array or a global variable?
Try putting your problem code into a new project, then investigate and get it working there.
I've made a few guesses to do something like this and there is no problem with that code:
type CharDetail
Number as integer
Color as integer
Name as string
Image as integer
Exist as integer
endtype
dim SubjKNCharacters(0) as CharDetail
dim CharacterExists(0) as integer
print Character(0, 0, "Ian", 1)
wait key
end
FUNCTION Character(Number, Color, Name$, Imagenum)
Errorcode$ = ""
Num = Number
Img = Int(Imagenum)
If CharacterExists(Num) <> 0
Errorcode$ = "Error: Character already exists"
EXITFUNCTION Errorcode$
ENDIF
If SPRITE EXIST(Img) = 0
Errorcode$ = "Error: Sprite does not exist"
ENDIF
SubjKNCharacters(Num).Number = Num
SubjKNCharacters(Num).Color = Color
SubjKNCharacters(Num).Name = Name$
SubjKNCharacters(Num).Image = Imagenum
SubjKNCharacters(Num).Exist = 1
ENDFUNCTION Errorcode$