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

#221
The Rumpus Room / Re: Name the Game
Thu 16/11/2017 21:55:19
Mario Bros
#222
Normally, I love doing these, but I'm confused as to what is expected here. Do you want us to colour in a sock with different stlyes/patterns? Or do you want us to draw an object that could be found in an advent calendar (in the shape of a sock)?

Also, if the outline can't be recoloured, it would be wise to incorporate green or red into the colour scheme when we fill them, right? Or is that supposed to blend with the sock's surroundings in a final piece?
#223
Congrats, Tabata!
#224
The Rumpus Room / Re: Name the Game
Sat 11/11/2017 10:18:41
Yes, that's correct. Amayirot's turn.
#225
The Rumpus Room / Re: Name the Game
Sat 11/11/2017 09:31:19
It's a Battletoads game, but I think you're going to have to be a bit more specific.
#226
The Rumpus Room / Re: Name the Game
Sat 11/11/2017 08:58:18
Next one:

[imgzoom]https://i.imgur.com/xiANB68.png[/imgzoom]
#227
The Rumpus Room / Re: Name the Game
Sat 11/11/2017 01:55:42
Super Mario Odyssey
#228
General Discussion / Re: Free Steam keys!
Sat 11/11/2017 01:40:39
Thank you, ClickClickClick. It's a great service that you do. I didn't care about Syberia as I've already got it, but generally it's nice to have these announcements in case I miss one on the GOG Twitter feed or it's not announced elsewhere.

Three cheers for ClickClickClick! (CheersCheersCheers?)
#229
The code to set the initial state of the buttons would be called just once -- when the game starts.
You could break it up like this:

Code: ags
    function game_start()
    {
        // Set the initial state of all icon bar buttons
        Button1.NormalGraphic = 2244;
        Button2.NormalGraphic = 2256;
        Button3.NormalGraphic = 2246;
        Button4.NormalGraphic = 2247;
        Button5.NormalGraphic = 2248;
        Button6.NormalGraphic = 2252;
        Button7.NormalGraphic = 2253;
        Button8.NormalGraphic = 2249;
        Button9.NormalGraphic = 2251;
        Button10.NormalGraphic = 2250;
        Button11.NormalGraphic = 2254;
        Button12.NormalGraphic = 2255;
        Button13.NormalGraphic = 2245;
    }

    function on_event(EventType event, int data)
    {
            
            if (event == eEventAddInventory || event == eEventLoseInventory)
            {
                    if (cJulius.HasInventory(iCarKeys)) {
                            Button1.NormalGraphic = 2231;
                    } else {
                            Button1.NormalGraphic = 2244;
                    }
                    if (cJulius.HasInventory(iFlowInductor)) {
                            Button2.NormalGraphic = 2243;
                    } else {
                            Button2.NormalGraphic = 2256;
                    }
                    if (cJulius.HasInventory(iBackingPlate)) {
                            Button3.NormalGraphic = 2233;
                    } else {
                            Button3.NormalGraphic = 2246;
                    }
                    if (cJulius.HasInventory(iCog)) {
                            Button4.NormalGraphic = 2234;
                    } else {
                            Button4.NormalGraphic = 2247;
                    }
                    if (cJulius.HasInventory(iCarCoolant)) {
                            Button5.NormalGraphic = 2235;
                    } else {
                            Button5.NormalGraphic = 2248;
                    }
                    if (cJulius.HasInventory(iOilContainer)) {
                            Button6.NormalGraphic = 2239;
                    } else {
                            Button6.NormalGraphic = 2252;
                    }
                    if (cJulius.HasInventory(iCarPetrol)) {
                            Button7.NormalGraphic = 2240;
                    } else {
                            Button7.NormalGraphic = 2253;
                    }
                    if (cJulius.HasInventory(iDialFace1)) {
                            Button8.NormalGraphic = 2236;
                    } else {
                            Button8.NormalGraphic = 2249;
                    }
                    if (cJulius.HasInventory(iKeyboardKeys)) {
                            Button9.NormalGraphic = 2238;
                    } else {
                            Button9.NormalGraphic = 2251;
                    }
                    if (cJulius.HasInventory(iFuzzyDice)) {
                            Button10.NormalGraphic = 2237;
                    } else {
                            Button10.NormalGraphic = 2250;
                    }
                    if (cJulius.HasInventory(iElectricWireSilver)) {
                            Button11.NormalGraphic = 2241;
                    } else {
                            Button11.NormalGraphic = 2254;
                    }
                    if (cJulius.HasInventory(iBobbleHead)) {
                            Button12.NormalGraphic = 2242;
                    } else {
                            Button12.NormalGraphic = 2255;
                    }
                    if (cJulius.HasInventory(iGum)) {
                            Button13.NormalGraphic = 2232;
                    } else {
                            Button13.NormalGraphic = 2245;
                    }
            }
    }


That said, it would be EVEN SIMPLER to just follow my suggestion and use the translucent graphics for your buttons in the editor, thereby eliminating the block of code in game_start above.
#230
It's important to understand why something works. That first block of code is being called on EVERY event (enters room after fade in, among others). You could make things more efficient by putting the inner part of the if-block in game_start or as I suggested earlier, just making your buttons reflect the initial state of the inventory (all items translucent) in the editor.
#231
The Rumpus Room / Re: The 4 word story thread
Thu 09/11/2017 11:31:11
boast about, claiming it
#232
Khris, I had guessed that he was using the intermediate version of the code (above, in the hide tag).
#233
Wow, that kinda sucked me in there. The audio, direction and animation in this come together really well. Captain Disaster's (your?) narration is very clear and inviting. Better than the last one.
#234
If you don't add any items, all of the buttons will show in the state you see in the editor.
Try using the translucent version as your graphic for each button in the editor.

You can add an InventoryWindow to any GUI, including the one you're using.
Though, I understand that it may not be exactly what you want -- you won't get the translucency effect.
#235
Okay, you do not need that wasInventory empty stuff. I perhaps misunderstood your initial statement. Here's a revised on_event:

Spoiler

Code: ags
function on_event(EventType event, int data)
{
	if(event == eEventAddInventory)
	{
		if (cJulius.HasInventory(iCarKeys)) {
			Button1.NormalGraphic = 2231;
		} else {
			Button1.NormalGraphic = 2244;
		}
		if (cJulius.HasInventory(iFlowInductor)) {
			Button2.NormalGraphic = 2243;
		} else {
			Button2.NormalGraphic = 2243;
		}
		if (cJulius.HasInventory(iBackingPlate)) {
			Button3.NormalGraphic = 2233;
		} else {
			Button3.NormalGraphic = 2246;
		}
		if (cJulius.HasInventory(iCog)) {
			Button4.NormalGraphic = 2234;
		} else {
			Button4.NormalGraphic = 2247;
		}
		if (cJulius.HasInventory(iCarCoolant)) {
			Button5.NormalGraphic = 2235;
		} else {
			Button5.NormalGraphic = 2248;
		}
		if (cJulius.HasInventory(iOilContainer)) {
			Button6.NormalGraphic = 2239;
		} else {
			Button6.NormalGraphic = 2252;
		}
		if (cJulius.HasInventory(iCarPetrol)) {
			Button7.NormalGraphic = 2240;
		} else {
			Button7.NormalGraphic = 2253;
		}
		if (cJulius.HasInventory(iDialFace1)) {
			Button8.NormalGraphic = 2236;
		} else {
			Button8.NormalGraphic = 2249;
		}
		if (cJulius.HasInventory(iKeyboardKeys)) {
			Button9.NormalGraphic = 2238;
		} else {
			Button9.NormalGraphic = 2251;
		}
		if (cJulius.HasInventory(iFuzzyDice)) {
			Button10.NormalGraphic = 2237;
		} else {
			Button10.NormalGraphic = 2250;
		}
		if (cJulius.HasInventory(iElectricWireSilver)) {
			Button11.NormalGraphic = 2241;
		} else {
			Button11.NormalGraphic = 2254;
		}
		if (cJulius.HasInventory(iBobbleHead)) {
			Button12.NormalGraphic = 2240;
		} else {
			Button12.NormalGraphic = 2255;
		}
		if (cJulius.HasInventory(iGum)) {
			Button13.NormalGraphic = 2232;
		} else {
			Button13.NormalGraphic = 2245;
		}
	}
	else
	{
		if(event == eEventLoseInventory)
		{
			if (cJulius.HasInventory(iCarKeys)) {
				Button1.NormalGraphic = 2231;
			} else {
				Button1.NormalGraphic = 2244;
			}
			if (cJulius.HasInventory(iFlowInductor)) {
				Button2.NormalGraphic = 2243;
			} else {
				Button2.NormalGraphic = 2243;
			}
			if (cJulius.HasInventory(iBackingPlate)) {
				Button3.NormalGraphic = 2233;
			} else {
				Button3.NormalGraphic = 2246;
			}
			if (cJulius.HasInventory(iCog)) {
				Button4.NormalGraphic = 2234;
			} else {
				Button4.NormalGraphic = 2247;
			}
			if (cJulius.HasInventory(iCarCoolant)) {
				Button5.NormalGraphic = 2235;
			} else {
				Button5.NormalGraphic = 2248;
			}
			if (cJulius.HasInventory(iOilContainer)) {
				Button6.NormalGraphic = 2239;
			} else {
				Button6.NormalGraphic = 2252;
			}
			if (cJulius.HasInventory(iCarPetrol)) {
				Button7.NormalGraphic = 2240;
			} else {
				Button7.NormalGraphic = 2253;
			}
			if (cJulius.HasInventory(iDialFace1)) {
				Button8.NormalGraphic = 2236;
			} else {
				Button8.NormalGraphic = 2249;
			}
			if (cJulius.HasInventory(iKeyboardKeys)) {
				Button9.NormalGraphic = 2238;
			} else {
				Button9.NormalGraphic = 2251;
			}
			if (cJulius.HasInventory(iFuzzyDice)) {
				Button10.NormalGraphic = 2237;
			} else {
				Button10.NormalGraphic = 2250;
			}
			if (cJulius.HasInventory(iElectricWireSilver)) {
				Button11.NormalGraphic = 2241;
			} else {
				Button11.NormalGraphic = 2254;
			}
			if (cJulius.HasInventory(iBobbleHead)) {
				Button12.NormalGraphic = 2240;
			} else {
				Button12.NormalGraphic = 2255;
			}
			if (cJulius.HasInventory(iGum)) {
				Button13.NormalGraphic = 2232;
			} else {
				Button13.NormalGraphic = 2245;
			}
		}
	}
}

[close]

A couple of things:
The else if structure you posted would not work. You can't have an else if for an else block. You do not need the else before your ifs. The if is enough.
By InventoryWindow, I did not mean the GUI you're using, but a type of object called an InventoryWindow. Are you trying to emulate that using buttons? Using an inventory window would be much simpler, in my opinion:


Edit: I restructured the whole thing. "data" for the eEventAddInventory and eEventLoseInventory events is the ID of the added or removed inventory item. You can use this to eliminate a lot of unnecessary ifs.

Code: ags
function on_event(EventType event, int data)
{
	switch(event)
	{
		case eEventAddInventory:
			switch(data)
			{
				case iCarKeys.ID:
					Button1.NormalGraphic = 2231;
					break;
				// This graphic stays the same
				/*
				case iFlowInductor.ID:
					Button2.NormalGraphic = 2243;
					break;
				*/
				case iBackingPlate.ID:
					Button3.NormalGraphic = 2234;
					break;
				case iCog.ID:
					Button4.NormalGraphic = 2235;
					break;
				case iCarCoolant.ID:
					Button5.NormalGraphic = 2239;
					break;
				case iOilContainer.ID:
					Button6.NormalGraphic = 2240;
					break;
				case iCarPetrol.ID:
					Button7.NormalGraphic = 2231;
					break;
				case iDialFace1.ID:
					Button8.NormalGraphic = 2236;
					break;
				case iKeyboardKeys.ID:
					Button9.NormalGraphic = 2238;
					break;
				case iFuzzyDice.ID:
					Button10.NormalGraphic = 2237;
					break;
				case iElectricWireSilver.ID:
					Button11.NormalGraphic = 2241;
					break;
				case iBobbleHead.ID:
					Button12.NormalGraphic = 2240;
					break;
				case iGum.ID:
					Button13.NormalGraphic = 2232;
					break;
			}
			break;
		case eEventLoseInventory:
			switch(data)
			{
				case iCarKeys.ID:
					Button1.NormalGraphic = 2244;
					break;
				// This graphic stays the same
				/*
				case iFlowInductor.ID:
					Button2.NormalGraphic = 2243;
					break;
				*/
				case iBackingPlate.ID:
					Button3.NormalGraphic = 2246;
					break;
				case iCog.ID:
					Button4.NormalGraphic = 2247;
					break;
				case iCarCoolant.ID:
					Button5.NormalGraphic = 2248;
					break;
				case iOilContainer.ID:
					Button6.NormalGraphic = 2252;
					break;
				case iCarPetrol.ID:
					Button7.NormalGraphic = 2253;
					break;
				case iDialFace1.ID:
					Button8.NormalGraphic = 2249;
					break;
				case iKeyboardKeys.ID:
					Button9.NormalGraphic = 2251;
					break;
				case iFuzzyDice.ID:
					Button10.NormalGraphic = 2250;
					break;
				case iElectricWireSilver.ID:
					Button11.NormalGraphic = 2254;
					break;
				case iBobbleHead.ID:
					Button12.NormalGraphic = 2255;
					break;
				case iGum.ID:
					Button13.NormalGraphic = 2245;
					break;
			}
			break;
	}
}
#236
Rather than approaching this from the perspective of trying to pre-empt the GUI being displayed, I'd suggest you look at AGS' built-in events.
There are two events associated with inventory items, eEventAddInventory and eEventLoseInventory. These events fire whenever an inventory item is added or removed, respectively.

Since you're concerned only with having a different graphic when items are present, we can filter these events so that we only pay attention to those that matter: the first item added and the last item removed.
You'll need an InventoryWindow to track this, but I presume you're already using one for the aforementioned GUI.

Add or amend the on_event and on_game_start functions in your global script like so:

Code: ags
bool wasInventoryEmpty;

function game_start()
{
  wasInventoryEmpty = invMyWindow.ItemCount == 0;
}

function on_event(EventType event, int data)
{
    if(event == eEventAddInventory)
    {
        if(wasInventoryEmpty && invMyWindow.ItemCount > 0) // First item(s) were added
        {
            button.NormalGraphic = 123;
            // Anything else you want to have shown when there are items present
            wasInventoryEmpty = false;
        }
    }
    else
    {
        if(event == eEventLoseInventory)
        {
            if(!wasInventoryEmpty && invMyWindow.ItemCount == 0) // Last item was removed
            {
                button.NormalGraphic = 456;
                // Anything else you want to have shown when there are no items present
                wasInventoryEmpty = true;
            }
        }
    }
}


where invMyWindow is your InventoryWindow.
#237
The Rumpus Room / Re: The 4 word story thread
Wed 08/11/2017 23:39:13
ate such delicacies, nobody
#238
The Rumpus Room / Re: What's on TV?
Wed 08/11/2017 22:18:50
Yep, it's the Good Place. I love Janet. She's the best character of the lot. Ted Danson also carries the show a fair bit.

Wow, guess it's over to you again, Hana!
#239
The Rumpus Room / Re: What's on TV?
Wed 08/11/2017 03:54:23
Yay. Also, I love that everyone gets equally ribbed on Portlandia.

#240
The Rumpus Room / Re: What's on TV?
Wed 08/11/2017 02:42:12
Portlandia? One of the "man" skits? Not sure which episode. Not even sure if it's Portlandia.
SMF spam blocked by CleanTalk