Advertisement

AngelScript Bug

Started by August 16, 2008 10:54 PM
0 comments, last by BornToCode 16 years, 3 months ago
using the string class. If you create a global variable of that type and then pass that to the c++ side, when you get the object address it gives me garbage. if i do this it works. class MM { string switchName; MM(){ switchName=""; } } MM mm; void CheckIfItemCollected(Sprite& s) { Map@ map = GetCurrentMap(); string mapName; map.Name(mapName); mm.switchName = "hasItem"+mapName+s.name; Print("1"+mm.switchName); if (game.GetGlobalVariable(mm.switchName) == SWITCH_ON) { Print("2"+mm.switchName); s.visible = false; s.Release(); } else { Print("3"+mm.switchName); game.SetGlobalVariable(mm.switchName,SWITCH_OFF); } } but if i do not use the class and just use string switchname as a global variable then it crashes when i pass switchname to GetGlobalVariable.
Forget it i fix the problem. It was my fault.

This topic is closed to new replies.

Advertisement