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

#1
Hi, its me again, with a problem that I really have no clue(I remained totally clueless) how to fix !
 For some reason in my game any click registers as x2 click. For example, If I want to trigger an animation via hotspot click, even if I assign the view as eOnce, it behaves like I click it 2 times, animating it TWICE at once. The same if I had - say - a keypad puzzle, it registers the clicks as x2 times. I have a script that changes the cursor while hovering over objects, but It does not change the 'cursor mode', - but the graphics of the cursor...I dont know why that is happening D:
I think I need to post all  the script from my on mouse click from the global script and anything related to the mouse in general,


I really cant see why this happens 😦
for example while triggering GUI's, it only registers 'one' click, not x2 as it does on anything related to adding characters to strings or triggering animations








 
Code: ags


// called when a mouse button is clicked
function on_mouse_click(MouseButton button)
{
 if (button == eMouseLeft) {
    // left-clicking nothing with active inv item
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing && player.ActiveInventory != null) {
      player.ActiveInventory = null;
      Mouse.Mode = eModeInteract;
    }
    else Room.ProcessClick(mouse.x, mouse.y, Mouse.Mode);
  }





 (its a script that makes you able to click away with an inventory item and make it dissapear, returning the 'normal' cursor) 


And the one that changes the mouse graphic while hovering over hotspots/objects
Code: ags
function repeatedly_execute()
{
  if (player.ActiveInventory ==null){
    if (GetLocationType(mouse.x, mouse.y) != eLocationNothing) {
        // Set the variable to true when the mouse is over a hotspot
        if (!isOverHotspot) {
            // Execute global script only when entering a hotspot
            Mouse.ChangeModeGraphic(mouse.Mode, 24);
            aMousetape.Play();
        }
        isOverHotspot = true;
    } else {
        // If the mouse is not over a hotspot, execute the global script
        if (!isOverHotspot) {
            Mouse.ChangeModeGraphic(mouse.Mode, 22);
        }
        // Reset the variable
        isOverHotspot = false;
    }
}
}
I also did some weird stuff to be able to add my own 'cursor graphic' on some very specific hotspots(thus disabling the always execute thing)

Code: ags
  
function on_mouse_over_hotspot()
{
    // Disable global script when over a hotspot
    isOverHotspot = true;
}

// Handle mouse leave hotspot event
function on_mouse_leave_hotspot()
{
    // Enable global script when leaving a hotspot
    isOverHotspot = false;
}








 >:(  >:(  >:(  >:(  >:(  Im sure its because of the way I implemented these scripts ! (For context, the objects/hotspots that trigger certain events that play x2  times are linked only once. I tried to change the 'any click' from 'interact' and whatnot, and its still the same behaviour)




#2
Im not really sure. I also encounter this problem if I somehow assign a view (play only once) on an object and make it get triggered via a hotspot click. it behaves like it is clicked 2 times. I tried to change modes (any click or interact with hotspot etc) but it still behaves like i click it 2 times. could it be because I made a global script to change the cursor while hovering over hotspot/objects ?
#3
also used your keypad click function, it works perfectly, but the same problem persists. for some reason, the click registers 2 times at once
#4
Quote from: Khris on Sun 11/02/2024 12:35:57Add
Code: ags
  Display(playerSequence);
as the first line in your CheckPassword function.
What does it show?

Also note that you can do this:
Code: ags
function keypad_Click() {
  Object* o = Object.GetAtScreenXY(mouse.x, mouse.y);
  if (o == null) return;
  playerSequence = playerSequence.AppendChar('0' + o.ID); // make sure each object ID matches its digit
  aAkeypad.Play();
}

Now paste keypad_Click into each digit button object's event table.




regarding the Display part on the first line of the script. for some reason, it seems that it 'doubles' the digits. if i press 6 8 0, it shows as 66 88 00. I'm also making sure I press only once.
#5
Quote from: Khris on Tue 09/01/2024 22:57:10You need something like this:

Code: ags
  if (button == eMouseLeft) {
    // left-clicking nothing with active inv item
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing && player.ActiveInventory != null) {
      player.ActiveInventory = null;
      Mouse.Mode = eModeInteract;
    }
    else Room.ProcessClick(mouse.x, mouse.y, Mouse.Mode);
  }



This works perfectly, thanks a lot ! my ags saviour B)
#6
Hi !
I'm trying to make a keypad puzzle.
Basically what I've done first, is create a global variable called 'player sequence' with its initial value, as nothing

Then, I made the following code
Code: ags
function room_Load() {
   playerSequence = "";
}

function CheckPassword() {
if (playerSequence.EndsWith("680")) { 
Display("Password Detection works debug thing");
}
else { 
Display("wrong password debug thing!");
playerSequence = "";
}
}





function oObject6_AnyClick()
{
playerSequence = playerSequence.AppendChar('6');
aAkeypad.Play();
}

function oObject1_AnyClick()
{
aAkeypad.Play();
CheckPassword();
}

function oObject3_AnyClick()
{
playerSequence = playerSequence.AppendChar('8');
aAkeypad.Play();
}

function oObject4_AnyClick()
{
playerSequence = playerSequence.AppendChar('0');
aAkeypad.Play();
}



So, each button would add a character to the playersequence string.
The button that has just 'check password' is a button resembling the enter button.

Now, the weird behaviour that im encountering, is for example. if I would add 'string ends with' a repeating number, for example 888, or 000, the code will work without problems.

But : If I add different numbers, such as in my case, lets say, 680, regardless if I press 6 8 0 in order, it still will give the display/debug message as the password would be incorrect !
Im so confused, could anyone give me some insight regarding this matter?


#7
Hi Khris, could you please give a more detailed example ? Due to my own personal error I cannot make it work ! I think Im writting it all wrong. Could you give me an example ? And yes, I used that code on the on mouse click  event
#8
Hi !
I have a very noobish problem.
I want to make it so that after the cursor changes based on the item sprite, if you click 'away' , or on a hotspot that has no correlation with the "useinv"function, to make the cursor go back to normal. When I use the inventory item(along with its cursor) to a designated hotspot that that useinv function, the cursor goes back to normal(as expected), but If i dont use the item anywhere, its impossible to 'deselect' the item along with its cursor.

Sadly, so far  I failed in my attempts to do this. Can anyone help me ?


For context, I have the following script that changes my cursor based on hovering over hotspots/objects etc. I think maybe it will give more context

Code: ags
function repeatedly_execute()
{
  if (player.ActiveInventory ==null){
    if (GetLocationType(mouse.x, mouse.y) != eLocationNothing) {
        // Set the variable to true when the mouse is over a hotspot
        if (!isOverHotspot) {
            // Execute global script only when entering a hotspot
            Mouse.ChangeModeGraphic(mouse.Mode, 24);
            aMmove.Play();
        }
        isOverHotspot = true;
    } else {
        // If the mouse is not over a hotspot, execute the global script
        if (!isOverHotspot) {
            Mouse.ChangeModeGraphic(mouse.Mode, 22);
        }
        // Reset the variable
        isOverHotspot = false;
    }
}
}



BUT
 so far, I tried to do the following regarding what I tried to achieve :


Code: ags
if (player.ActiveInventory != null) //An inventory item is selected
{
  player.ActiveInventory = null;
  mouse.Mode = eModeInteract;
}

But here the problem is that it completely annihilates and ignores the useinv function, it just changes the mouse cursor after I click on an inventory and CLICK anywhere, and prevents the item's usage. I checked other threads but none of the solutions worked :( :~(  :~(
#9
Hey ! Thanks a lot !
I released a short demo if anyone is interested.
Thank you for the appreciation and for encouraging also !
#10
bruhhh I love these kind of games ! its amazing ! i will play it right now
#11
Very interesting !  I dont know why, but it gives me some downfall vibes !
#12
Hi !
I'm working on an atmospheric/surreal first person point and click game.
It will have some interesting mechanics, inspired by my dreams.
You are in an outwordly place - an nightmarish world - at the edge of the world, literally.
The game will have multiple endings and depends on what you will chose during the playthrough.
I just wanted to show my creation, and any kind of feedback is VERY welcome !
I released a short demo here ! I would gladly appreciate your feedback since im a begginer and i'm really open to criticism of any kind !

Demo :  https://phonoitypal.itch.io/phonoi
Some of the images are placeholders and will not look that 'unpolished' when the game will be finished !





And some actual gameplay:(old)
#13
I FIXED IT.
OMG I'M so noobish.
Actually, I didn't need this code at all
Code: ags

function on_mouse_click(MouseButton button)
{
  if (player.ActiveInventory != null) //An inventory item is selected
{
  player.ActiveInventory = null;
  mouse.Mode = eModeInteract;
}




The cursor 'gets back to normal' after executing the useinv propriety.
That code actually prevented the item from being used !
#14
I should also mention i think that I dont use any other 'mouse modes' other than the interact one, since i used a blank template
#15
Hi, I have some problems regarding the usage of inventory items.

I'm making a first person game, and I created my custom inventory.
The items work just fine(they appear on the gui), the gui is set alright with its own window, item appears where its supposed to.
Also, room scripts regarding  "if (player.HasInventory(iItemName))" work !

The problem appears when trying to use the inventory ITEM on a hotspot that has the property
"player.ActiveInventory==iItemName)".

The item of the cursor changes as the one of the item, but it doesent seem to work.


I have the following global script that I think it may cause the problem


Code: ags
// called on every game cycle, except when the game is blocked
function repeatedly_execute()
{
  if (player.ActiveInventory ==null){
    if (GetLocationType(mouse.x, mouse.y) != eLocationNothing) {
        // Set the variable to true when the mouse is over a hotspot
        if (!isOverHotspot) {
            // Execute global script only when entering a hotspot
            Mouse.ChangeModeGraphic(mouse.Mode, 24);
        }
        isOverHotspot = true;
    } else {
        // If the mouse is not over a hotspot, execute the global script
        if (!isOverHotspot) {
            Mouse.ChangeModeGraphic(mouse.Mode, 22);
        }
        // Reset the variable
        isOverHotspot = false;
    }
}
}

Basically what this script does is to check if im hovering over an object to change the cursor, and re-change it back to 'original' while on 'nothing'. Also the first line is made in that way so it will 'stop executing' while having an inventory item as a cursor.
I also added that stuff to make it 'not execute' while on a specific hotspot (to put back arrows etc in the room)

Furthermore, to make the ItemCursor dissapear while clicking on something(for example, clicking away of any hotspot or on areas that are not designated for its use with the item)I have the following script :

Code: ags
function on_mouse_click(MouseButton button)
{
  if (player.ActiveInventory != null) //An inventory item is selected
{
  player.ActiveInventory = null;
  mouse.Mode = eModeInteract;
}


I don't know why the item would not work while using it on the designated hotspot with the useinv proprety.
I'm sure it's because of some way that I probably messed up the mouse cursor somehow ?

Also, tried to change the above code "mouse.Mode = eModeInteract;" with eModeUseInv but it does not work ! :(

Anyone could help me solve this issue ? I feel so confused !
#16
It's me, again, bothering you with a silly question.
I'm making a first person game, and took the advice(which is actually very useful) from another post that one should use only 1 type of cursor.
I have the following code :

Code: ags

function room_AfterFadeIn() {
  Wait(30);
  gBlack1.Visible = false;
  Wait(30);
  gBlack2.Visible =false;
  mouse.UseModeGraphic(eModeInteract);
  Mouse.Mode = eModeInteract;
  mouse.Visible = true;
}



Because I want the cursor to appear after the fade-in. so far so good !

I added the following code to the hotspot, advice taken from some forum post


Code: ags
function hHotspot1_MouseMove()
{
mouse.SaveCursorUntilItLeaves();  
mouse.ChangeModeGraphic(mouse.Mode, 24);
}


The thing is, after moving back the cursor from the hotspot, the same 'changed' graphic persists, not reverting back to its original graphic that I selected(and that it was present before hovering to the hotspot). In the documentation it is written to put the 'savecursoruntillitleaves' think BEFORE the changing - which I did - to actually prevent that from happening. I tried to add the

 "  Mouse.Mode = eModeInteract;
mouse.UseModeGraphic(eModeInteract); 

"
into the global script, but that does not seem to work. also, others 'update' functions relating to the mouse when put into the "global script" again do not work =(.

Can you please provide a more correct code or point me out in the direction of what I'm doing wrong, please ?
#17
Quote from: CaptainD on Fri 28/07/2023 20:18:52You could use a character, but you could also use Surface.DisplayString. If you did that you'd have to (for instance) draw a background colour rectangle over it once you wanted the text to disappear though.

Another possibility is using a GUI text label, which can be redefined within the room code.


Could you be more specific about the GUI version  please ? I'm still learning the hang of it (ags). While I tried to use a normal character text, I cannot seem to find where can I modify how long it can appear on screen(it flashes just for 1 second) or how to actually change its size(to be bigger)
#18
Hello again!
I've encountered the following difficulty:
While working on a first person game(using a blank template for the sake of learning the engine as a whole), I want to be able to trigger text that will be somewhere at the bottom of the screen. The problem is, while I can do that using the Display Text function, the game pauses, freezing all the animations that happen(and are necessary) in the background.
My question is : how can I actually print text on to the screen, so that it may be at the bottom of the screen, thus not 'pausing'the game? I thought about making an invisible character that would be positioned somewhere in the mid-bottom, but I am sure there is another way that is more efficent. Thanks in advance and I hope that someone can help me. :(
#19
Nevermind, after a re=run it seems like I was not paying attention and actually they did not stop. thanks for your answer, I think this is solved.
#20
Yes you are right !

Thank you so much for the reply.
Regardless, I managed to do this myself, by using 2 kind of GUI's , one that is transparent 50% and one that is fully invisible, just like this :

Code: ags

function room_Load() {
oSky1.SetView(VSKY);
oSky1.Animate(0, 20, eRepeat,  eNoBlock);
}

function room_AfterFadeIn() {
  Wait(20);
  gBlack1.Visible = false;
  Wait(20);
  gBlack2.Visible =false;
}



The problem that I'm encountering now is while this all happens, the 'animation' that I set up in my background (via the vSky stuff) pauses untill the fade out effect is finished. Is there a workaround against this ?
SMF spam blocked by CleanTalk