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

Topics - Mr Games

#1
Sorry this is a super-beginner question,

Every time I've created a new variable I've made it a Global Variable, because I was thinking that if I created an int or bool at the top a room script, it would return to that value every time that room is entered.

For example, if I stated at the top of a room:
Code: ags
PineapplePizzaIsTasty = true;
and an event in that same room caused that value to become false, but I left the room and came back, would it not read the original statement and make it true again?

I'm just trying to get my head around how this works.
#2
Hi everyone


I've started a mini "boss fight" where clicking on the Succubus causes her to "teleport" (with object.SetPosition) but for every instance there is a timer. If any of these timers expire the player is sent to room 38 (game over.)


I'm stumped because the first timer is working, but after the initial click (which I intended to stop the first timer and start the second) nothing happens. Here is my code:




Code: ags

// room script file


Timer *succubTimer0;
Timer *succubTimer1;
Timer *succubTimer2;


int showdown = 0;


function room_AfterFadeIn()
{
  succubTimer0 = Timer.StartRT(3.0);
}


function room_RepExec()
{
  if (Timer.IsExpired(succubTimer0)) {
  cSmileyface.ChangeRoom(38);}
  if (Timer.IsExpired(succubTimer1)) {
  cSmileyface.ChangeRoom(38);}
}


function oSuccubus_AnyClick()
{
  if (showdown == 0) {
  Timer.Stop(succubTimer0);
  oSuccubus.SetPosition(1528, 407);
  showdown += 1;
  succubTimer1 = Timer.StartRT(2.0);}
  if (showdown == 1) {
  Timer.Stop(succubTimer1);}
}



Apologies in advance for being a total noob. I'm learning all the time!
#3
Hi guys :grin:

I initially couldn't get the timer to work and found a thread where another user had the same issue.
Here I discovered Crimson Wizard's Timer Module and imported the script. But my timer still isn't working.

Code: ags
Timer *chickenTimer;

function room_AfterFadeIn()
{
  chickenTimer = Timer.StartRT(5.0);
  if (Timer.IsExpired(chickenTimer)) { 
  cSmileyface.ChangeRoom(15);
  }
}


I want to change room when the timer expires, but as far as I can tell there's nothing wrong with my code. Am I missing something?
#4
Hi all,

I'm already aware that text overlays are removed when the player changes room:
Quote...except that with this command the text stays on the screen until either you remove it with the Remove command, or the player goes to a different room, in which case it is automatically removed.

When I first read this I mistakenly assumed it just meant remove from sight. Now I see that returning to a room I cannot get that text to reappear.

Just to clarify, is it possible to recreate the overlay (via whatever triggers it) every time that room is revisited? Or is this counter-intuitive?
#5
I have made a serious effort to solve this problem by myself.

I've created a custom inventory that appears when a button is clicked, and the item is showing up correctly after acquisition.
However, clicking on the item does not change the pointer to its cursor sprite.

For the inventory GUI I'm just using the code from the DemoQuest template

Code: ags
   function ShowInventoryWindow() {
// 
// This function opens the inventory selection GUI.
//-------------------------------------------------------------------
	mouse.Visible = true;
	gGui1.Visible = true;						// Show custom inventory window
	mouse.Mode = eModeInteract;			// switch to the Use cursor (to select items with)
  mouse.UseModeGraphic(eModePointer);	// But, override the appearance to look like the arrow


From the item itself (iRatSkull) I created an event linked to this function

Code: ags
function iRatSkull_Interact()
{
  cSmileyface.ActiveInventory = iRatSkull;
}


Is there something obviously wrong here? :(
#6
Hi all,

So I'm shelving my cycle-through-item cursors-without-GUI idea, only because I don't have enough experience to script it properly.

I created a GUI for an item inventory and made a button with a cross to close it. However, it won't disappear for some reason.

My script (located in Global script)

Code: ags
function CloseInv_Click(GUIControl *control, MouseButton button) {

  gGui1.Visible = false;
}


CloseInv is the name I gave to the button for closing the window.

Since it won't disappear, I'm wondering if there's a clash with the button I used to make it visible in the first place?

Code: ags
function OpenInventory_AnyClick()
{
  gGui1.Visible = true;
} 

#7
Hi everyone,

I am making a game that initially has 2 mouse modes active (interact and look)

I would like to make it so that item cursors will be added to the cycle of available cursors, once said item has been added to the player's inventory, bypassing the need for a GUI inventory.

I have tried to piece together how to do this on my own but I am not good at scripting and would be grateful for any pointers (no pun intended) on how to approach this.
SMF spam blocked by CleanTalk