GUI cursor, MoveCharacter, and unhandled_event questions [SOLVED x3]

Started by NiksterG, Sat 26/03/2005 17:24:03

Previous topic - Next topic

NiksterG

I have three question to ask:

1) Is it possible to move a character across the room WITHOUT having them activate a Player stands in Hotspot interaction? Or maybe is there a ignore hotspot script command? (The hotspot I'm referring to stretches across the top to the bottom of the room, that's why I'm asking.)

2) I am trying to make a custom inventory GUI that includes a interaction button (hand). I've set up the script, but everytime I click on an inventory item with that cursor, it activates that item, just like the select button does. I checked the script, and realized that the select button is the same as the interact button, only with a different image! Is there any way to correct this?

and lastly...

3) How do I make an unhandled_event for using one inventory item on another? I found some info in the manual, but it wasn't really specific. I know it has something to do with the numbers 5 and 3, but I am not sure what the script should be.

If anyone could help me with any of these problems, I would much appreciate it.Ã,  ;D
Check out my games! (Not all made with AGS)

Ishmael

Quote from: niksterg on Sat 26/03/2005 17:24:03
1) Is it possible to move a character across the room WITHOUT having them activate a Player stands in Hotspot interaction? Or maybe is there a ignore hotspot script command? (The hotspot I'm referring to stretches across the top to the bottom of the room, that's why I'm asking.)

Set up a variable, and set it to 1 before executing the MoveCharacter command, and set it back to 0 when the move is finished, and in the hotspot interation check if the variable is 1, and if so, don't run any scripts.

At the top of the room script:

int hotspon;

and in the hotspot interaction:

Ã,  if (hotspon == 0) {
Ã,  Ã,  // your interaction script goes here
Ã,  }

Quote2) I am trying to make a custom inventory GUI that includes a interaction button (hand). I've set up the script, but everytime I click on an inventory item with that cursor, it activates that item, just like the select button does. I checked the script, and realized that the select button is the same as the interact button, only with a different image! Is there any way to correct this?

The standard interact-mode selects the clicked item, so you need to do:

Ã,  if (button == LEFTINV) {
Ã,  Ã,  if (GetCursorMode() < 4) { // if one of the standard modes is in use
Ã,  Ã,  RunInventoryInteraction(game.inv_activated, GetCursorMode());
Ã,  Ã,  } else if (GetCursorMode() == 6) { // if the 'pointer' mode is selected
Ã,  Ã,  Ã,  character[GetPlayerCharacter()].activeinv == game.inv_activated; // set the selected item as
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, // the active inventory item
Ã,  Ã,  Ã,  SetCursorMode (4); // set to the inventory cursor mode
Ã,  Ã,  }
Ã,  }

In the on_mouse_click global function, and have the "Handle inventory clicks in script" checked in the General section.

Quote3) How do I make an unhandled_event for using one inventory item on another? I found some info in the manual, but it wasn't really specific. I know it has something to do with the numbers 5 and 3, but I am not sure what the script should be.

You've read the reference correctly thus far. The bit of script you are looking for is:

function unhandled_event (int what, int type) {
Ã,  if (what == 5) { // inventory item in question
Ã,  Ã,  if (type == 3) { // inventory on another
Ã,  Ã,  Ã,  Display("I can't do that.");
Ã,  Ã,  }
Ã,  }
}


I hope that covers at least some of it...
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.

NiksterG

Okay, problem number three is solved. However, the script for the other two are not right. In the MoveCharacter problem, I want the character to move across the screen, but not have the player see it. I tried using FadeOut and FadeIn commands, but the character walks at the wrong time.

In problem number two, I get an error message that reads "PE04: Parse error at 'character'." Is that correctible? ???
Check out my games! (Not all made with AGS)

Ishmael

Oh, I'm sorry, I thought you meant the character actually walking across the screen. To just simply put them on a diffrent spot on the screen, modify the character[CHARID].x and character[CHARID].y variables to reflect the co-ordinates of the location you want the character to be on.

And for the second:

character[GetPlayerCharacter()].activeinv = game.inv_activated;

One equal sign extra, my bad, sorry.
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.

NiksterG

*sigh* I think the program is against me. I tried both of your recommendations, both did not work.

For the Move problem, do I actually write CHARID, or do I substitute in the name of my character? And do I type

character[EGO].x = 85,     or do I write something else?


For the other one, I still think there's something wrong with the "character". (It's still giving me parse error)
Check out my games! (Not all made with AGS)

DoorKnobHandle

is that a typo:

character[EGO].x = 85;

that'd be correct apart from the last character!

NiksterG

Great! That problem has been solved! :D Now there's just that custom GUI problem. Of course, that's the most important one.Ã,  ::) Well, help me if you can, PLEASE!
Check out my games! (Not all made with AGS)

NiksterG

Okay, after experimenting with the scripting (and being extremely frustrated) I decided on a different approach. I set the button on the GUI to switch to mode 8 (Usermode1). Then, I went to the inventory item and clicked on the interactions button. I then set what I wanted to happen under "Other click on inventory item". That solved that problem! Thanx for your help with the other problems!Ã,  ;D
Check out my games! (Not all made with AGS)

SMF spam blocked by CleanTalk