LucasArts style status bar

Started by Erica McLane, Mon 26/05/2003 13:43:21

Previous topic - Next topic

Ishmael

#20
You'll need to either use the default interaction modes, in which clicking the Interact mode on an inventory item (through ProcessClick(mouse.x,mouse,y,GetCursorMode())) selects the Inventory mode and sets the active item (atleast it used to... the Interact mode does not actually interact the item)

Or, you can do it by scripting, adding into on_mouse_click in the global script: (AGS 2.62 scripting, I'm not that familiar with the newer one yet, but this should still work)

Ã,  if (button == LEFTINV) {
Ã,  Ã,  SetActiveInventory(GetInvAt(mouse.x,mouse.y));
Ã,  Ã,  SetCursorMode(4);
Ã,  }

(I hope I remembered the function names right...)

To actually Interact the items (run the Interact script in the inv item interactions) You'll need to do

Ã,  if ((button == LEFTINV) && (GetCurosrMode() == 8)) {
Ã,  Ã,  InteractInventory(GetInvAt(mouse.x,mouse.y));
Ã,  }
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

six_plus_one

Alright, so I added those codes in their respective sections, but I'm getting and 'Error: undefined token: InteractInventory' message when I try to run the game. I think the script editor is saying that InteractInventory isn't a correct function name, (no auto-complete window comes up when I type it in). Do you know what the function name is supposed to be or if the problem is a result of something else being off in my script or something?

Sorry again to be a bother. Thank you very much, Ishmael, for taking time to help me with this problem. Hopefully I am getting close to a successful resolution here.Ã,  :)

Ishmael

#22
Ah, forgive me, I think I confused it with one of my "alias" tests, the function is RunInventoryInteraction(int inv, int curmode); in the old scripting, if I remember it right this time...

Ã,  if ((button == LEFTINV) && (GetCurosrMode() == 8)) {
Ã,  Ã,  RunInventoryInteraction(GetInvAt(mouse.x,mouse.y), MODE_USE);
Ã,  }
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

six_plus_one

Gawd, I MUST be a lost cause. Now it's telling me "Error: GetInvName: invalid inventory item specified" for the line:

GetInvName(character[GetPlayerCharacter()].activeinv,usinginv);

I noticed that when I disable (//) the line that tells a click on the INV GUI button in question to SetCursorMode to(8); that the game does not crash, nor does it register the button click.

So I suppose the problem occurs when the cursor mode gets set to 8, and from there it runs the GetInvName line above. I'm thinking that this must mean that no inventory item is being selected because of the fact that the (GetInvAt(mouse.x,mouse.y) doesn't set any inventory item as that command happens when the mouse is over a GUI button not an inventory item.

But I'm thinking: I don't want to have a click on GUI button set an active inventory item, so maybe the key is to put a conditional line in the script for the "if (GetCursorMode()==8) {" part:

(i.e.: something like "if NO active inventory is set then do nothing, if active inventory IS set then proceed as planned").

Perhaps this would remedy both the crashing and the unresponsive button problem. (???) Maybe someone can help me figure out some prospective code for this. :)

Ishmael

You could try this:

  if ((button == LEFTINV) && (GetCurosrMode() == 8)) {
    SetActiveInventory(GetInvAt(mouse.x,mouse.y));
    RunInventoryInteraction(GetInvAt(mouse.x,mouse.y), MODE_USE);
  }

if it'd rid you from the error...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

six_plus_one

Well... due to my UTTER inneptitude with coding, I've decided to go ahead and just simplify the status bar. Now a click on the "Use" GUI button VERY simply does:

SetActiveInventory(-1);
SetCursorMode(8);

And the function repetedly_execute() portion of my script goes simply:

Ã,  if (GetCursorMode()==0) SetLabelText(0,0,"Walk to @OVERHOTSPOT@");
Ã,  if (GetCursorMode()==1) SetLabelText(0,0,"Look at @OVERHOTSPOT@");
Ã,  if (GetCursorMode()==2) SetLabelText(0,0,"Use @OVERHOTSPOT@");
Ã,  if (GetCursorMode()==3) SetLabelText(0,0,"Talk to @OVERHOTSPOT@");
Ã,  if (GetCursorMode()==8) SetLabelText(0,0,"Eat or wear @OVERHOTSPOT@");

This, while not perfect, seems to have the buttons and status bar working fine without crashing, except that it does not display, for example when in cursor mode 2, "Use (item A) on (item B)" when an active inventory item is set.

I know this IS what Ishmael was probably trying to give me help with (and by the way, thanks so much for your help, Ish, and sorry that I wasn't able to put your code to better use), but does anyone know of a very simple way to have the status bar display "Use (active inventory item) on @OVERHOTSPOT@" when and only when there is an active inventory item?

If it winds up likewise waaay too complicated for me to implement then I'm fine without it, but it would make the status bar act just the way I wanted.

Scorpiorus

Quote from: six_plus_one...but does anyone know of a very simple way to have the status bar display "Use (active inventory item) on @OVERHOTSPOT@" when and only when there is an active inventory item?
Well, when the player has an active inventory item the cursor mode number 4 becomes available (MODE_USEINV). You can use it to display "Use X on Y" sort of thing:

repeatedly_execute:

if (GetCursorMode()==0) SetLabelText(0,0,"Walk to @OVERHOTSPOT@");
if (GetCursorMode()==1) SetLabelText(0,0,"Look at @OVERHOTSPOT@");
if (GetCursorMode()==2) SetLabelText(0,0,"Use @OVERHOTSPOT@");
if (GetCursorMode()==3) SetLabelText(0,0,"Talk to @OVERHOTSPOT@");
if (GetCursorMode()==8) SetLabelText(0,0,"Eat or wear @OVERHOTSPOT@");

//------------------
// Use X on Y:
//------------------
if (GetCursorMode()==MODE_USEINV) {
Ã,  Ã, 
Ã,  Ã,  string text;
Ã,  Ã, 
Ã,  Ã,  GetInvName(character[GetPlayerCharacter()].activeinv, text); // get name of the active inventory item
Ã,  Ã, 
Ã,  Ã,  StrFormat(text, "Use %s on @OVERHOTSPOT@", text); // form a text to display
Ã,  Ã, 
Ã,  Ã,  SetLabelText(0,0,text); // display it on the label
}

See if it works for you.

six_plus_one

Ohmygawd! Yes!! :D

It works! It actually, really works!! Thank you so much Ish and Scorp!! :)

I'll make sure to take a good, hard look at these lines of code as well, I'm sure they will be instructive in my understanding of this language... Yipee! It works!!Ã,  ;D

:)Ã,  THANK YOU SOOOOO MUCH AGAIN GUYS!!!Ã,  :)Ã,  Ã, ...*freaks and dies of elation*

Ishmael

I reckon I should reformat that code to the new scripting and maybe put in some commentary on what does which part actually do :P
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

JQ

it says that GetCursorMode is an undefined symbol, why does that happen?

Ashen

Because this code is 2 years old, and GetCursorMode is now obsolete. (AGS now uses mouse.Mode instead.)

There's a newer version of this floating around somewhere, I think SSH's Description Module can handle it, or you could try updating this version for yourself. Look up the commands that give 'undefined token' errors in the manual to find the current equivalent.
I know what you're thinking ... Don't think that.


JQ

but the download links are bad, where can i dowload that module?

Dualnames

If you were more careful you would notice that this thread is way old. And there is a thread about Lucas Arts GUI. You'll find plenty of modules there..
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)


Dualnames

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=24112.0

Here. Try searching the forum as well for more. And check the technical forum for old templates. Most of the download links work..
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ashen

The templates in that thread aren't without their compatability problems, either, but if you make sure to get the newest you should be OK. However, that covers the whole LucasArts-style GUI, not just the status bar bit, so you may need to do a bit of fiddling to trim it down to what you need.

SSH's module download seems to work OK now. I tested it before I posted, and it was fine, I tested it when QaP said it was bad - and it'd broken sometime in that 24-hour period. I just tested it again and it's working. So QaP, if you're still around and interested - get in there quick. It has the advantage over the template of ONLY doing the statusline bit. Of course, if you want the whole LEC GUI, go for the template.
I know what you're thinking ... Don't think that.

SSH

The module is on the same server as the forums, so dunno why it should have broken. Blame hajo! Or AGA.
12

JQ

I downloaded the description module, but i cant make it work, so i send a pm message to ssh yesterday and i-m waiting for response. I just posted this to let you know im still interested in the module.

Tigga

Hey.... i want to have a lucas arts status bar too
i tried this :)

---
if (GetCursorMode()==Walk to) SetLabelText(1,2,"Go to @OVERHOTSPOT@")
  if (GetCursorMode()==1) SetLabelText(0,0,"Look at @OVERHOTSPOT@")
  if (GetCursorMode()==2) SetLabelText(0,0,"Interact with @OVERHOTSPOT@")
  if (GetCursorMode()==3) SetLabelText(0,0,"Talk to @OVERHOTSPOT@")
  if (GetCursorMode()==4) {
    string usinginv;
    string useinvtxt;
    StrCopy (useinvtxt, "Use ");
    GetInvName(character[GetPlayerCharacter()].activeinv,usinginv);
    StrCat (useinvtxt,usinginv);
    StrCat (useinvtxt," with ");
    StrCat (useinvtxt,"@OVERHOTSPOT@");
    SetLabelText(0,0,useinvtxt);
  }

shown in this forum but it not work
error message at compiling

output window :

GlobalScript.asc(60): Error (line 60): undefined symbol 'GetCursorMode'

i cant help my self

anyway...thx

SMF spam blocked by CleanTalk