1) Start by isolating the string beginning with ".spawncoin5g":
substring = Right(theOriginalString, Len(theOriginalString)+ 1 - Find(".spawncoin5g", theOriginalString))
2) Now look at the second token, if any:
+ NumTokens(substring, " ") > 1
-> spawnnumber = int(GetToken(substring, 2, " "))
+ Else
-> spawnnumber = 1
substring and spawnnumber are variables, of course.