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

#61
Oh did you mean with the boolean variables. Yes I got it totally wrong.

Quotebut I don't know where did you get "sx,sy" etc variables from.

lol

I don't know why I like it that way  ;-D
Code: ags

  if ((AnchorBoat == true) && (ColaHotdog == true))
    cBerny.SayBubble("Bingo.");



Thanks for the information. I'll try it.
#62
Hi CW,

could you check please, because Berny doesn't say bingo. (Im trying first only for 2 lines, 4 hotspots)

In room_RepExec

Code: ags

 for (int i = 0; i < line_count; i++)   // that's for loop for each line the player will draw, right?
 {
        // test Lines[i] values:
        if (Hotspot.GetAtScreenXY(Lines[i].sx, Lines[i].sy) == hotspot[1]) { // where line starts
        }
        if (Hotspot.GetAtScreenXY(Lines[i].ex, Lines[i].ey) == hotspot[2]) { // where line ends
        }
        if (Hotspot.GetAtScreenXY(Lines[i].sx, Lines[i].sy) == hotspot[3]) { // where line starts
        }
        if (Hotspot.GetAtScreenXY(Lines[i].ex, Lines[i].ey) == hotspot[4]) { // where line ends
        }
  }


In Button

Code: ags

if ((Hotspot.GetAtScreenXY(sx, sy) == hotspot[1]) && (Hotspot.GetAtScreenXY(ex, ey) == hotspot[2])
&& (Hotspot.GetAtScreenXY(sx, sy) == hotspot[3]) && (Hotspot.GetAtScreenXY(ex, ey) == hotspot[4])
)

cBerny.SayBubble("Bingo.");


I tried also in Button with if (draw == false) but it doesn't work.

I have a second problem with on_call. I want to make 2 calls for Reset and OK button.

Code: ags

function on_call (int LinesReset, int LinesOK) 
{
  
if (LinesReset == 1)
{
     if (spriteForLine) {
       spriteForLine.Delete();
     }
 
     DrawingSurface *surface = spriteForAll.GetDrawingSurface();
     surface.Clear();
     surface.Release();
}

if (LinesOK == 2)
{
if ((Hotspot.GetAtScreenXY(sx, sy) == hotspot[1]) && (Hotspot.GetAtScreenXY(ex, ey) == hotspot[2]))
cBerny.SayBubble("Bingo.");
}
}


In global script

Code: ags

function Button59_OnClick(GUIControl *control, MouseButton button)
{
if (cBerny.Room == 19)  
CallRoomScript(1);
}

function Button58_OnClick(GUIControl *control, MouseButton button)
{ 
if (cBerny.Room == 19)  // OK button
CallRoomScript(2);
}


I'm getting an error message .... function on_call (expected 2, supplied 1). what am I doing wrong?  :-\
#63
Ah right Pogwizd was talking about array, I totally forgot about that. I'll try that after dinner.

// where line starts and // where line ends = where the hotspots are? x and y of the hotspots? because I don't know where exactly the player will draw the line to the hotspot, up from the hotspot down, right or left.
#64
Part 2 of the puzzle that is killing me. check if all lines are correct. I'm trying to do somthing like that with global variables.
according to CW's code. (I use the picture in the first post as an example)

Code: ags

   if ((draw == false) && (ex == mouse.x && ey == mouse.y))
  {
  if ((Hotspot.GetAtScreenXY(sx, sy) == hotspot[1]) && (Hotspot.GetAtScreenXY(ex, ey) == hotspot[2]))
  AnchorBoat = true;
  
  else if ((Hotspot.GetAtScreenXY(sx, sy) == hotspot[3]) && (Hotspot.GetAtScreenXY(ex, ey) == hotspot[4]))
  ColaHotdog = true; 
  } 


Button OK

Code: ags

function Button58_OnClick(GUIControl *control, MouseButton button)
{
if ((AnchorBoat == true)  &&  (ColaHotdog == true) )
cBerny.Say("Bingo."); 

}


That dosn't work of course.
It occurred to me that this is for just one line, not multiple, am I right? how do I do this way for multiple lines? Does anyone have an idea.


#65
Aaah I understood the principle now of these DrawingSurface. Thank u  :)
#66
Oh, I probably clicked wrong.

Code: ags

function gReset_OnClick(GUI *theGui, MouseButton button)
{
if (cBerny.Room == 19)  
CallRoomScript(1);
}
 


That was the gui, not the button  (laugh)

They get deleted but when you want to draw again, it gets drawed then disappears because we deleted spriteForAll.Delete(); . Something is probably missing in else if
#67
Quote from: Crimson Wizard on Thu 09/06/2022 09:55:27
Quote from: Amir on Thu 09/06/2022 09:51:26
But shouldn't it be in the Global Script? As I said, I have an OK button that the player has to click on if all the lines are correct. And the button is always in Global Script. It won't see the lines like that in the room 19.

You can put that anywhere you like. For example you may create a separate script module for that, and add functions that turn the line drawing on and off.

But it does not have to be in the global script only to let button do something. You may pass a "signal" into the room script using CallRoomScript command:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_General.html#callroomscript


Thank u so much. It works like a charm. But I can't make this on_call. what am I doing wrong?
this is the reset button. All lines should be deleted.

Global scrip
Code: ags

function gReset_OnClick(GUI *theGui, MouseButton button)
{
if (cBerny.Room == 19)  
CallRoomScript(1);
}


Room 19
Code: ags

function on_call (int Lines)
{
  
if (Lines == 1)
{
  if (spriteForLine) {
    spriteForLine.Delete();
  }
  if (spriteForAll) {
    spriteForAll.Delete();
  }  
}
}


#68
Oh cool, I'm trying to do it now with sprite.CreateFromExistingSprite(object[2].Graphic); but when you've already done it with guis, I'll take your code. (not yet tested)

But shouldn't it be in the Global Script? As I said, I have an OK button that the player has to click on if all the lines are correct. And the button is always in Global Script. It won't see the lines like that in the room 19.
#69
Quote from: Crimson Wizard on Thu 09/06/2022 09:02:59
Regarding color not working, I noticed that in the above script example DrawingColor is set after DrawLine. You need to swap these two commands.

(laugh) your right, now it's red.
#70
Ok, I will try that with Guis.
#71
QuoteThe mouse stays because the game captures whatever is displayed on the screen. I didn't have that problem because the cursor was hidden in my room. I guess you could try hiding the cursor right before this line

I had tried this and Changemode of the mouse as well, in the code and in on_mouse_click but it dosn't work, it would work if you just click once, the mouse cursor disappears but you can no longer see where you draw the line. It doesn't matter, that's no problem, it doesn't look that bad.

QuoteAre you sure your colour code is correct? In my game it had the value of 13 and it worked fine. Have you tried any other colour numbers?
Yes and I tried many codes, it stays black  ;-D that's also no problem. I like black metal.

QuoteI didn't have that issue. Are you doing anything with the audio clips in the same room_RepExec() function?
No nothing, by the way it's in the Global script because of the buttons "OK" and "Reset" I have 3 Buttons there, ok reset and exit room, it won't look pretty if they keep disappearing and reappearing when you draw and finish drawing.  ;-D

I think I know now why this is happening, because of the screenshot the code takes. When I take a screenshot in the game, the music stutters the same as in this room. I don't think it's a good idea to draw with a screenshot at my resolution 1280 x 720. I think a Gui as BackgroundGraphic would be better in my case. Look at this link https://www.adventuregamestudio.co.uk/forums/index.php?topic=54958.0

I will try to mix your codes and do it with Gui, like I said, I have never written any code using Drawing Surface. If you can help with that, that would be very nice. (or someone else who reads and knows)
#72
I've only tested drawing so far, but there's a problem or two. Whenever I click to draw, the music stutters annoyingly and I have 2 buttons there, whenever I click to draw, the sprites of buttons become more pixelated and look aliased. Do u know why?  :-\  I doubted the width, I tried int LINE_WIDTH = 1; but that didn't help. My resolution is 1280 x 720.
I also doubt the mouse cursor because it stays there after you draw. Is there any way to prevent it?

And I cannt change the color surface.DrawingColor = 53248; I want it red but it's always black, but that doesn't matter, that's no problem.
#73
QuoteI also remember that by default the engine tries to make mouse speed in fullscreen close to the system cursor speed, but maybe this does not work well if the system cursor is sped up somehow (not sure).

Apparently not. It's always very slow by default but it's not bad.

QuoteIMHO the best is to not guess about other people by your system behavior, and leave the speed setting on default position, and let players adjust it only if really necessary.

Yes, but I've noticed most people don't look at winsetup, they start the game right away then curse because the mouse slow. Some have asked me why it's so slow. Some haven't seen "Advanced" at all. People are not used to adjusting the mouse before playing. I believe Visionaire and Unity set the speed automatically as fast as the system.
I'm considering making Mouse.Speed in the options in game but the problem, there is no more space for another slider.
#74
Ok, thank you so much  ;-D I'll test it right away in my puzzle room.
#75
It works now, I don't know what I did  :-\ I just tried it several times. What is the best speed that most people use do you think?
#76
Quote from: Crimson Wizard on Tue 07/06/2022 18:43:21
Quote from: Amir on Tue 07/06/2022 18:30:33
Quote
Wait, is the problem mouse lock or speed? or both?

I guess mouse lock  ;-D I just meant it's slow because it's not locked to my window, my mouse is faster.

Sorry, but I'm still not sure what do you mean. Is cursor movement in game is slower than the movement of the system cursor?

Yes slow and like a heavy stone. This is probably the default speed 1. The movement speed of my system cursor is almost 2.2.
#77
Quote from: Crimson Wizard on Tue 07/06/2022 16:37:33
Quote from: Amir on Tue 07/06/2022 16:34:09still so slow at Default, not like my mouse speed.

Wait, is the problem mouse lock or speed? or both?

I guess mouse lock  ;-D I just meant it's slow because it's not locked to my window, my mouse is faster. I have now tried another test game, no chance. it's all HD games, 1280x720. Is your test game HD too?
#78
Quote from: Crimson Wizard on Tue 07/06/2022 16:21:17
Does it depend on how do you run the game (from the editor, from built exe, and so on)?

Also, Ctrl+Alt combination toggles the lock, do you press it for any reason during the game?

I'm trying from both but it dosn't work.

I have heard about Ctrl+Alt combination and I pressed them several times, still so slow at Default, not like my mouse speed. Maybe will help a PC restart?  (laugh)
#79
As far as I remember, I had the problem last time, but suddenly it worked without me doing anything.

Edit: and like I said it worked half an hour ago with 3.0.6.
#80
Quote from: Crimson Wizard on Tue 07/06/2022 16:04:24
Quote from: Amir on Tue 07/06/2022 16:02:56
and what about the mouse? Is there also a new function? it dosn't lock to window.

I just tried it in a random 3.5.1 game, it it works if i check the option in the winsetup, in "Advanced" - "Mouse options". Is this how you do that?

Yes AND in Default Setup is true. Hmmmm that's weird  (wtf)
SMF spam blocked by CleanTalk