Page 1 of 1

Smbx 1.4.5: weird strings

Posted: 17 Mar 2021, 17:54
by NESTED ERNEST
Something weird about strings is that you can't get a value directly:

* String variable and get a string from the table:

Code: Select all

dim var1 as string
var1=str(vartable)   '← fails


But if I concatenate it with a "" it is fixed

Code: Select all

dim var1 as string
var1=str(vartable) & ""   '← works


* String gets a name property of an npc

Code: Select all

dim sssa as string
sssa=npc(1).name   '← it fails

But this works:

Code: Select all

dim sssa as string
sssa=npc(1).name & ""


* In a function:
This fails

Code: Select all

script corr(return string)
   dim sss as string="sdddddddddddd"   
   
   return sss
end script

But if I add "", it works:

Code: Select all

script corr(return string)
   dim sss as string="sdddddddddddd"   
   
   return sss & ""
end script