Overriding the status bar [SOLVED... again]

Started by Ultra Magnus, Wed 19/03/2008 14:48:42

Previous topic - Next topic

Ultra Magnus

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)...
Code: ags
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)...
Code: ags
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)
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

SSH

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.
12

Ultra Magnus

Ermm... I'm using the default template as a base, but I stole this bit of code from Demo Quest.

Code: ags
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.
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

SSH

No, I'd stick with what you've got, but add some more if/elses:

try this:

Code: ags

// 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;
}




12

Ultra Magnus

Cool stuff.
It works a treat.

Thanks again.
J.
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

Ultra Magnus

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...

Code: ags
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.
I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

SSH


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";
12

Ultra Magnus

I don't mean to sound bitter, cold, or cruel, but I am, so that's how it comes out.

I'm tired of pretending I'm not bitchin', a total frickin' rock star from Mars.

SMF spam blocked by CleanTalk