Scripting, Code & Interaction: Difference between revisions
Jump to navigation
Jump to search
→Fatal error when using "=" and "==" with strings
Line 118: | Line 118: | ||
==Fatal error when using "=" and "==" with strings== | ==Fatal error when using "=" and "==" with strings== | ||
''Oy! How come AGS gives me hell when I write stringname = "blah" or use the conditional "==" with "if" statements and strings?'' | |||
It has something to do with the fact that "'''stringname'''" is actually a ''pointer'', not a variable, so you'd have to use the AGS command '''StrCopy()'''. Look it up in the manual. If you're using V2.71 or above, however, you can use the "'''='''" operator to assign the content of a '''String''' object. | |||
If you're checking the contents of a '''string''' with "'''if'''" statements and the like, don't use the "'''=='''" operator. Instead, use '''StrComp()''' or '''StrCaseComp'''. Look those up in the manual as well. If you're using V2.71 or above, however, you can use the "'''=='''" operator to check the content of a '''String''' object. | |||
==Inserting variables into speech/messages== | ==Inserting variables into speech/messages== | ||
==GlobalInts, your friend: what they are and how to use them== | ==GlobalInts, your friend: what they are and how to use them== |