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

#241
Here's my updated code. Doesn't crash: simply doesn't show the woodpanel graphic (sprite 2639) anywhere, at any any time.

Code: ags
function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{
  ConversationIsOn=true;
  dialog_left=11;

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

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

function DrawDialogOptions(DrawingSurface* ds, DialogOptionsRenderingInfo* info)
{
	ds.DrawImage(0, 672, 2639);
	
	int i = 1, ypos = 0, xpos = dialog_left;  
  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 = 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 = dialog_left;
  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;
        
        //transplanted in from dialogue_options_mouse_click() to get rid of background/old buttons in real time
        MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
        DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
        
				
	ds.DrawImage(0, 672, 2639);
				
	DrawDialogOptions(ds, info);
        ds.Release();
        
        return;
      }
      xpos += 96;
    }
    i++;
  }
  gFakeDialogOptions.Visible = false;
}

//----------------------------------------------------------------------------------------------------------------------
// 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();
    ds.DrawImage(0, 672, 2639);
    DrawDialogOptions(ds, info);
    ds.Release();

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


Still stumped.
#242
MyBackgroundSpriteForFakeGUI Is a global variable, and I’m not using it anymore. The line you see now is just ds.DrawImage(0,672,WOODPANEL)
#243
I’ve changed the above code to work ds for dynamic sprite and used the same MyFakeGUI etc, removed all ds.clear(), and changed the dimension and sprite to maybe show up on the screen somewhere; then, I put it in all functions. Still nothing; yes to option icons, no to ‘wood finish’ picture.
#244
As for drawing a background image, over which I draw the glyphs already there....

I have this code:
Code: ags
	MyBackgroundSpriteForFakeGUI = DynamicSprite.Create(1366, 96, false);
	DrawingSurface* button_bg = MyBackgroundSpriteForFakeGUI.GetDrawingSurface();
	button_bg.DrawImage(0, 672, 2639);
	button_bg.Release();

...Which I've tried putting in the functions (before any other code) dialog_options_repexec(), dialog_options_render(), and DrawDialogOptions(), and nothing seems to work.

I'm trying to put this image:

Behind the button images you see on the screen.

In all situations, nothing is drawn to screen, just the option images you see in the video.
#245
Works now - I think...
I was going to use a define, but dialog_left is good enough.

Code: ags
//----------------------------------------------------------------------------------------------------------------------
// Dialogue Options Get Dimensions
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{
	ConversationIsOn=true;
	
	// Create a 1366x96 dialog options area at (0,704)
	dialog_left=11;

  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 = dialog_left;	//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 = 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 = dialog_left;
  while (i <= info.DialogToRender.OptionCount)
  {
    if (info.DialogToRender.GetOptionState(i) == eOptionOn)
    {
      if (	 mouse.y >= info.Y
					&& mouse.x >= xpos
					&& mouse.x <= xpos+96)//+dialog_left)
      {
        info.ActiveOptionID = i;
        
        //transplanted in from dialogue_options_mouse_click() to get rid of background/old buttons in real time
        MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
        DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
        DrawDialogOptions(ds, info);
        ds.Release();
        
        return;
      }
      xpos += 96;
    }
    i++;
  }
  gFakeDialogOptions.Visible = false;
}

//----------------------------------------------------------------------------------------------------------------------
// 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();
  }
}
#246
I've recently sort to edit my code to give the options a left indent of 11px.

Here's the code:
Code: ags
//----------------------------------------------------------------------------------------------------------------------
// DIALOGUE
//----------------------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------------------
// Dialogue Options Get Dimensions
//----------------------------------------------------------------------------------------------------------------------

function dialog_options_get_dimensions(DialogOptionsRenderingInfo* info)
{
	ConversationIsOn=true;
	//sprtFloatingText.Delete();
	
// Create a 1366x96 dialog options area at (0,704)
  dialog_left=11;

  info.X = dialog_left;
  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 = 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;
        
        //transplanted in from dialogue_options_mouse_click() to get rid of background/old buttons in real time
        MyDynamicSpriteForTheFakeGUI = DynamicSprite.Create(info.Width, info.Height, true);
        DrawingSurface* ds = MyDynamicSpriteForTheFakeGUI.GetDrawingSurface();
        DrawDialogOptions(ds, info);
        ds.Release();
        
        return;
      }
      xpos += 96;
    }
    i++;
  }
  gFakeDialogOptions.Visible = false;
}

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

function dialog_options_mouse_click(DialogOptionsRenderingInfo* info, MouseButton button)
{
	//ConversationIsOn=true;
	
  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();
  }
}


// END DIALOG FUNCTIONS


I expect all options to be drawn with an initial 11px indent. However, once I choose an option, it defaults to 0px indent; then when speech is over, it flips constantly between 11px and 0px indent.

Video:

https://bluekeystudios.com/img/conversation_error.mov

How can I get it to have an 11px indent at all times, including when selecting an option (ie. selection isn't always off by 11px if I click near the border)?
I think it's something in dialog_options_repexec() doing this weird overdrawing, but not sure. I've tried a few things, nothing works.

Bonus question: I'm thinking of having a large background image to frame the conversation icons -- where do I put the drawing code, once in dialog_options_render()?
#247
Okay, but the 'one stop selling site' isn't what I was thinking of (despite my poor choice of description); of course everyone goes to Steam, *my* adventure game will be on Steam.

But what if there was a way, outside AGS, to play demos, make comments, have games and developers profiles, etc with selling as an afterthought? Come have a look at my game xyz, check out screenshots and video, meet developers and read their profiles and what they've been up to, oh and also if you want it you can go to Steam or whatever.

The main drive of this idea is that:
1) people don't have webspace (and aren't web designers);
2) they need this to put their game on something, and space for images they'll use in the forum; so...
3) this site is that place.

And also it has links to Steam, PayPal, Itch, etc. if you so desire.

Money's not a concern; work's not a concern; tax isn't, because 'we' don't sell anything, PayPal etc. does; it's just a way to put your game somewhere and discuss/advertise/show it to others.
I mean, basically its the 'Games In Production' forum but an entire free website with no ads or subscription. (or, idk, $1/year for webspace)

Would anyone be interested in *this?* 'We' (basically me) could do what those sites Ali was talking about, minus the selling.
#248
True, but this would be for AGS games, and the small players who currently sell for $3 on itch.io
#249
Space for images to use in these forums? You get some.
Page to display your game and lead to a sales domain or PayPal? You get these.
One central place for buying and selling upcoming and produced adventure games? All here.
Walk through? All the walk throughs.

Your thoughts?
#250
Solved :D  Just made floatingText unclickable.
Thank you :)
#251
Aha, Got it. It's FloatingText, the gui used for the text of an objects Description field. Well now I'm in a pickle.
#252
Which fnuction should I add it to in globalscript? Repeat_always? Not sure what you mean. I already have a on_event in globalscript?..
#253
Yes I've discovered this also - but how do I get the icon bar (1366x70 bar at top of screen) to *stop* capturing clicks? I've it gIconbar.Visible=false, which means you can't see it, but it's still there :/
#254
Hi all

I have an object on screen. It's visible and clickable. I have a method for interact. I've tried it with baseline being where it is, and baseline being 768 (max height of screen). I can't get it to respond with any click, and with interact, the cursor icon doesn't change (indicating that it doesn't have a 'Interact' interaction... except it does). It doesn't even come up with it's own title (all objects in the game with a Description property have it displayed in the upper screen when moused-over). It doesn't have any hotspot's on top of it. It doesn't have a menu on top of it (the menu is invisible anyway).

Why is it not clickable, or doesn't even respond to anything?
#255
Main point is:
Can I make my own constant, global variable with a value returned from a function?
If not, why? Is it impossible?
#256
I've tried defining a global const; no option for this in global variables.
I've tried defining one in-script, except then it's not global.
Tried defining a readonly int in global.h, but it says I need to enter a literal value like 2 rather than a function like Random(2); (I think)
I've tried searching google and the forums, but nothing obvious shows.
I've tried to look up the manual, but nothing in there.

So what do I do?
#257
Solved.
#258
I don't know... :/
I'll test it.
#260
I'm using SayAtBubble to position the bubble as I want. I've put two defines into the global.ash to  set x and y coordinates:

in global.ash:
Code: ags

#define hare_x					590
#define hare_y					12


in a conversation with the Hare character:
Code: ags

@6
  cJulius.SayAtBubble(hare_x,hare_y,"&615 How did you get invited to this animal party village green thing?");
  cHare.SayBubble("&16 How'd *you* get invited? You an animal?");
...


...BUT the X coordinate does nothing. It always positions the bubble in the centre of Julius head:



Here's the function code:

Code: ags

void realSayAtBubble(this Character*, int x, int y, String message, GUI* bubbleGui, DynamicSprite* bubbleSprite)
{
  // Render and display the speech bubble
  if(bubbleSprite == null)
    bubbleSprite = this.renderBubble32(message, true);
  Overlay* bubbleOverlay;
  if(bubbleGui == null && _defaultGui == null)
    bubbleOverlay = Overlay.CreateGraphical(x, y, bubbleSprite.Graphic, true);
  else
  {
    if(bubbleGui == null)
      bubbleGui = _defaultGui;
      
    bubbleGui.Clickable = false;
    bubbleGui.X = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
    bubbleGui.Y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);
    bubbleGui.Width = bubbleSprite.Width;
    bubbleGui.Height = bubbleSprite.Height;
    bubbleGui.BackgroundGraphic = bubbleSprite.Graphic;
    bubbleGui.Transparency = 0;
    bubbleGui.Visible = true;
  }
  SpeechBubble* bubble = SpeechBubble.Create(this, message, bubbleSprite, bubbleGui, bubbleOverlay);
  
  bubble.setX(x);
  bubble.setY(y);
  bubble.setBackgroundSpeech(false);
  bubble.setThinking(false);
  _addBubbleChar(this);
  
  // Play speech (this chunk blocks until speech is complete)

  String lineNumber = getLineNumber(message);
  // If we have set an invisible font, just call Say() - or whatever custom Say() implementation we have
  if(SpeechBubble.get_InvisibleFont() != -1)
  {
    FontType speechFont = Game.SpeechFont;
    Game.SpeechFont = _invisibleFont;
    this.SB_sayImpl(message);
    Game.SpeechFont = speechFont;
  }
  // Else if we're going to play a voice clip, call Say() with the clip number and a blank line of text
  // (takes care of animation and doesn't display any text). This doesn't work with text-based lip-sync,
  // so if you're using text-based lip-sync, you MUST set an invisible font to get lip-sync to work
  else if(lineNumber != null && Speech.VoiceMode != eSpeechTextOnly) // && !GetGameOption(OPT_LIPSYNCTEXT))
  {
    String s = lineNumber;
    while(s.Length < message.Length)
      s = s.AppendChar(' ');
    this.SB_sayImpl(s);
  }
  // Otherwise we have to do it manually...
  else
  {
    bubble.setAnimating(true);
    this.animateSpeech(message);
  }
  
  
  // Remove the bubble
  bubble.Remove();
}

...

void SayAtBubble(this Character*, int x, int y, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...") {
    this.SB_sayImpl(message);
  } else {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, true);
    x = this.x - GetViewportX() - bubbleSprite.Width/2;
    x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
    
    this.realSayAtBubble(x, y, message, bubbleGui, null);
  }
}

...


// Draw a speech bubble in 32-bit (using transparency)
DynamicSprite* renderBubble32(this Character*, String message, bool talkTail)
{
  // Calculate text dimensions
  int textWidth = _maxTextWidth;
  if(textWidth <= 0)
    textWidth = calculateDefaultTextWidth(this);
  textWidth = _minInt(textWidth, System.ViewportWidth - _paddingLeft - _paddingRight);
  int textHeight = GetTextHeight(message, Game.SpeechFont, textWidth);
  
  textWidth = calculateExactTextWidth(message, Game.SpeechFont, textWidth, textHeight);
  
  // Calculate bubble dimensions
  int totalWidth = textWidth + _paddingLeft + _paddingRight;
  int bubbleHeight = textHeight + _paddingTop + _paddingBottom;
  int totalHeight;
  if(talkTail)
    totalHeight = bubbleHeight + _talkTailHeight;
  else
    totalHeight = bubbleHeight + _thinkTailHeight;
  
  SpeechBubbleHeight_blr=totalHeight;//BLR
  
  // Set up the canvases
  DynamicSprite* bubbleSprite = DynamicSprite.Create(totalWidth, totalHeight, true);
  DrawingSurface* bubbleSurface = bubbleSprite.GetDrawingSurface();
  //bubbleSurface.Clear();
  
  DynamicSprite* bgSprite; DrawingSurface* bgSurface;
  DynamicSprite* borderSprite; DrawingSurface* borderSurface;
  if(_backgroundTransparency == 0)
  {
    bgSprite = bubbleSprite;
    bgSurface = bubbleSurface;
  }
  else
  {
    bgSprite = DynamicSprite.Create(totalWidth, totalHeight, true);
    bgSurface = bgSprite.GetDrawingSurface();
  }
  if(_borderTransparency == 0)
  {
    borderSprite = bubbleSprite;
    borderSurface = bubbleSurface;
  }
  else
  {
    borderSprite = DynamicSprite.Create(totalWidth, totalHeight, true);
    borderSurface = borderSprite.GetDrawingSurface();
  }
  
  int bgColor = mixColors(this.SpeechColor, _backgroundColor, _backgroundSpeechTint);
  int borderColor = mixColors(this.SpeechColor, _borderColor, _borderSpeechTint);
  
  // Draw!
  bgSurface.DrawingColor = bgColor;
  bgSurface.DrawRectangle(1, 1, totalWidth-2, bubbleHeight-1);
  drawRoundedCorners32(bgSurface, borderSurface, borderColor, 0, bubbleHeight);
  String tail[]; int tailWidth; int tailHeight;
  if(talkTail)
  {
    tail = _talkTail; tailWidth = _talkTailWidth; tailHeight = _talkTailHeight;
  }
  else
  {
    tail = _thinkTail; tailWidth = _thinkTailWidth; tailHeight = _thinkTailHeight;
  }
  bgSurface.DrawingColor = bgColor;
  bgSurface.drawPixelArray(tail, totalWidth/2-tailWidth, bubbleHeight, tailWidth, tailHeight, 'O', false, false);
  borderSurface.DrawingColor = borderColor;
  borderSurface.drawPixelArray(tail, totalWidth/2-tailWidth, bubbleHeight, tailWidth, tailHeight, 'X', false, false);
  borderSurface.DrawLine(_cornerRoundingRadius, 0, totalWidth - _cornerRoundingRadius, 0);
  // Left Line
  borderSurface.DrawLine(0, _cornerRoundingRadius, 0, bubbleHeight - _cornerRoundingRadius);
  // Right Line
  borderSurface.DrawLine(totalWidth-1, _cornerRoundingRadius, totalWidth-1, bubbleHeight - _cornerRoundingRadius);
  // Bottom Lines
  borderSurface.DrawLine(_cornerRoundingRadius, bubbleHeight, totalWidth/2 - tailWidth, bubbleHeight);
  borderSurface.DrawLine(totalWidth/2, bubbleHeight, totalWidth - _cornerRoundingRadius, bubbleHeight);
  
  if(_backgroundTransparency != 0)
  {
    bgSurface.Release();
    bubbleSurface.DrawImage(0, 0, bgSprite.Graphic, _backgroundTransparency);
    bgSprite.Delete();
  }
  if(_borderTransparency != 0)
  {
    borderSurface.Release();
    bubbleSurface.DrawImage(0, 0, borderSprite.Graphic, _borderTransparency);
    borderSprite.Delete();
  }
  
  bubbleSurface.DrawingColor = this.SpeechColor;
  int outlineColor = mixColors(this.SpeechColor, _textOutlineColor, _textOutlineSpeechTint);
  if(_textOutlineWidth > 0)
    bubbleSurface.drawStringWrappedOutline(_paddingLeft, _paddingTop, textWidth, _textOutlineStyle, Game.SpeechFont, _textAlign, message, _textTransparency, outlineColor, _textOutlineWidth);
  else
    bubbleSurface.drawStringWrappedAA(_paddingLeft, _paddingTop, textWidth, Game.SpeechFont, _textAlign, message, _textTransparency);
  
  bubbleSurface.Release();
  return bubbleSprite;
}


I can include more functions; I've altered like 10 lines of code in this module, but the above *looks* okay...???
SMF spam blocked by CleanTalk