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

#1
Ah, ok. And for the TwoClickHandler script, would it be fine to delete it in the future or would that cause issues, since I'm not really using it? (I'm assuming it's mainly used for left and right mouse click functionality, but I only want to use the right button for my game and no "Look at" modes).
#2
Should I send a compiled copy of the game (I don't know how that would work - I'm guessing through email?) I don't know how to fix this issue from coding, but I guess the only way now is to reposition the hotspot and the book's location in the PNG.
#3
Yes, that's all the code for the on_mouse_click function. There's also similar code in the global repeatedly execute, but it just changes the mouse mode:
Code: ags

// called on every game cycle, except when the game is blocked
function repeatedly_execute() {
  if ((mouse.x < 100) && (Room.GetProperty("LeftAble"))) {
    mouse.SaveCursorUntilItLeaves();
    mouse.Mode = eModeLeft;
  } else if ((mouse.x > 1180) && (Room.GetProperty("RightAble"))) {
    mouse.SaveCursorUntilItLeaves();
    mouse.Mode = eModeRight;
  } else if ((mouse.y > 620) && (Room.GetProperty("DownAble")) && (GetLocationType(mouse.x, mouse.y) != eLocationHotspot)) {
    mouse.SaveCursorUntilItLeaves();
    mouse.Mode = eModeDown;
  } else {mouse.Mode = eModePointer;}

}


That's all I have for this function.

Also here's some of the code for Room 34, which has the hChemBook hotspot:
Code: ags

int getBeaker;

function room_Load()
{
  SetBackgroundFrame(getBeaker);
}


function hTinyBeaker_AnyClick()
{
  //getBeaker = 1;
  //SetBackgroundFrame(getBeaker);
  player.ChangeRoom(35);
  // this ChangeRoom() command is temporarily there for testing purposes. It seems to work
}

function hChemBook_AnyClick()
{
  Display("Room change");
  player.ChangeRoom(35);
}


There's several more hotspot and object functions but they're all currently empty.

Here's a screenshot of Room 34:



The green hotspot is hChemBook. hTinyBeaker is the little beaker thing between the two giant glass containers.

I also uploaded a video:



Clicking on the hChemBook hotspot doesn't change to the Chemistry Book room, but if I click on the little bookmark as you saw, it still works (I think the bookmark is located above the 100px mark for the edge code, where mouse.y > 620 for 1280x720 dimensions)
#4
Yes, I've checked it. And just to be clear, the code that changes room based on custom properties is when you click on a room's edge (it's also in global script), but here the room changes (or it's supposed to) when they click on the hChemBook hotspot. The hotspot doesn't need any custom properties, just ChangeRoom() command. It's just that I suspect that the clicking on edge code is interfering with the hotspot's code, as this particular hotspot is located at the bottom edge of the screen.
Also, I tried putting player.ChangeRoom(35) command in another hotspot that's located at the center of the screen instead of the edge, and it seems to actually work.
Would uploading a screenshot of the room help a bit? I'm still new to AGS and its forums, so I'm not too sure on how to actually do that.
#5
For the getLocation condition, I basically meant that if the mouse is hovering over the 100px bottom-most of the screen and it's not hovering over a hotspot, it would move to the next room, so that way if a hotspot is located at the edge of the screen then it wouldn't be ignored because of the edge click code. But it doesn't seem to work.
I wrote the Display("Room change") in the hChem function as you said, and it does actually display it when I click the hotspot, it just doesn't change rooms unless if I click on a part of the hotspot that's not part of the edge (mouse.y < 620).
#6
Sorry for the late respose, but I've figured out the cause.
The hotspot is at the bottom of the screen. I have code in the Global Script where if the mouse is clicking on an edge, then it will proceed to another room based on the current room's custom property:
Code: ags

// called when a mouse button is clicked
function on_mouse_click(MouseButton button) {
  
  if (button != eMouseLeft) return; // do nothing
  
  // clicking on edges code
  if ((mouse.x < 100) && (Room.GetProperty("LeftAble"))) {
    player.ChangeRoom(Room.GetProperty("GoLeft")); // leftmost 100 pixels
  } else if ((mouse.x > 1180) && (Room.GetProperty("RightAble"))) {
    player.ChangeRoom(Room.GetProperty("GoRight"));  // 1280 - 100
  } else if ((mouse.y > 620) && (Room.GetProperty("DownAble")) && (GetLocationType(mouse.x, mouse.y) != eLocationHotspot)) {
    player.ChangeRoom(Room.GetProperty("GoDown"));  // 720 - 100
  }
}


I've already wrote the condition, GetLocationType(mouse.x, mouse.y) == eLocationNothing, to make sure it doesn't ignore any hotspots on the bottom of the screen, but it doesn't seem to work.
#7
I'm making a 1st person game, so instead of having to walk to a hotspot/room's edge you just click to go to different rooms via player.ChangeRoom(). I have a hotspot that, when clicked, it goes to room 35. The problem is, the hotspot just does nothing. I tried moving the command to another hotspot, and they also wouldn't work with that command. But when I changed it to room 34, for example, the hotspot would work perfectly fine. And room 35 has already been made and I've worked on it beforehand, so it didn't display any scripting errors or anything.
I don't know why it refuses to go to room 35. I've never had such a problem until now.
Code: ags

function hChemBook_AnyClick()
{
  player.ChangeRoom(35);
}
#8
Thanks, I'm gonna use that! I'll make it global like you said as it seems more versatile to me.
#9
Ah, I figured. I was just afraid that I will end up with too many hotspots to keep track of, but since I don't have another option I will just use them. Thanks!
#10
I'm trying to make a first-person point-and-click game, where the player has to click on an edge in the room to go to other rooms; the cursor's graphic would also change when hovering over that edge to show the direction (ie if hovering on left edge, show the left-arrow cursor sprite). How do I code this in my game? Here's what I tried:
Code: ags
function Room.LeftEdge_AnyClick(){player.ChangeRoom(2);}
but it says that Room is already defined. I know I can make hotspots on the room edges for the player to click on but I was wondering if there was another way.
#12
Hi, I'm fairly nee to AGS. I have a character that moves, and when she's done moving I want a GUI to appear. Here's the code:
Code: ags

gText2.Visible = false;
cClient1.SetWalkSpeed(6,  6);
cClient1.Move(500,  720,  eNoBlock, eAnywhere);
if (cClient1.Moving == false) {
    gText2.Visible = true;
}


I'm trying to check if the character stopped moving in the if-statement, but it's not working. The character does move but nothing happens when she stops. I tested it with another character that doesn't move at all, and the GUI does show up. What am I doing wrong?
SMF spam blocked by CleanTalk