Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Vincent

#461
However as Snarky prompt before I would check the (Custom Properties) because are very handly :)
You can create a custom property for "Default event", for example, and then have some simple code in the global script to use the setting accordingly.
You'll notice that characters, objects, hotspots, rooms and inventory items all have a "Properties" option in their property grids.
Click the 'Edit Schema' button and choose "Add property".
You can set various options about the new property for example:

Type - this specifies what type of property you want. "Text" gives you a larger text box which can store a string.

To access the properties from the script, there are various script functions.
See their descriptions for how they work.
By the way, all that I have written is documented in the manual.


Quote from: MiteWiseacreLives! on Fri 06/11/2015 16:40:33
is myHotspot a String, Int or a Pointer  ??? ??? ???

Should not be that hard to guess :D
Formerly known as global function GetLocationName,
static String Game.GetLocationName(int x, int y)

#462
I think that the method you are using is just fine.
If you need to pass your String from a room in to the Global script you can easily create a Global String from the editor panel (Global variables) and add a new variable String that you can access everywhere :)
#463
You are actually use
Code: ags

location = Game.GetLocationName(mouse.x, mouse.y); 

to get the name of whatever the mouse is over into the string variable.
If the co-ordinates are on a GUI, a blank string is returned.

I'm not sure if it will make a difference,
Try to create another gui with a label, then you rename the label text in the editor with @OVERHOTSPOT@
This special mark get the name of the hotspot which the cursor is over.
#464
I am not sure how to explain that easily.
If you can post your 'GlobalScript' here, I can show you where you will need to do that.
#465
Yes, Indeed.
The function repeatedly_execute() is already defined in the GlobalScript.
You will have to copy the inside of the repeatedly_execute that I wrote and paste it to the Global one.
Same for the function on_mouse_click.

However, in every each room, you can have a different repeatedly_execute from the Global one.
If you need that for a room only, paste everything to a room script.
#466
BINGO !!!
To detain a double click of the mouse I would do something like this :

// GlobalScript.ash
Code: ags

#define MOUSE_DOUBLECLICK_RATE  10 // Double click delay 



// GlobalScript.asc
Code: ags

// top of the script
int double_click;

function repeatedly_execute() 
{
  // DoubleClick recognizer
  if (double_click > MOUSE_DOUBLECLICK_RATE)
  {
    double_click = 0;
  }
  else if (double_click)
  {
    double_click ++;
  }
}



function on_mouse_click(MouseButton button) 
{
  if (button == eMouseLeft) 
  {
    if (!double_click)
    {
      // user performed a Single click (walk)
      double_click ++;
    }
    else
    {
      // user performed a Double Click (run)
    }
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
} 


Not tested, however I think there are several ways to achieve that.
I hope it could give you the idea.
#467
You've forgotten the magic word. :cool:
#468
I think you can do something like this indeed :smiley:
Code: ags

function on_mouse_click(MouseButton button)
{
  InventoryItem*i = inventory[game.inv_activated];
  
  if (button == eMouseLeftInv) 
  {
    if (mouse.Mode == eModeUseinv) i.RunInteraction(eModeUseinv);  // use current item with i
    else player.ActiveInventory = i; // select activated item
  }

  else if (button == eMouseRight) 
  {
    if (mouse.Mode == eModeUseinv) 
    {
      player.ActiveInventory = null; // deselect activated item
      mouse.Mode = eModePointer;
    }
  }
}


Then I think you can use to check the mouse mode over the inventory window in this way
Code: ags

// rep_exe
GUIControl*theControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (theControl == invCustomInv) // Mouse over inventory window ("invCustomInv" or the name you have replace in the editor)
{
  // Change mouse mode
}

else if (theControl == null) // The mouse is not over a control
{
  // Change mouse mode
}
#469
I think there's a lots of ways to to that.
If you want that happen only one time you can try to do something like with :

Booleans
Code: ags

bool First_time; // global boolean set to true
function room_AfterFadeIn()
{
  if (First_time) // <---- First time for the cutscene, true
  {
    if ( player.Y < 0 )
    {
     First_time = false; //<----- so it will happen just one time
     //cut scene commands...
     //if you want to end the cut scene by sending the player back to their previous room:
     player.ChangeRoom(player.PreviousRoom, player.X, player.Y * -1);
    }
  }
}


Or you could check this also by a nice function :

Code: ags

function room_AfterFadeIn()
{
  if (Game.DoOnceOnly("First_cutscene")) // 
  {
    if ( player.Y < 0 )
    {
     //cut scene commands...
     //if you want to end the cut scene by sending the player back to their previous room:
     player.ChangeRoom(player.PreviousRoom, player.X, player.Y * -1);
    }
  }
}



:EDIT: Quote from the manual
Be Very careful with where you place the corresponding EndCutscene command. The script must pass through EndCutscene in its normal run in order for the skipping to work - otherwhise, when the player presses ESC the game could appear to hang.
#470
Ah, si ! I just realize it now.
I could change the two buttons mapping via Windows to be just for example (new left click and new right click)
so in this way the two buttons can be found on Ags.
I was wonder if we could check a new button entrance for the enumerations mouse buttons.
But as Crimson Wizard said, Ags does not have appropriate constants for them defined (like eForthMouseButton) so that will not make the difference at all.
Actually is just a testing purpose for my new mouse on Ags and needs no workaround luckly :)
Although, for my taste, I will never use these additional buttons of the mouse on an Adventure game.
Grazie mille again Ghost for reply, Greetings.
#471
Ciao Ghost, I am glad to hear from you and from Crimson Wizard.
Thank you very much for the reply.
It is nice to hear that these last two buttons can be mapped somehow inside Ags.
But how to configure their mapping in the system ?
I should don't need to set them to a particular key codes, but only to be recognizable inside Ags.
#472
Beginners' Technical Questions / Mouse Buttons
Sat 31/10/2015 17:35:54
Good evening to all AGSer,

I recently bought a new mouse and it has five buttons instead of the classics two or three.
I was trying to map the last two buttons but I can't find a way to make them recognizable to Ags.
When I use the last two buttons they work like (page next and page previous)
Someone know how to do that or if it is possible to do that ?

Grazie mille in advance.
#473
Quote from: MiteWiseacreLives! on Wed 21/10/2015 07:27:25
-sorry. See fix above

I Think that's okay :)

Quote from: Nixxon on Tue 20/10/2015 12:12:10
I wanted to 'do away' with the inventory button/ui completely and simply use the inventory window

I think it can be useful to have a look at this section too in the manual.
GetAtScreenXY (GUI control)
Checks whether there is a GUI control at screen co-ordinates(X,Y). Returns the control object if there is, or null if there is not.
You probably want to use this in conjunction with GUI.GetAtScreenXY(mouse.x, mouse.y);
Code: ags

GuiControl *theControl = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
if (theControl == invCustomInv)
{
  Display("The mouse is over the Inventory window.");
}
else if (theControl == null)
{
  Display("The mouse is not over a control.");
}
else
{
  GUI *onGui = theControl.OwningGUI;
  Display("The mouse is over control %d on GUI %d", theControl.ID, onGui.ID);
} 
#474
Here there's an error :

Code: ags

    if (overmenubar= false) //here
    {
    }
  else
  {
    if (overmenubar= true) //and here too
    {
    }    
}

#475
I believe you will need to see these sections into the manual

// Game.GetViewFrame
// Returns a ViewFrame instance for the specified frame in the specified loop of the specified view.
// This instance allows you to query properties of the frame itself, such as its graphic, its frame -linked sound setting, and so forth.
Code: ags

// example
ViewFrame *frame = Game.GetViewFrame(SWIMMING, 2, 3);
Display("Frame 3 in loop 2 of view SWIMMING has sprite slot %d.", frame.Graphic);



// Game.GetLoopCountForView
// Returns the number of loops in the specified view
Code: ags

// example
int loops = Game.GetLoopCountForView(SWIMMING);
Display("The SWIMMING view (view %d) has %d loops.", SWIMMING, loops);



// Game.GetFrameCountForLoop
// Returns the number of frames in the specified loop of the specified view.
Code: ags

// example
int frameCount = Game.GetFrameCountForLoop(SWIMMNG, 2);
Display("Loop 2 in SWIMMING view has %d frames.", frameCount);
#476
I think it depend how you handled to cycle the frames in a loop, probably there's a mistake somewhere else..
#477
I believe you can use a global String..
Code: ags

String Player_name; // you use the String to define the name

// then you can do something like this
Player.Name = String.Format("%s", Player_name);

// you can set this string how you prefer 
Player_name = "";
Player_name = "Chef A";

// and if you need you can use to check the name if it is empty or null with String.IsEmptyOrNull
#478
Bellooo Bravo AprilSkies ;-D
#479
Hello guys, thanks so much for your replies they have been very helpful :)
Many thanks to Snarky too for showing a correct way to achieve this.
I roughly managed to get something nice along with your example,
I was able to simulate the ball movements with bounces off the sides and Ball-to-ball collisions work just GREAT!!!(nod)
The hard thing now is to give the right direction/angle where to go if the ball collide each other or hit the table :X
#480
I have been trying to implement a billiard table into my game but I am having a few problems with the actual physics of the table and balls.
I have been trying to move the balls with a variable speed for x and y for the ball objects but I can't seem to find a good way of stopping them when they collide with another ball or edges of the table.
Also, I am having trouble with the rebound directions the balls take when they collide with the edges of the table or the other balls.
I have tried many different ways of achieving the physics, or the feel of actual physics, in my billiard game I seem to be unable to make it all work how I would like.
If anyone could help me to start building a physics engine for my billiard game, then I would be most grateful. :)

Grazie mille
SMF spam blocked by CleanTalk