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

#1
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?
#2
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?
#3
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
#4
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!
#5
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
#6
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.
#7
Hi everyone,

I have room with a stair case in the middle running from left to right, and when the player walks down it it looks a little awkward when they face up or down. I've creates a second walkable area on the stairs and am trying to use the following code to chance his view to a new one with only left and right facing sprites:

Code: ags

function room_RepExec()
{
if ((player.NormalView == 2)&&(GetWalkableAreaAt(player.x, player.y)==2))
  {
    player.ChangeView (92);
  }
if ((player.NormalView == 92)&&(GetWalkableAreaAt(player.x, player.y)!=2))
  {
    player.ChangeView (2);
  }
}


However, no change is apparent in the room when he walks in the given area - he stays at view 2.

Does anyone have any solutions?  Thanks.
#8
Please forgive my ignorance, but I'm trying to get my head around basic extender functions and having trouble.  I've currently got this going:

Code: ags

//global header
import function FaceDirectionWithoutTurn (this Character*, CharacterDirection, BlockingStyle);

// global script

 function FaceDirectionWithoutTurn (this Character*, CharacterDirection, BlockingStyle)
{
  SetGameOption (OPT_TURNWHENFACING , 0);
  this.FaceDirection(CharacterDirection, BlockingStyle);
  SetGameOption (OPT_TURNWHENFACING , 1);
}
{/code]

But it returns the error "GlobalScript.asc(2146): Error (line 2146): Already referenced name as import; you must define it before using it
"  - line 2146 being " function FaceDirectionWithoutTurn (this Character*, CharacterDirection, BlockingStyle)".

I feel like there's some basic concept I'm missing - can anyone help me?

Thanks
SMF spam blocked by CleanTalk