Returning Strings

BlitzPlus Forums/BlitzPlus Programming/Returning Strings

Mordax_Praetorian(Posted 2005) [#1]
I made a function to return weapon descriptions but unfortunatly the Return commnad doesnt seem to return anything except "0"

Function GetDesc(ItemName$)
	Select ItemName$
		Case "Short Sword"
			Return "A sword with a short blade suited for confined spaces"
		Case "Gladius"
			Return "Slighty larger And more versitile than a Short Sword"
		Case "Rapier"
			Return "A sword with a very long blade traditionaly used for dueling"
		Case "Kryss"
			Return "Its blade is curved like ripples on water, beutiful but deadly"
		Case "Cutlass"
			Return "Small curved sword with many uses, favored by sailors"
		Case "Sabre"
			Return "Medium length sword with a curved tip"
		Case "Scimitar"
			Return "Crescent bladed sword with a good chance of criticals"
		Case "Katana"
			Return "Very deadly and versitile curved sword that can be wielded one or 2 handed"
		Case "Broad Sword"
			Return "Heavy sword taking little skill to wield"
		Case "Long Sword"
			Return "Sword with a long blade, there are many techniques to wielding them"
		Case "Bastard Sword"
			Return "This 'hand and a half' sword can be wielded either 1 or 2 handed"
		Case "Flamberge"
			Return "A sword so long that it needs an extra hilt half way up the blade to retract after thrusting"
		Case "Falchion"
			Return "A blunt and heavy sword that is weighted at the tip"
		Case "Chopper"
			Return "Sword with a decorated blade that can be weilded 1 or 2 handed"
		Case "Claymore"
			Return "Large 2-handed sword that causes a lot of damage"
		Case "Nodachi"
			Return "Massive curved blade with immense damage potential"
	End Select
End Function


The function is currently called with:

Desc$ = GetDesc(Char1\RightHandT[Name])


Where Desc$ is blank and Char1\RightHandT[Name] = "Cutlass" and Name is a constant


CS_TBL(Posted 2005) [#2]
add a $ to the function name

Function GetDesc$(ItemName$)


but I admit ... it's something I tend to forget as well ^_^


Mordax_Praetorian(Posted 2005) [#3]
you can put $s on function names?

Hey it worked

thanks


Regular K(Posted 2005) [#4]
By default functions return an integer, but you can change it to a float, string or a type.


Grey Alien(Posted 2005) [#5]
It got me too in the early days!