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

#1
Such a stupid mistake, too! Thank you so much for your help.
#2
So the version is Build 3.5.1.15, and yes, there is no error message or anything.

Unfortunately I'm not very experienced with coding or game development, so I'm not familiar with source control or anything.

I'm willing to share the game project, I'll PM you about it.

I'll also try to go through the removal process you describe.
#3
Yes, but it still crashes in the same way as it tries to compile.
#4
Just recently, when I attempt to run the game from AGS, the messages mention something about the script being changed and rebuilding from Room 1, which is pretty normal, but then AGS crashes, closing entirely.

There doesn't seem to be a recent crash dump or anything.  I created a template game and that was able to run properly, so I assume it's something I've done, but I have no idea how to determine the issue. 

Does anyone have any guidance?
#5
It was originally to solve an issue that I've since realised I can solve other ways, but the thought lingered in my head and I was curious.
#6
Thank you guys, this is very helpful.

I'm currently going for something like this:

Code: ags
enum Slot_Type {eCharacter,  eInventory};

int Char_Slot_Count;

struct Slot {
    GUIControl* slotgui;
    
    Slot_Type type;
    int contained;
    
    //other stuff
};


This seems to work so far.

I still like the idea of using a struct since it makes it easier for me to keep track of what int etc goes with what.  I plan to do animations and stuff and so rather than having a bunch of individual arrays, my mind deals better with an array of structs with all the relevant info.

My ambition was to make a system where I could more or less create make as many of these kind of menus as I'd like with just altering some variables, a bit like a module. But that may be a little beyond my grasp at the moment.


QuoteThe way I do it is simply to check in rep-exec what room object (or hotspot) is at the mouse coordinates, so it doesn't matter whether there's a GUI on top or not.

You've saved me!  I was using GetLocationType(mouse.x, mouse.y) to return the type and go from there, which wasn't working with a fullscreen GUI, but going (Whatever).GetAtScreenXY works!  Thank you.
#7
Thanks for replying.

From playing around earlier, it seemed to me that if I used a single GUI with a bunch of buttons it would interfere with detecting what was under the mouse for other stuff I was doing, even if the background was transparent.  I am also displaying text at the bottom of the screen from a property attached to hotspots, objects and so on, but having the full GUI would prevent the script from reading whether there was a hotspot/object underneath - presumably detecting a GUI instead.

I also wasn't sure if the tween functions would work with buttons for moving the slot around.  This is why I didn't use an Inventory Window - my intent was to have the slots slide into place when you open or close the selection.

The blue menu is meant to let you choose from available characters, while the red is to select from the selected character's inventory.

With the blue menu, my intent was that if you only had 2 characters available, only 2 slots would appear above it, while if you had say 5 characters available, then only 4 slots would be displayed, but some arrows would appear allow the player to scroll through the list.  Similarly for the inventory list, except the highest number of visible slots would be 8.

Forgive my ignorance, but I'm not familiar with some of the terms you're using.  Am I understanding you correctly that you are suggesting using GUIs and GUIControls visually, and then create a struct for containing data related to the given GUIControl?  So I may have 'gBlueCharacterMenu', with 5 buttons, and then have an array of structs  (eg Slot* blueslots[5]), and use that array to place variables in?  like:

Code: ags
// No SlotStructure struct
struct Slot {
  int Whatever_Data_Is_In_The_Slot;
  // etc etc
  GUIControl* thiscontrol;   //So I can issues visual commands to the right button - like to move it from one position to another
}


or more like:

Code: ags
//again, no SlotStructure struct
struct CharacterSlot {
  Character* slotCharacter [4];
  int xstart [4];
  int ystart[4];
  int xend[4];
  //etc etc
}


Or am I misunderstanding what you're saying entirely?
#8
Hey, I'm very much a newbie at all this, so I'm trying to get my head around a lot of things and sometimes I have difficulty understanding the manual.

My objective is to have two buttons at the bottom of the screen, pushing one will open some slots above it, and similar with the second.  These are like two different inventories, so you can press a button on each slot.




Each of these rectangles is its own Gui with button.

So, what I'm currently trying to do something like this:

Code: ags
 // Header

struct Slot_Structure{
   //various variables
  int NumberOfSlots;

};

managed struct Slot{
  //various variables
  int xpos;  
  int ypos;   //to determine where it is on screen
  GUI* slotgui;

  import static Slot*[] NewArray (int count);
};


// script


Slot_Structure blue;
Slot_Structure red;

static Slot*[] Slot::NewArray (int count)
{
  Slot* slot[];
  count++;  // adding one slot so that slot[0] can refer to the bottom controlling button
  slot = new Slot[count];
  for (int i=0; i<count;i++) { slot[i] = new Slot; }
  return slot;
}


function game_start()
{
  blue.NumberOfSlots = 4;
  red.NumberOfSlots = 8;

  for (int i=0; i<= blue.NumberOfSlots; i++)
   {
       //assign each slot a GUI
   }

 for //same thing for red  - this could probably be its own extender function
}



I doubt this works, but my ultimate goal is to be able to refer to something like blue.slot[3].slotgui in order to do things to the third slot's gui (making it visible or not, etc).  I'm not sure how to connect the struct and the managed struct, and how to handle the dynamic array in the process.

Is anyone able to offer some guidance?
#9
It was mostly academic at this point, but I thought I'd ask.

Thanks for the correction that it would be one array with an index of 0 to 4, I'm still getting my head around it all.
#10
So, say I wanted to make an array but I wanted to create a string that would name the array - is that possible?

For instance:

Code: ags


arrayname = String.Format("peter");
int arrayname[5];



in order to produce 5 arrays named peter[0] through peter[4].

I suspect the above won't work, but is it possible to do?

Thanks
#11
I've discovered my error - I had a GUI that was intended to sit on top of everything that was, of course, being detected by my function finding the next highest GUI, and thus the bBlackSlug was always above everything else.

Now to work out the other issues with my script.
#12
So, I have multiple GUIs going on for menus.  I also have a black full-screen GUI that I wish to be placed underneath the foremost GUI, and so whenever the foremost GUI is closed I want to have the black GUI (which I call gBlackSlug) to be moved behind the next foremost GUI (or disappear if there is no other used GUI).  My intent is that everything behind the menu is visually darkened, things beneath the menu cannot be interacted with, and so that when the player clicks outside the menu that it will close the menu (the gBlackSlug having a button covering the whole thing that will refer to the relevant functions).

What I've got to do that is first these functions:  (I use edmundito's Tween Module)

Code: ags

function HighestGUI()
{
  int Previous_ZOrder = 0;
  for (int x=0; x<Screen.Width; x+=5)
  {
    for (int y=0; y<Screen.Height; y+=5)
    {
      GUI *theGui = GUI.GetAtScreenXY(x,y);
      if ((theGui!=null)&&(theGui.ZOrder>Previous_ZOrder)&&(theGui!=gBlackSlug))
       {
         Previous_ZOrder = theGui.ZOrder;
       }
    }
  }
  return(Previous_ZOrder);
}

function ReorderBlackSlug(BlackSlugFade Fadetype, float t)
{
  int Target_ZOrder = HighestGUI();
  if (Target_ZOrder<=2)
  {
    gBlackSlug.Visible = false;
    gBlackSlug.Clickable =false;
    gBlackSlug.Transparency=100;
    gBlackSlug.ZOrder = 0;
  }
  else
  {
    if (gBlackSlug.Visible==false){gBlackSlug.Visible = true;}
    if (gBlackSlug.Clickable==false){gBlackSlug.Clickable = true;}
    if (Fadetype == eSlugFade)
      {
        if (gBlackSlug.Transparency!=100){gBlackSlug.Transparency = 100;}
        gBlackSlug.TweenTransparency (t, 40, eEaseLinearTween, eNoBlockTween, 0.0, eTweenSeconds);  // This fades in the gBlackSlug to Transparency 40 over t seconds
      }
    else if (Fadetype== eSlugNoFade)
      {
        if (gBlackSlug.Transparency!=40){gBlackSlug.Transparency = 40;}
      }
    gBlackSlug.ZOrder = Target_ZOrder-3;
  }
}
 

And then the button to bring up a menu is:

Code: ags
  if (gMenu.Visible==false)
    {
      gMenu.Visible = true;
      if (!IsGamePaused()){PauseGame();}
      gMenu.Clickable= false;
      gMenu.TweenPosition(0.5,Menu_Onscreen_X,  Menu_Onscreen_Y, eEaseOutExpoTween, eBlockTween, 0.0, eTweenSeconds);
      gMenu.Clickable= true;
      ReorderBlackSlug(eSlugNoFade, 0.0);

    }
  else if (gMenu.Visible==true)
    {
      if (IsGamePaused()==1){UnPauseGame();}
      gMenu.TweenPosition(0.5, Menu_Offscreen_X, Screen.Height, eEaseLinearTween, eBlockTween, 0.0, eTweenSeconds);
      gMenu.Visible=false;
      gMenu.Clickable= false;
      ReorderBlackSlug(eSlugNoFade, 0.0);
    }
}


However, what happens when I press the button opening the Menu is that after the Menu GUI moves onscreen, the gBlackSlug appears on top of gMenu. 

I'm new to scripting and can't puzzle out why, so I would love some insight and help.  Thanks!
#13
I seem to have solved my problem.  It appears my acspret.spr file was corrupted (I was working off an external hard drive at the time, I don't know if that had anything to do with it).  I was able to copy an old one from a backup, then when AGS opened, I was able to re-import the one sprite I did add.

I guess the lesson is backup often.

Thanks everyone.
#14
Well, I didn't delete it, and I can't open the game to check.
#15
Hi all,

So I've undated to v3.5.0, and have been merrily editing away, when I tried to save my work and got the error message "GetSpriteAsBitmap32bit: Unable to find sprite 0".  After being unable to save or build the game, I tried closing a restarting AGS, and now whenever I tried to open my game it presents the same error.

As best as I can tell, the only thing I did that was different was to import a new sprite.  It was a 32bit bmp (though I normally use png).

Does anyone have any ideas on how to fix this?

Thanks
#16
That works, thank you for the help!
#17
Thank you for the replies!

Crimson Wizard, thank you so much for your advice!  I'm still very new to scripting, and what you provided has pushed me a great deal!

What I'm trying to understand now is how to then make the custom Description property from the object over which the mouse is hovering appear in the 'Action Text' bar at the bottom of the screen a la Lucas Arts games.

Code: ags

	if (player.ActiveInventory == null)
	 {
          if (GetLocationType = eLocationObject)
               {
          lblActionText.Text = ??????????
                }
      else
            {
        lblActionText.Text = Game.GetLocationName(mouse.x, mouse.y);
            }
	}
#18
So is there no way to alter an object's description?
#19
Hi guys, I'm having a problem. I'd like to change the description of an object at a particular time, and so I've been using this line of script:

Code: ags

oObjectName.SetTextProperty("description", "New Description");


But when I test it in game, the game crashes with this error message:

"Get Property: no such property found in schema. Make sure you are using the property's name, and not its description, when calling this command."

I've experimented with capitalising 'description' and trying it without the speech marks, just in case.

Am I missing something key? Thanks for your help.
#20
Cassiebsg - That works!  Thank you very much.

dayowlron - I saw Cassiebsg's first and did that, so sorry I didn't try yours...

For anyone who cares, this is the script I used:

Code: asg

function room_RepExec()
{
if ((player.NormalView != 92)&&(Region.GetAtRoomXY(player.x, player.y)== region[1]))
  {
    player.ChangeView (92);
  }
if ((player.NormalView == 92)&&(Region.GetAtRoomXY(player.x, player.y)!= region[1]))
  {
    player.ChangeView (2);
  }
}


[edit] Also, in case you were wondering, it is a scrolling room.
SMF spam blocked by CleanTalk