Mouse locked to Walk to Mode, blending in/out....??

Started by TheManInBoots, Tue 03/03/2020 10:51:33

Previous topic - Next topic

TheManInBoots

HEy.

So for the project I wanted to submit for the February MAGS in the very last second the AGS editor completely gave up it's spirit!

On certain actions all of a sudden the mouse does not change it's mode anymore and stays on walk to mode all the time.

And then sometimes its start blending in and out...

I can't believe that this is a scripting error I made.

Also I can't remember having changed that much actually, just added animations and variables...

and it stopped working.


It happens when I for example click again quickly while the character talks during an interaction with an object.
Or during a room change.
Or while looking at an object twice in a row while standing in the same spot.

It's very peculiar.

And this seems more engine related.

I'm getting more and more intimidated to try ambitious, bigger projects with AGS...

But maybe someone has an idea what could cause this?


Here's a vid:

You can see that no matter how and where I click, the cursor does not change.
And 16 seconds into the video you see the cursor is starting to blink!?
Watch out though, it always automatically uses the mike for audio, turn the volume down ;)
https://streamable.com/ha8bm

Cassiebsg

If the streamable, or is the video very "jerky"? Like the computer is doing over work and can't keep up?
There are those who believe that life here began out there...

morganw

The most likely cause is a logical problem in the scripting, I don't think there is any built-in behaviour that will fade the cursor in and out like that. You would likely have to post the source files for the scripts for anyone to try to work out what was going on.

TheManInBoots

#3
With script source files you mean this?
deleted

I probably could've grouped certain things together better and looped more things to make it clearer in the script.
But all of this developed organically and I wasn't sure when I started off how it will go eventually.

TheManInBoots

#4
Here is a link for the entire game file.

deleted


I'd be eternally grateful for anyone who would be able to understand what the problem is.

I hope this can make access to the script easier.
If you can help me, you're my hero and I'd really appreciate it.

Thanks

Crimson Wizard

#5
TheManInBoots, can you tell which gfx driver do you select to play the game? (just in case there's difference)

NOTE: I was able to see the cursor stuck in walk to mode, but could not yet reproduce the cursor fading bug.

Cursor often stucks in walk to mode after displaying an "exit arrow" at least once (EDIT: but not always... :/).

TheManInBoots

#6
Crimson Wizard, in order to re-create the blending mouse cursor go into Global script asc., to the very beginning of the late_repeatedly_execute_always function at line 503, and restore what has been hidden with slash asterisk.

(This part:)
Code: ags

//walks behind tent
/*if(cJames.Room==2)
{Jamesposition=Screen.ScreenToRoomPoint(cJames.x, cJames.y);
if(Jamesposition.x>400&&Jamesposition.x<450&&Jamesposition.y>300&&Jamesposition.y<340)
{
behind=true;
}
}*/


=>

Code: ags

//walks behind tent
if(cJames.Room==2)
{Jamesposition=Screen.ScreenToRoomPoint(cJames.x, cJames.y);
if(Jamesposition.x>400&&Jamesposition.x<450&&Jamesposition.y>300&&Jamesposition.y<340)
{
behind=true;
}
}


i recommend setting the cloththickness int variable to 200 or any high number and don't forget to turn the last gui gGui2's Visibility to false.
Then set cJames to room 2 (if you want to save time, set his start coordinates 480, 350)
Now walk to the right coordinates  behind the green tent where the cut-scene is triggered.
The bug might affect the cutscene, but also I changed a few things around to figure out what triggers the bug, so don't pay much attention to the cutscene.

after the cutscene you will observe the exact same fading in and out of the mouse.

TheManInBoots

#7
Aren't the settings also saved in the project file?
Or only in winsetup?
I used Direct3D 9

Khris

If you fix all your code so it looks like this:

Code: ags
  //walks behind tent
  if (cJames.Room == 2)
  {
    Jamesposition = Screen.ScreenToRoomPoint(cJames.x, cJames.y);
    if (Jamesposition.x > 400 && Jamesposition.x < 450 && Jamesposition.y > 300 && Jamesposition.y < 340)
    {
      behind = true;
    }
  }


and reupload your game I'll take a look.
(Note that you don't have to do this by hand; simply paste your script into the JS area here: https://jsfiddle.net/ and click "tidy")

TheManInBoots

#9
Hahah, I would expect you would have a hard time looking at my script, since you like everything orderly.

Spoiler
So you mean every additional bracket causes a paragraph offset. Symbols separated by space.
And you also want a constant one paragraph offset on the left side for the entire script?
[close]

Oh never mind just saw your foot note!

What a nice thing the JS area!

Khris

It's not about what I like, it's about making it readable in general. Squishing together operators and variables or not indenting blocks simply leads to objectively unreadable code which makes it way less likely for anybody usually inclined to do so to take a look.

The difference in readability is staggering in my book, and if somebody doesn't put in minimal effort to produce readable code, why should I put in effort to help them fix their buggy, unreadable mess? 50% of the time, using proper indentation is what had prevented the bug in the first place.

And indenting the entire block by two spaces is just something I do when I post code that's inside a function. The idea is that people can copy-paste it as-is and don't have to worry about fixing the indentation.

TheManInBoots

Currently compressing a clean script project file...

TheManInBoots

So here is a cleaner script.

https://drive.google.com/file/d/1LGWmfQo3E6HuUBLKi7uVNYML2H4MnuXN/view?usp=sharing

If I remember well you gotta remove
Code: ags
int angle=1;
in the beginning of room script 11.

TheManInBoots

#13
Also the reason Khris that I wasn't immediately ready to post a clean script was the way you asked me.
You said, the only way you gonna help me is if I do this particular thing.
It felt more like trying to mâle me do things rater than an intention to help me.

You know, after the game stopped working, I spent several just trying to fix the problem.

You think I wouldn't take 5 minutes to clean the script?

You could've also said, that you'd be glad to help, but it would be easier for everyone to find a solution if the script was cleaner.
Instead of putting pressure on me.

So, I just so you know.

Cassiebsg

#14
Okay, I did a few tests, basicly just /* and */ for codes in rep_exec and blocking the code for the cinema bars seems to solve the problem that is lines 607 to 641 ( 644 to 654 are blocked by you)

I've only tested by placing the character on room 1 and opening and closing the stove door. But before I blocked those lines it would be stuck in walk to mode, and now it's not.

EDIT: you the one that asked for help. I also tried to read the script before and gave up, since it was impossible (or too much effort).

EDIT2: Seems like there's more code that needs blocking, now I went outside and after the "discover Clara scene" the mouse is again stuck in walk to mode, this time blinking.

EDIT3: So I figured out what is happening with Clara's room. And it's got nothing to do with engine bug!

Simply in GlobalScript line 147 you have:
Code: ags

function repeatedly_execute()
{
  //behind tent
  if (behind == true) 
  {
    if (Game.DoOnceOnly("disco")
    {
      cJames.SayBackground("blabalan"); // I'm typing and don't want to type the text since irrelevante
    }
    cJames.ChangeRoom(4, 690, 380, eDirectionLeft);
  }
// script continues 
}


If you haven't spotter it yet, you never change this condition to false! Which means it keeps repeating (the changeRoom) and blocking the player from doing anything!

Add behind=false; before you change room, and it's fixed.  (roll)
There are those who believe that life here began out there...

Olleh19

Quote from: TheManInBoots on Thu 05/03/2020 21:43:29
Also the reason Khris that I wasn't immediately ready to post a clean script was the way you asked me.
You said, the only way you gonna help me is if I do this particular thing.
It felt more like trying to mâle me do things rater than an intention to help me.

You know, after the game stopped working, I spent several just trying to fix the problem.

You think I wouldn't take 5 minutes to clean the script?

You could've also said, that you'd be glad to help, but it would be easier for everyone to find a solution if the script was cleaner.
Instead of putting pressure on me.

So, I just so you know.

Clearly i'm not the only one drunk/on drugs on this forum. (laugh) It's a joke btw, cops please don't take me down, i dont use drugs. If you ask for help on this forum, they want the code to look at least somewhat clean. How could you not get that? Guys in here are amazing (Khris included) and you get butthurt cause he asks you for such a simple feat?! Come on man!

TheManInBoots

#16
Yeah, I might have over-reacted for the clean script and come across as a "drug addict".

I just don't like when things are said in a certain way.

Cassiebsg well thanks for looking into this.
I have blended out repeatedly execute functions before to see if it changed something, but it didn't for me.
So I will test that one specifically you mentioned and see if it works.

TheManInBoots

Okay, checked it out, Cassiebsg.
That was the problem. Game works now.
Umm, guess upload now...

Crimson Wizard

So, the fading cursor was because of repeated ChangeRoom call?
To think of it, the room transition might be "crossfade" or "dissolve"? I forgot to check that out, and it did not come to me that this might be the case.

TheManInBoots

#19
Exactly, that seems to be the reason.
It's crossfade.

SMF spam blocked by CleanTalk