This didn't feel like a noobie question.
I'm scripting some simple interactions with hotspots in a room. I'm trying to figure out if there's a way I can dynamically grab some sort of reference to the hotspot in question.
I tried this...
Code: ags
And this...
Code: ags
Neither work.
And, even though this isn't what I was aiming for, I tried this...
Code: ags
This sort of works, but I'm getting an error message that "Description" isn't a property of that hotspot?
I figured, instead of manually typing out in every "silly" interaction, "you can't look at/talk to/open/take the...", that I'd eliminate repeating code and make a couple global functions that I could plug the reference for the hotspot into, and it would deliver the message to the player. Like this:
Code: ags
Which would output to the player:
So what am I doing wrong?
I'm scripting some simple interactions with hotspots in a room. I'm trying to figure out if there's a way I can dynamically grab some sort of reference to the hotspot in question.
I tried this...
function hHotspot3_Talk(Hotspot *theHotspot, CursorMode mode)
{
Display("You can't talk to the %s", theHotspot.GetTextProperty("Description"));
}
And this...
function hHotspot3_Talk(Hotspot *theHotspot, CursorMode mode)
{
Display("You can't talk to the %s", this.GetTextProperty("Description"));
}
Neither work.
And, even though this isn't what I was aiming for, I tried this...
function hHotspot3_Talk(Hotspot *theHotspot, CursorMode mode)
{
Display("You can't talk to the %s", hHotspot3.GetTextProperty("Description"));
}
This sort of works, but I'm getting an error message that "Description" isn't a property of that hotspot?
I figured, instead of manually typing out in every "silly" interaction, "you can't look at/talk to/open/take the...", that I'd eliminate repeating code and make a couple global functions that I could plug the reference for the hotspot into, and it would deliver the message to the player. Like this:
function youCantTalkToThe(hotspotRef){
Display("You can't talk to the %s", hotspotRef.GetTextProperty("Description"));
}
// In my room script
function hHotspot3_Talk(Hotspot *theHotspot, CursorMode mode)
{
youCantTalkToThe(thisHotspotRef);
}
Which would output to the player:
QuoteYou can't talk to the porch.
So what am I doing wrong?