Simple interaction questions.

Started by Molin, Mon 11/08/2003 14:25:11

Previous topic - Next topic

Molin

Hi all.
Im new to this editor and i like it so far.
I have some questions about scripting a few cursor and action related issues.

First of, I want to "copy" the functionality of the "Beneath a steel sky" cursor behaviour.

SO... Is there a way that one can script a global function that does this..
SetCursorMode() to swap cursorgfx and mode over hotspots. THEN change back when the user exits the hotspot.
LEFTCLICK should be "lookat" and RIGHTCLICK should be "interact/use".

Thx for any help or pointers...
ALSO i dont use the beta version of the AGS so i cant use any lucasarts GUI that you guys have posted that probably have these funtions.

Scummbuddy

why not, the final version 2.56 has been posted in the technical forum.  ;)
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Molin

#2
hm they dont have what i am looking for. Any help on what i just asked? anyone?

Ginny

#3
Ok, I think this is the way to do it:

First of all, as I understand, you want the cursor to change to talking mode when over characters, use mode when over hotspots and objects, and walk mode when on nothing. And you want right clicking to run the appropriate interaction. In left click, you want it to look at the object/hotspot/character.

So, in the on_mouse_click function:

 else if (button==LEFT) {
   ProcessClick(mouse.x, mouse.y, MODE_LOOK); // look mode
 }
 else {   // right-click
     ProcessClick(mouse.x, mouse.y, GetCursorMode()); // the currently selected mode
 }

And in repeatedly_execute:

 if ((GetLocationType(mouse.x,mouse.y)==1) || (GetLocationType(mouse.x,mouse.y==3)) {
 SetCursorMode(2); // use mode on characters and hotspots
 }

 else if (GetLocationType(mouse.x,mouse.y)==2) {
 SetCursorMode(3); // talk mode on characters
 }
 else if (GetLocationType(mouse.x,mouse.y)==0) {
 SetCursorMode(0); // walk mode on nothing
 }

This should work.

Also, I would use left click for interactions and right click for looking, but however you want :).

P.s. You should probably turn off the normal interface, and have the inventory popup when a certain key is pressed for example, or aomething like that. :)

I used the newest version, but it'll work in the older one too (2.55).
I reccomend downloading th new version though, it has many new features! :)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

Molin

hey hey hey!!! O NICE!  ;D

Thx a bunch GinnyW!.  I begin to understand the syntax and script structure as well now so pretty soon ill be off on my own wings.

Ill try installing it and try it out!


Ginny

#5
You welcome ;)

I too am just starting out, though I've been registered for almost a year here :P.
I suppose I just didn't have time, but now that I've started I love it! ;D :)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

Proskrito

Quote from: GinnyW on Mon 11/08/2003 17:48:59
And in repeatedly_execute:

 if ((GetLocationType(mouse.x,mouse.y)==1) || (GetLocationType(mouse.x,mouse.y==3)) {
 SetCursorMode(2); // use mode on characters and hotspots
 }
Oh GinnyW forgot a ')' !  ;)
that should be:
if ((GetLocationType(mouse.x,mouse.y)==1) || (GetLocationType(mouse.x,mouse.y)==3)){
 SetCursorMode(2);
}
just in case  :)

Ginny

#7
Oops, lol.. ;)
It's strange that in the editor there is a ')' there, I tested this on a blank game you see.
Maybe it just got erased when I copied it, hehe.
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

Molin

hehe i did notice the missing bracket. No prb i figured it out though BUT bunch of thx for helping me with the script!

now ill try just to get rid of that clock appearing every now and then.... 8) a flickering mousecursor is wery annoying.

Molin

i added a statement so that i can walk with the left button.

else if (button==LEFT && GetCursorMode() == 2 ) {
ProcessClick(mouse.x, mouse.y, MODE_LOOK); // look mode
}
else if (button==LEFT && GetCursorMode() == 0 ) {
ProcessClick(mouse.x, mouse.y, MODE_WALK); // walk mode
}
else { // right-click
ProcessClick(mouse.x, mouse.y, GetCursorMode()); // the currently selected mode


It would probably be nicer with a variable to set instead of all the ifstatements.. but heyit works anyway...:P

Ginny

#10
Great idea! Looks like you're a very quick learner :).

edit:
I found a little fault with this, when you take an inventory item out of the inventory, it dissapears since the mode is changed, so here is a slicht change:

if (character[GetPlayerCharacter()].activeinv == -1) {
 if ((GetLocationType(mouse.x,mouse.y)==1) || (GetLocationType(mouse.x,mouse.y)==3)) {
 SetCursorMode(2);
 SetMouseCursor(2);
 }

 else if (GetLocationType(mouse.x,mouse.y)==2) {
 SetCursorMode(3);
 SetMouseCursor(3);
 }
 else if (GetLocationType(mouse.x,mouse.y)==0) {
 SetCursorMode(0);
 SetMouseCursor(0);
 }
}

Now items will stay selected.
Also:

 else if (button==LEFT) {
  if (character[GetPlayerCharacter()].activeinv == -1) {
   ProcessClick(mouse.x, mouse.y, MODE_LOOK);
  }
  else {
    RunInventoryInteraction (character[GetPlayerCharacter()].activeinv, MODE_LOOK);
  }
 }

I did this so that if the character is holding and item, he would look at the item he's "holding" instead of whatever is on the screen.

:)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

Molin

#11
hey man
thx a bunch!. I havent gotten to the ui handling as of yet.
I have done this simple ui slider though...

// <DM> define ui timer
int timer = -22; //timer equals the ui height -1
function repeatedly_execute() {
// put anything you want to happen every game cycle here

// <DM> UI slidedown
if (mouse.y <= (timer+23))
{
 if (timer <= -1) {
   timer++; SetGUIPosition(2,0,timer);
 }
}
// <DM> UI slideup
else
{
 if (timer >= -22) {
   timer--; SetGUIPosition(2,0,timer);
 }
}
/Molin

martinreichl

I wonder if it is possible to display the name of an hotspot or object next to the cursor while the cursor is over the object or hotspot.
I´ve done a search in the forums, but without any results that helped me.


just like in BASS.

that whould be great!

greetingz ,
Martin

P.S.: I have to apologize for my bad englisch skills, it isn´t my native anguage!

Molin

yo martinreichl
i did this for you  .. it does what you wanted...
click to go to the post...

http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=7913

ravenfusion

lol at Ginny, i've only just started, even though I've followed AGS since the dos versions. :)

martinreichl

thank you very very much Molin!

it works perfectlyyyyyy!  

very nice people here!

SMF spam blocked by CleanTalk