I am trying to write a function in the global script that I can call from any of my rooms that will display "use INVENTORY ITEM on HOTSPOT", eg: "USE BLUE MUG ON ROCK". However, when I use player.ActiveInventory.Name from the global script, the value is always 0. If i make the same call from my room script, the value is correct - the actual name of the inventory object.
I was having this same issue with hotspots as well. What am I missing here?
Thank you!
In which function in global script are you using this? What do you mean by the value of name is 0?
Thanks for the response. I made my own function and added it to the global script. When I assign 'player.ActiveInventory.Name' to a String and use Display() to display the String, it outputs "0" or "0.0000000f". However, if I move the code to my room script, it works as expected and outputs the actual name of the inventory item.
You need to use %s to insert a string value into text, it looks like you've accidentally used %d or %f.
Please always show your code when asking about coding.
https://adventuregamestudio.github.io/ags-manual/StringFormats.html
Thanks Khris, you nailed it; that is exactly what I was doing wrong. Appreciate your help!