Sorry if these are particularly simple questions, but I'm a bit stuck.
Any and all help would be greatly appreciated.
Okay, here goes...
1) When using a custom status text function in a room script, it only flashes on for a second before reverting to the global default. Is there a way I can override the "repeatedly executed" global code and make the room-specific code stick for as long as the mouse is over the hotspot?
Here's what I'm using at the moment (room script)...
function hRightedge_MouseMove()
{
gIconBarStatus.Text=String.Format("Go back");
}
2) How do I get the status bar to recognise the GUI buttons? At the moment, they're not being picked up at all.
Here's what isn't working (Global)...
function btnIconInv_MouseMove() {
gIconBarStatus.Text=String.Format("Look in your inventory");
}
Thanks in advance, and sorry again if I'm just being thick.
Let me know if you need me to post any more code.
Thanks again.
J.
(I forgot to mention that I'm using AGS 3.0)
What are you using to get the hotspot name in the statusbar to start with? Can you recell which template you used to create the game?
If the IconBarStatus is set to @OVERHOTSPOT@, your code should work. But if there's some repeatedly_execute code, you'll need to enclose it inside an if statement, and use a global variable of some kind to turn it on/off from your room code.
If you're using the Description module, then I could add something to support what you want to do. It should also support mouseover GUI items.
Ermm... I'm using the default template as a base, but I stole this bit of code from Demo Quest.
function LucasartsStatus() {
String buf, name;
if (GUI.GetAtScreenXY(mouse.x, mouse.y)==null) {
name = Game.GetLocationName(mouse.x, mouse.y);
if (mouse.Mode==eModeMoveto) {
buf = String.Format("Walk to %s", name);
}
else if (mouse.Mode==eModeLookat) {
buf = String.Format("Look at %s", name);
}
else if (mouse.Mode==eModeInteract) {
buf = String.Format("Pick up %s", name);
}
else if (mouse.Mode==eModeTalkto) {
buf = String.Format("Talk to %s", name);
}
else if (mouse.Mode==eModeUseinv) {
buf = String.Format("Use with %s", name);
}
else {
buf = name;
}
}
else {
buf = " ";
}
gIconBarStatus.Text = buf;
}
function repeatedly_execute() {
LucasartsStatus();
}
So should I change it to the @OVERHOTSPOT@ method instead?
Would that make it better/easier?
Thanks again.
J.
No, I'd stick with what you've got, but add some more if/elses:
try this:
// Stick this at top of global script
String StatusOverride;
export StatusOverride;
// add this to LucasartsStatus() fucntion, at end
if (GUIControl.GetAtScreenXY(mouse.x, mouse.y)==btnIconInv) gIconBarStatus.Text="Look in your inventory";
if (StatusOverride!=null) gIconBarStatus.Text=StatusOverride;
// put this in global header:
import String StatusOverride;
// put this in rooms scripts to override the defaults:
function room_repeatedly_execute() // set this function up via interaction...
{
if (mouse.x > Room.RightEdge) StatusOverride="Go back";
else StatusOverride=null;
}
Cool stuff.
It works a treat.
Thanks again.
J.
Hey. Another (related) problem.
This time with the inventory GUI.
I can get the names of the items to display using the aforementioned method, like so...
if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y)==iPencil) gIconBarStatus.Text="A pencil";
if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y)==iPaper) gIconBarStatus.Text="Some sheets of paper";
However, after selecting an item, the "use with" status doesn't show up until I close the inventory.
What I want is for it to show as a hint that inventory items can sometimes be used with each other.
Any ideas?
Thanks.
J.
if ((InventoryItem.GetAtScreenXY(mouse.x, mouse.y)==iPencil && player.ActiveInventory==iPaper) || (InventoryItem.GetAtScreenXY(mouse.x, mouse.y)==iPaper && player.ActiveInventory==iPencil)) gIconBarStatus.Text="Use pencil with paper";
Thanks muchly. :)
J.