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

#21
Thanks. After some research I was kind of able to mimic what you did with the int and String arrays in a blank game.

I'm curious though, (and I've attached an image) how I could apply this to inventory images that return an image value that is always in the same spot even though the inventory positions will change once they are used?

Since the inventory is already stored, do I need to create an array for that, or are the arrays specifically for the return values?

In theory, (forgive me, still learning) could I do something like this?

Code: ags
int image[20];
at the top of the global script to create the array for the window images

Code: ags
function game_start() {
  image[iTickets.ID] = bWindowTickets; // keycard sprite
  image[iBlender.ID] = bWindowBlender;
  image[iGlove.ID] = bWindowGlove;
// trying to connect array GUI buttons to their inventory counterparts
}
to set the descriptions

and then populate that information into this?:


Code: ags
InventoryItem* prevItem;
function handle_inv_images() {
  InventoryItem* currentItem = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
  if (currentItem != prevItem) {
    if (prevItem != null) {
      // Mouse OFF the current item
      // cleanup here, possibly only if currentItem == null
    bDefaultWindow.Visible=true;
    
    }
    if (currentItem != null) {
      // mouse OVER currernt item
      // display info GUI, etc.
      bDefaultWindow.Visible=false;
//populate the windows here?
    }
  }
  prevItem = currentItem;
}

I appreciate the patience, trying to study up on my own as much as possible


#22
Thank you for being so thorough.

There is something about this code that isn't clicking with me and I've been fighting with it for a couple days.
Right now I have this:
Code: ags
int image[20];
at the top of my global script, not embedded in a function.

then I have this:
Code: ags
 {
image[6] = 123; // keycard sprite
}
in my game start function

Finally I have this:
Code: ags
  bWindowTickets.NormalGraphic = image[34]
as unembeded in the global script.

I'm realizing that the original code was using a text string as a return for the mouse over, but I took it out because my inventory item hover would create an IMAGE, not text. What I thought I was doing here was mousing over iTickets (which I changed to image 6) and returning bWindowTickets, which is a button in a GUI.

Right now it is currerntly returning Parse Error, unexpected bWindowTickets.

bWindowTickets is a button in a GUI, named properly in the design properties. That's where I'm at.

#23
Code: ags
 btnImage.NormalGraphic = image[currentItem.ID];

Is the button the only thing I need to customize in this part of the code? I wasn't sure if other things needed replacement or if they were calling out to other parts of the code. Can you explain what the right hand side of this is doing? I know it's saying that my button should show up depending on what the current item is, but I don't know where it's getting the information from.

Is 'images' in line 5 supposed to be 'image'?
#24
Thanks, Snarky, Khris, as always your help is appreciated.

Khris, tried your code and it did the job well with a single inventory item. Within the code you posted, is it possible to set that up for unique inventory items, i.e, iTickets shows GUI1, iGlove shows GUI 2, etc? The inventory items are dynamic, so they are not always in the same XY position, they move when inventory comes and goes. My first instinct is to do some sort of if/than with an Active Inventory Command, but i'm not sure how to call it out
#25
Hello,
I have a custom inventory GUI and I'm trying to figure out if there is a way to hover over an inventory item and have it reveal an image that explains the purpose of the item. It's difficult for me to navigate the inventory item behaviors in the GlobalScript. I assume I have to repeatedly execute a call out to whether the x and y are on the inventory item, but if the inventory changes position, the x and y will change. Is there a way to directly say "if this inventory item is hovered over with the cursor in interact mode, an image (stored in a view, 3 possible loops that each hold a still image) will pop up"? As a heads up,  my inventory GUI is not in it's own room, it is called out from the top bar and hovers over any room the character is currently in.

Buttons have the option to set another image for hovering, but inventory items don't, so curious.

Thanks
#26
Thanks guys.
Khris, worked fine, appreciate it.
eri0o, I actually like the function, gives the option to have a tool bar without constantly taking up space, I just have one exception that I was trying to cover.
#27
Hello,

I have a top bar GUI that appears only when the cursor is at the top of the screen.

 Is there a simple way for a different GUI to be closed upon this action?(when the top bar is revealed).I'm having trouble because the top bar isn't simply visible or not visible, it's dependent on mouse placement.

In a perfect world I'd roll over the top bar to reveal it (gInvbar), and that would close a different GUI.(gRaiseArrow)

Any help is appreciated. Thanks.
#28
Quote from: Crimson Wizard on Tue 26/12/2017 20:34:52
Quote from: Brian925 on Tue 26/12/2017 19:47:02
I made a walk on hotspot that worked fine.
I made an interact hotspot that was linked to the character and it did nothing.

Hmm, could you elaborate what you mean by "walk on hotspot" and "interact hotspot that was linked to the character"?
Hotspots do not have "walk on" interaction.
Can it be you are painting walkable areas or regions instead of hotspots, or something like that?

Hotspots do have walk on interaction. Every single room in my game has walk on hot spots that when the character walks on them, the room changes.
For example, a code like this.
Code: ags

function hBobRoomToHall_WalkOn()
{
  cBob.ChangeRoom(2, 733, 420);
}
#29
Quote from: Cassiebsg on Tue 26/12/2017 19:22:05
Are you changing the mode to the hand to interact? or you just clicking it with the feet?

The hand. lol if that was the problem I'd quit forever. haha

Update: The text appears when I replace the hotspot with an object. I guess I'm going to improvise unless I want to undo my entire game and start over.
#30
Deleted my compiled folder. I am using the default template.
I made a walk on hotspot that worked fine.
I made an interact hotspot that was linked to the character and it did nothing.
#31
Khris, plugged that in, still no talking.

Snarky, I went through the process above.
Created a hotspot on the bed. Named the hotspot hBed. Clicked the lightning bolt to create hBed_Interact. Added Say and Display commands, respectively. Is there more to linking than this?

Also deleted and started from scratch. Still nothing.
#32
is that different than what you originally wrote? Looks the same, and it didn't do anything. That's in my hotspot code, which is linked.

Update: hello world was fixed by linking it with the AfterFadeIn. But the hotspot is linked and it is still not saying anything.
#33
yes there is. that's how i initially put the code in. Clicked the hotspot. named it hBed. Clicked Interact and next to it hBed_Interact appeared.Clicked lightning bolt, clicked ellipsis, added the code.

I have several other hotspots that take me to other rooms when stepped on and others as WalkTo points. They all work fine. For some reason, only when I call to something that requires my main character (cBob) to say something, it doesn't work.
#34
I didn't type the AfterFadeIn code myself. It was a default script already entered before I started making the game.

As far as linking functions to events, I think I'm missing something major as far as how this is carried out and the logic behind it.
I have a room.
In the room script(room1.asc), I have added this code, as requested.
Code: ags

function hBed_Interact()
{
  Display("hBed_Interact() called OK");
  cBob.Say("No, I've slept enough.");
}


The new display command you requested I add did nothing. I click the hotspot on the bed and nothing happens.
My question is, what do I need to link further? If I create the hotspot in the room and name it hBed, with this code, shouldn't you be able to click on it and have the character say "No, I've slept enough" with the code above? Is there more to linking than that?
The only thing I can possibly imagine is that the hotspot z layer is set lower than the room object, but hotspots don't even have z layer options.
#35
Code: ags
// room script file

function Room_AfterFadeIn()
{
  cBob.Say("Hello World!");
}

function hBriRoomToHall_WalkOn()
{
  cBob.ChangeRoom(2, 733, 420);
}


function oController_Interact()
{
  cBob.Walk(hWalkToNES.WalkToX, hWalkToNES.WalkToY, eBlock, eWalkableAreas);
  cBob.LockView(2);
  cBob.Animate(1, 5, eRepeat, eNoBlock, eBackwards);
  WaitMouseKey(GetGameSpeed()*20);
  cBob.UnlockView();


}

function hBed_Interact()
{
  cBob.Say("No, I've slept enough.");
}


Neither the "Hello World" or "No I've slept enough" are showing. "No I've slept enough" is called when you interact with a hotspot in the room called hBed.
Also, this is the first room that loads in the game.
#36
My entire game seems to be functioning properly except for that my character only "talks" when he interacts with himself(You rub up and down your clothes, Damn I look good). I noticed there are global settings that define those interaction messages. Are there additional game settings that could block a simple Say command if you put it in a room's script? I can get my character to change rooms and add inventory but I can't get the text to show up in a simple Say command. I've checked the manual and I could only imagine there is some block command in the global variables that is causing this, but I have no idea where to start looking.
#37
All super helpful information. I always wondered why single line commands seemed to be floating sometimes like they were completely separate from their preceding statements. I think I need to get familiar with the built in functions. There might be a lot of things there are commands for that I'm not aware of. 
#38
1. The end bracket was an oversight, thanks for the catch.
2. I was trying to make it so the character would sit in front of the TV until any click happened, and then he'd return to the original walking view. Since the click was not associated with an object, I wasn't sure if I needed to declare a new function or not.
3. Noted. Organization is clutch.


After considering Khris' post, I changed the code to this:
Code: ags
function oController_Interact()
{

cBob.LockView(2);
cBob.Animate(1, 5, eRepeat, eNoBlock, eForwards);
cBob.UnlockView();


}

I thought the Repeat/Once and ENoBlock and eBlock options would enable me to loop the view while allowing a button press to return the sitting view to the walk cycle view.
eRepeat and eNoBlock seems to skip the View 2 animation altogether and return to View 1 facing a different direction. Hopefully I'm more on the right track now.


As far as function and syntax, I'm still learning. I understand that a function is called out and the brackets hold the action associated. I just didn't know if I needed to create a different function when I needed a mouseclick without an object.
#39
wasnt my intention to skip over, you were just a couple steps ahead of what i had processed. I'll re read and try with the advice.

#40
apologies for anything already posted; i tried to navigate the board and didn't find anything based on my keywords. maybe i need to learn the terminology a bit.

Thanks for the advice though, it worked well. I managed to get my guy to sit down using:
Code: ags
function oController_AnyClick()
{
  cBob.ChangeView(2);
  cBob.ChangeRoom(1, 540, 320);
cBob.Animate(1, 5,  eOnce, eNoBlock);
}


This successfully got my character to sit in front of the tv and play the game. Now i would like him to get up and walk in the original first View instead of the second if the walking option is clicked. I added this code in, but it told me it could not be nested?
Code: ags
function AnyClick ()
{
cBob.ChangeView(2);
}


So, in my character's code, this is what i have in its entirety for this function.
Code: ags
function oController_AnyClick()
{
  cBob.ChangeView(2);
  cBob.ChangeRoom(1, 540, 320);
cBob.Animate(1, 5,  eOnce, eNoBlock);

function AnyClick()
{
  cBob.ChangeView(1);
}


Any help is appreciated!
SMF spam blocked by CleanTalk