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

#1
I think what you mean is you don't know how to erase it?

Basically, you have to go to the room you have the walkable area, click "show this rooms" and scroll it to "walkable areas". You'll notice in the properties, all of the walkable areas have a property 1, 2, 3, 4 etc. If you click that drop down menu and set it to "walkable ID area 0" that will put you in eraser mode. then you just drag the square like you are creating a walkable area....but instead of creating it, it will erase what currently exists in that space.

I thought this was an important topic, so I chose to bump it since I had the same problem in the past.

#2
I'm trying to fade in a GUI and I'm not sure if how it's embedded is getting in the way. I was also curious if having the GUI set to "pause game when shown" would cause the fade not to happen. I got the code to work for everything except the fading part until I started messing with the brackets and getting errors. Thanks for looking.

Code: ags
function btnInvOK_Click(GUIControl *control, MouseButton button) {
	// They pressed the OK button, close the GUI. Everything should always be set to invisible.
	gInventory.Visible = false; //Makes overlay Inventory GUI close
  gIconbar.Visible=true; //restores visibility of Top Bar GUI
  gIconbar.Clickable=true; //restores functionality of Top Bar GUI
  
  if(onmega == 1) {
  gGB1.Visible=false;
  else //GETTING A PARSE ERROR HERE AT 'ELSE'
  gGB1.Visible=false;}
    
  if(podtoinventory == 1){
  gGIOPod1.Visible=false;
  else
  gGIOPod1.Visible=false;}
  
  if (blend1done == 1){
  gAnn1000.Visible=false;}
  else
  if(blendglovematch==1){
  Wait(20);
  gAnn1000.Visible=true;}
  int trans2 = gAnn1000.Transparency;
  while (trans2 > 0){
  trans2--;
  gAnn1000.Transparency = trans2;}
  Wait(1);
  
  else 
  gAnn1000.Visible=false;
  gArena.Visible=false;
  mouse.Mode=eModeInteract;
 }
#3
Thanks guys,

Snarky, I originally thought the most effective way to return the images was in a GUI button from Khris' original explanation that returned a string. I see now that it adds steps where it doesn't belong for returning images instead of text.

I agree about the wrong mental model. As a self taught coder, I have a lot of blind spots. In the past, I could survive with a bunch of if/than statements, but this time around, I'm trying to really understand putting arrays together and consolidating my code. When I'm given example code, I'm not always sure what I should replace with my content, which parts are returning previous code and which parts are calling premade functions I'm not aware of. Just need more hours.

Khris, that one worked perfect. Kind of a cool concept to label the sprite number at a recognizable interval to save some coding time. Thanks so much for both of your help.



#4
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


#5
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.

#6
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'?
#7
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
#8
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
#9
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.
#10
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.
SMF spam blocked by CleanTalk