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

#421
You can *check* if an interaction is available:
Code: ags
IsInteractionAvailable(eModeTalkto)


I was wondering if you can turn off interactions that are already?
You have an interaction for a character (cCharater_Talk() has been set and filled in with some code); how do you turn this off/on at will?
Or do you have to set a custom property and use this to turn it on or off through various mouse cursor trickery?
#422
Here's the error:

Here's the code:
Code: ags

function room_Load()
{
  if (music_chan==null) {
      music_chan=aNorthfield_pasturisedPastorale_v6_0.Play(eAudioPriorityNormal, eRepeat);
  } else {
    if (music_chan.PlayingClip!=aNorthfield_pasturisedPastorale_v6_0){
      music_chan=aNorthfield_pasturisedPastorale_v6_0.Play(eAudioPriorityNormal, eRepeat);
    }
  }
}


And here's proof the audio was imported:



WTF I may ask?

#424
This is the variable that controls fading in and out in globalscript repexec. It's a timer with a #defined name.
#425
So if I loop checking Overlay after SayBackground, this will work, and it won't just instantly skip over SayBackground to move on to the next blocking event? How would I get a blocking event here, if not a loop?
#426
Is there any way to get the ID of an inventory item?
I want to combine two objects:

Code: ags

cCharacter.Loseinventory(iStuff1);
cCharacter.Loseinventory(iStuff2);
cCharacter.Addinventory(iThing);


However, if I use cCharacter.Addinventory(iThing,0) this creates it at the top of the inventory (not necessarily where original two items were) and cCharacter.Addinventory(iThing) will create it at the bottom (also inconvenient) or some random location.

How can I guarantee that if I add iThing, it will end up where iStuff1/2 were?
#427
I mean how the hell do you put a blocking event after the SayBackgrond() so it doesn't just happen instantly? Yet to make it work, you must follow the SayBackground() command with something that blocks; it doesn't occur to me what this is.
#428
jahnocli This is exactly what I did. The problem is SayBackground() doesn't work like I think it will
#431
I'm trying to use timers as a way of achieving a non-blocking fade-in/out. This is because I want the screen to go gradually black *at the same time* as a piece of fading-out audio ending; not immediately after.
This timer/audio playing is done instead of:

cCharacter.Say("&1 Blah blah blah blah blah blah....");
FadeOut();
Wait(GetGameSpeed()*1);
FadeIn();
cCharacter.Say("&2 .....blah blah blah blah blah blah....");
FadeOut();
Wait(GetGameSpeed()*1);
FadeIn();
cCharacter.Say("&3 .....blah blah blah blah blah blah.");

...because speech is always blocking, so the screen fade-out starts after the audio finishes.
The audio itself fades-out, so for this to happen at the same time as the screen fade-out is ideal.

This is what I've come up with at the moment, which obviously doesn't work.
I've also tried SayBubble() instead of SayBackground() - but of course speech is blocking, so even timers and timer-checking is not worried about.

GlobalScript.asc:
Code: ags

function BuddhistCowIslandSpeech()
{
  game.bgspeech_stay_on_display = 1;

  gTitleCard.BackgroundGraphic=3144;       //size-of-background black graphic
  gTitleCard.Transparency=100;  //invisible
  gTitleCard.Visible=true;

  SetTimer(TIMER_BUDDHIST_FADE_IN_OUT, GetGameSpeed()*22);
  BuddhistFadeInOut=100;
  
  BuddhistFadeInOut_1=true;
  
  aBUDD64.Play(eAudioPriorityNormal, eOnce);    //This audio is the speech part to the following line - so normally it would be: cBuddhistCow.Say("&64 Mooaclah was bored.....
  cBuddhistCow.SayBackground("Mooaclah was a bored creature, with many supernatural powers, and a life many years beyond our own; seriously, he had a better chance than someone who eats fruit and vegetables and does an hour of cardio a day. Like hundreds of times. He was old. One day, Mooaclah knew he couldn't control his kingdom on videogames and pizza alone, so he created many cow-shaped vessels to store his power...");

  //no time to pause here since SayBackground is non-blocking. But... Say is blocking. So....?

  SetTimer(TIMER_BUDDHIST_FADE_IN_OUT,GetGameSpeed()*1);
  BuddhistFadeInOut_1=false;
  BuddhistFadeInOut_2=true;
	
  aBUDD66.Play(eAudioPriorityNormal, eOnce);
  cBuddhistCow.SayBackground("...and they fought, spears and chains clashing against eachother until the god Arktus was finally vanquished; he changed quickly into a mountain sized pile of dirt, and we name him now ''Moorardna'', or, ''the third mountain''. After a time, it became the second age of Agnor, and pending a great flood (caused by the introduction of a new mountain), he built a large boat and fit all of the animals on board.");
	
  aBUDD67.Play(eAudioPriorityNormal, eOnce);
  cBuddhistCow.SayBackground("Horses, cows, ducks and crows; deer and peacock and dog; and some which no longer exist, such as the monkey...");
	
  SetTimer(TIMER_BUDDHIST_FADE_IN_OUT, GetGameSpeed()*5);
  BuddhistFadeInOut_2=false;
  BuddhistFadeInOut_3=true;
  
  aBUDD69.Play(eAudioPriorityNormal, eOnce);
	cBuddhistCow.SayBackground("...and so Elargro said to the one true king, ''Escapod, bring my golden to--");
	SetTimer(TIMER_BUDDHIST_FADE_IN_OUT,GetGameSpeed()*1);
  BuddhistFadeInOut_3=false;
  BuddhistFadeInOut_4=true;
  
  gTitleCard.Visible=false;    //turn off the black GUI; everything back to normal at this point
}

.......

function repeatedly_execute()
{
  //various non-blocking fade-in/out blocks according to which bool is true:

  while(IsTimerExpired(TIMER_BUDDHIST_FADE_IN_OUT)) {
    if (BuddhistFadeInOut_1) {
      BuddhistFadeInOut-=10;
      if (BuddhistFadeInOut<0) BuddhistFadeInOut=0;
      gTitleCard.Transparency=BuddhistFadeInOut;
      SetTimer(TIMER_BUDDHIST_FADE_IN_OUT, 15);
    }
    else if (BuddhistFadeInOut_2) {
      BuddhistFadeInOut+=10;
      if (BuddhistFadeInOut>100) BuddhistFadeInOut=100;
      gTitleCard.Transparency=BuddhistFadeInOut;
      SetTimer(TIMER_BUDDHIST_FADE_IN_OUT, 5);
    }
    else if (BuddhistFadeInOut_3) {
      BuddhistFadeInOut-=10;
      if (BuddhistFadeInOut<0) BuddhistFadeInOut=0;
      gTitleCard.Transparency=BuddhistFadeInOut;
      SetTimer(TIMER_BUDDHIST_FADE_IN_OUT, 15);
    }
    else if (BuddhistFadeInOut_4) {
      BuddhistFadeInOut+=10;
      if (BuddhistFadeInOut>100) BuddhistFadeInOut=100;
      gTitleCard.Transparency=BuddhistFadeInOut;
      SetTimer(TIMER_BUDDHIST_FADE_IN_OUT, 5);
    }
  }
}


Any help anyone can give would be great ;P
#432
Got it.

The working code, for anybody interested:

Code: ags

  if (gInventory.Visible) {
     
    // up-arrow is enabled
    if (invCustomInv.TopItem > 0) 
    { 
      btnInvUp.NormalGraphic = 4; //on
      btnInvUp.PushedGraphic = 5333; //disabled
    }
    // up-arrow is disabled
    else                             
    { 
      btnInvUp.NormalGraphic = 5333; //disabled
      btnInvUp.PushedGraphic = 5333; //disabled
    }
    
    // down-arrow is enabled
    if (invCustomInv.ItemCount > invCustomInv.TopItem + 12)
    { 
      btnInvDown.NormalGraphic = 1; //on
      btnInvDown.PushedGraphic = 5334; //disabled
    }
    // down-arrow is disabled
    else                                                         
    { 
      btnInvDown.NormalGraphic = 5334; //disabled
      btnInvDown.PushedGraphic = 5334; //disabled 
    }
  }


My inventory box is 12 items: 3 rows of 4 items each.
#433
What do you mean InventoryWindow.TopItem? My window is called gInventory, it doesn't have a property called TopItem.
(nor is there InventoryWindow, just InventoryItem, InvWindow, inventory, and INVENTORY).

invCustomInv?
#434
I have an inventory with 2 buttons on the side, up and down arrows, which allow you to move through the inventory. When you are at the 'top' or 'bottom' of the inventory (and hence can move no further by clicking the appropriate button), the buttons are still there and still the same graphic.
Is there a way I can I can change the arrow graphic in this situation, to represent it being turned 'off', or make the button invisible?
#435
Thankyou guys, belatedly :)
Works a treat :)

Code: ags

function dialog_options_repexec(DialogOptionsRenderingInfo* info)
{
  int i = 1, xpos = 0;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (mouse.y >= info.Y && mouse.x >= xpos && mouse.x <= xpos+96)
      {
        info.ActiveOptionID = i;
        return;
      }
      xpos += 96;
    }
    i++;
  }
  gFakeDialogOptions.Visible = false;    //THIS LINE ADDED, THAT'S IT
}
#436
I'm having trouble, once again, getting the custom dialog rendering options to work.

I first wanted to get an image of the current dialog options, and then keep them there in place while speech continued.
However, since changing the background colour from white to transparent, an 'after image' of my previous option set sits on screen, 'under' the new set of options. (the after-image button graphics are non-functional)

The after image is cleared again when an option is picked.
The after-image lasts between when speech ends, and when the next option is chosen; the speech then starts for this option.

I've tried a few things, and I know the answer is staring me in the face, but I just can't find out where, or what, to put to wipe the after-image options.

Here's a link to my viedo, to demostrate what's happening:
http://redrom.ltd/img/dialog error.webm

Here is my code:
gFakeDialogOptions is a GUI 1366x96 box, that's colour 0
MyDynamicSpriteForTheFakeGUI is a global DynamicSprite*

Code: ags

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Get Dimensions
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{

// Create a 1366x64 dialog options area at (0,704)

  info.X = 0;
  info.Y = 672;
  info.Width = 1366;
  info.Height = 96;
}

//----------------------------------------------------------------------------------------------------------------------
// Draw Dialog Options
//----------------------------------------------------------------------------------------------------------------------

function DrawDialogOptions(DrawingSurface* ds, DialogOptionsRenderingInfo* info)
{
  int i = 1, ypos = 0, xpos = 0;  
  ds.Clear(COLOR_TRANSPARENT);
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      String str = info.DialogToRender.GetOptionText(i);  //get glyph number from option text
      int cur_img = str.AsInt;                            //current image is that number
      ds.DrawImage(xpos, ypos, cur_img);                  //draw this glyph
      xpos += 96;                                         //xpos+=width of glyph
    }
    i++;
  }	
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Render
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_render(DialogOptionsRenderingInfo* info)
{
  DrawDialogOptions(info.Surface, info);
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Repeat Exec
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_repexec(DialogOptionsRenderingInfo* info)
{
  int i = 1, xpos = 0;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (mouse.y >= info.Y && mouse.x >= xpos && mouse.x <= xpos+96)
      {
        info.ActiveOptionID = i;
        return;
      }
      xpos += 96;
    }
    i++;
  }
}

//----------------------------------------------------------------------------------------------------------------------
// Dialog Options Mouse Click
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_mouse_click(DialogOptionsRenderingInfo* info, MouseButton button)
{
  if (info.ActiveOptionID > 0)
  {
    MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
    DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
    DrawDialogOptions(ds, info);
    ds.Release();

    gFakeDialogOptions.BackgroundGraphic = MyDynamicSpriteForTheFakeGUI.Graphic;
    gFakeDialogOptions.Visible = true;
    info.RunActiveOption();
  }
}


Any help will be welcome.
#437
Seriously? :confused:
No contenders? Am I offering too little?
#439
I'm trying to find out the scaling level of my main character on a particular point of a scaling walkable area.
I've tried:
Code: ags
Display("scaling",cJulius.Scaling);

...but nothing comines out - I just get a window saying "scaling "

Is there a way to get this done?
Checked tha manual - it say's Scaling is a function to get/set the property.
#440
Site & Forum Reports / Re: Bug reports
Fri 14/12/2018 22:45:12
I don't know if anyone else has experienced this problem with the site, but I copy+paste text - from an actual text document or filename - it comes out incredibly tiny. If I insert it into a link, it refuses to be part of the link. Somehow [ size ] tags are getting in there, but I can't edit them, and I have no idea how to get rid of them or why they're coming across from eg. part of a link in Notepad, the browser address bar, etc.


example:
http://redrom.ltd/img/animation_J+DB.zip
SMF spam blocked by CleanTalk