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

#1
Hello!

I'm working on a very short, very simple adventure game, essentially an interactive short story. I'm a real novice at AGS and scripting in general, however, and there's a problem that's eluding me. I've posted in the technical help forums but my dumb brain is still unable to make it work and I'm on a bit of a deadline. I'm willing to Paypal someone for what I'm sure is about a half hour of scripting work. Essentially, I'm looking to create a graphical element that follows around the hover-over text Module I'm using so that it can be more readable. I'd like the option for it to work with the text hovering over the mouse and in the upper left corner of the screen. It's the last thing I haven't been able to get working and I'm at my wits end.

Feel free to PM or email at garybutterfield (at) gmail (dot) com. ;) Bonus points for zero condescension! ;)
#2
Thank you for the help!

So, the limits of my scripting knowledge seem to have reared their ugly head again. I'm not sure how to position the GUI so that it...

A) only appears when the Description module is displaying a description
B) Display behind the description text
C) Display the correct size so that the GUI always covers the text.

Part of this definitely comes from using the ready made module so the scripting is more advanced than anything I've actually done.

I'm even having a hard time finding the appropriate tutorials that might address this problem. I've watched this guys (https://www.youtube.com/playlist?list=PL21DB402CB4DAEAEF) GUI videos and text overlay videos but it doesn't seem to help. I know how to change the GUI backdrop for Display text but not for the hover over that's part of the Description module.

Any help is appreciated. I feel like after all the assistance I've received from the forum, I should make a donation or something.

In case you are willing to help and it is useful having the Description Module script handy, here it is:

Code: ags

// Main script for module 'Description'

Descriptions Description;
export Description;


function Descriptions::OLTidy() {
  if (this.DisplayType==eDescDisplayOverlay && this.ol!=null &&
		  this.ol.Valid) {
    this.ol.Remove();
  }
}

function Descriptions::GUIMode(GUIControl *gc) {
  this.OLTidy();
  if (gc==null) { 
		Display("ERROR! null GUIControl passed to Description.GUIMode, contact game author");
		return -1;
  }		
  this.DisplayType=eDescDisplayGUIControl;
  this.gc=gc;
}

function Descriptions::OverlayMode() {
  this.DisplayType=eDescDisplayOverlay;
}

function Descriptions::StringOnly() {
  this.OLTidy();
  this.DisplayType=eDescDisplayNone;
}


protected function Descriptions::Update_String() {
  // Special case of busy cursor
  if ((mouse.Mode==this.NoDescriptionWhenMode) ||
			(this.NoDescriptionWhenNotMode>=0 && mouse.Mode!=this.NoDescriptionWhenNotMode) ||
		  (this.NoDescriptionWhenMode==eModeWait && IsInterfaceEnabled()==0)) { 
		this.Text=""; return;
	}
  String hs=Game.GetLocationName(mouse.x, mouse.y);
  if (this.IncludeInventory && InventoryItem.GetAtScreenXY(mouse.x, mouse.y)!=null) {
    InventoryItem *ii=InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
    hs=ii.Name;
	}
#ifdef AGS_SUPPORTS_IFVER
	if (this.ButtonsWithFont>=0 && GUIControl.GetAtScreenXY(mouse.x, mouse.y)!=null) {
	  GUIControl *bb=GUIControl.GetAtScreenXY(mouse.x, mouse.y);
	  if (bb.AsButton!=null && bb.AsButton.Font==this.ButtonsWithFont) hs=bb.AsButton.Text;
	}
#endif
  String verb="";
  if (this.VerbMode==eDescVerbModeNever || (hs=="" && this.NoVerbOverNothing) ) {
		this.Text=hs;
		return;
  } else if (player.ActiveInventory!=null && mouse.Mode==eModeUseinv) {
    String ai=player.ActiveInventory.Name;
    if (this.VerbMode==eDescVerbModeUser && this.VerbS!=null) verb=this.VerbS;
    else verb=this.UseS;
    this.Text=String.Format("%s %s %s %s", verb, ai, this.PrepositionS, hs);
  } else if (this.VerbMode==eDescVerbModeUseOnly) {
		this.Text=hs;
		return;
  } else {
    if (this.VerbMode==eDescVerbModeAuto) {
      if (mouse.Mode==eModeLookat) verb=this.LookS;
      if (mouse.Mode==eModePickup) verb=this.GetS;
      if (mouse.Mode==eModeTalkto) verb=this.TalkS;
      if (mouse.Mode==eModeInteract) verb=this.UseS;
      if (mouse.Mode==eModeWalkto) verb=this.WalkS;
    } else if (this.VerbS!=null) verb=this.VerbS;
    
    this.Text=String.Format("%s %s", verb, hs);
	}
	if (this.NoDescriptionWhenNoVerb && verb=="") this.Text="";
}

protected function Descriptions::Update_Position(int font, int width) {
  if (this.Location==eDescLocationFollow || 
			(this.Location==eDescLocationSticky && this.Text!="" && this.Text != this.last)) {
		this.width=GetTextWidth(this.Text, font);
		this.height=GetTextHeight(this.Text, font, width);
		this.x = mouse.x + this.OffsetX;
    if (this.OLAlignment==eAlignCentre) this.x-=this.width/2;
    else if (this.OLAlignment==eAlignRight) this.x-=this.width;
		if ((this.x + this.width) > this.MaxX) this.x = this.MaxX - this.width;
		if (this.x < this.MinX) this.x = this.MinX;
		this.y = mouse.y + this.OffsetY;
		if ((this.y + this.height) > this.MaxY) this.y = this.MaxY - this.height;
		if (this.y < this.MinY) this.y = this.MinY;
	}
}

protected function Descriptions::Update_DS() {
  this.ds=DynamicSprite.Create(this.OLWidth, this.height);
  DrawingSurface *dsds=this.ds.GetDrawingSurface();
  dsds.DrawingColor=this.OLColor;
  dsds.DrawStringWrapped(0, 0, this.OLWidth, this.OLFont, eAlignLeft, this.Text);
  dsds.Release();
}

protected function Descriptions::Update_Overlay() {
  if (this.Text=="") {
    this.OLTidy();
  } else {
		this.Update_Position(this.OLFont, this.OLWidth);	
		if (this.ol!=null && this.ol.Valid) {
      if (this.OLSierraBG) {
        this.Update_DS();
        this.ol=Overlay.CreateGraphical(this.x, this.y, this.ds.Graphic, true);
      } else {
        this.ol.SetText(this.OLWidth, this.OLFont, this.OLColor, this.Text);
        this.ol.X = this.x; // so the position of the overlay will be adjusted every game loop
        this.ol.Y = this.y;
      }
		} else {
      if (this.OLSierraBG) {
        this.Update_DS();
        this.ol=Overlay.CreateGraphical(this.x, this.y, this.ds.Graphic, true);
      } else {
			  this.ol=Overlay.CreateTextual(this.x, this.y, this.OLWidth, this.OLFont, this.OLColor, this.Text);
      }
		}  
	}
}      

protected function Descriptions::Update_GUI() {
	int font;
	if (this.gc.AsLabel!=null) font=this.gc.AsLabel.Font;
#ifdef AGS_SUPPORTS_IFVER
	else if (this.gc.AsButton!=null) font=this.gc.AsButton.Font;
#endif
	
	if (this.CropGUIToo) this.Update_Position(font, this.MaxX-this.MinX);
	else this.Update_Position(font, this.gc.OwningGUI.Width);

	if (this.Location!=eDescLocationStatic) {
		this.gc.OwningGUI.X=this.x;
		this.gc.OwningGUI.Y=this.y;
		this.gc.Width=this.width+1;
		if (this.CropGUIToo) this.gc.OwningGUI.Width=this.width+2;
	}	
  if (this.gc.AsLabel!=null) this.gc.AsLabel.Text=this.Text;
  else if (this.gc.AsButton!=null) this.gc.AsButton.Text=this.Text;
  
  // Fade control
	if ((this.Text=="") && (this.gc.OwningGUI.Visible) && (this.alpha<this.FadeStart)) {
    this.alpha+=this.FadeOutSpeed;
    if (this.alpha>=this.FadeStart) this.gc.OwningGUI.Visible=false;
  } else if (this.Text!="") {
    if (!this.gc.OwningGUI.Visible) {
      this.gc.OwningGUI.Visible=true;
      this.alpha=this.FadeStart;
    } else if (this.alpha>this.FadeEnd) {
      this.alpha-=this.FadeInSpeed;
    }
	}
	if (this.alpha>100) this.alpha=100;
	else if (this.alpha<0) this.alpha=0;
	this.gc.OwningGUI.Transparency=this.alpha;
}
  
function Descriptions::rep_ex() {
  this.last=this.Text;
  this.Update_String();
  if (this.DisplayType==eDescDisplayGUIControl) {
    this.Update_GUI();
  } else if (this.DisplayType==eDescDisplayOverlay) {
		this.Update_Overlay();
	}
}


function repeatedly_execute_always() {
  // Should this go in rep_ex_always?
  // easy enough for user to change, if required
  Description.rep_ex();
}

function on_event(EventType event, int data) {
  if (event==eEventLeaveRoom) Description.OLTidy();
}

function game_start() {
  // Set up defaults
  Description.LookS="Look at";
  Description.GetS="Get";
  Description.UseS="Use";
  Description.PrepositionS="on";
  Description.TalkS="Talk to";
  Description.WalkS="Walk to";
  Description.IncludeInventory=true;
  Description.NoVerbOverNothing=true;
  Description.OLWidth=100;
  Description.OLAlignment=eAlignLeft;
  Description.FadeStart=100;
  Description.FadeEnd=0;
  Description.FadeInSpeed=20;
  Description.FadeOutSpeed=5;
  Description.OffsetX=-16;
  Description.OffsetY=16;
  Description.MinX=0;
  Description.MinY=0;
  Description.MaxX=system.viewport_width-1;
  Description.MaxY=system.viewport_height-1;
  // Default to Overlay mode
  Description.OLColor=15000;
  Description.ButtonsWithFont=-1;
  Description.NoDescriptionWhenMode=-1;
  Description.NoDescriptionWhenNotMode=-1;
  Description.OverlayMode();
}

#3
As mentioned in the title, I'm using the Description module found here: http://www.adventuregamestudio.co.uk/forums/index.php?topic=26306.0

It's working very well but due to some of my background design, the text is sometimes hard to read. I know I can create a GUI element that pops up where the text does but the amount of text varies from object to object so the GUI would have to be big enough to encapsulate every message. That seems clumsy to me.

I wonder if there's a way to change only the font for the hover over text to have a box around it? Or to be a text with a colored in background? I would like to keep the rest of my text the same.
#4
Thank you thank you thank you.

For some reason this killed the description pop up over whatever the mouse is hovering over but I'll comb the threads and see if I can rebuild just that part without the error.

I really, truly appreciate it.

#5
First, thank you guys very much for the help. I seem to still be having the problem though and if you're willing, I'd like to upload what I have.

In response to the bit about the hover text, I'm using the built in feature in the template I started with. I can't seem to find the part of the code that determines it. I can find the code that prevents hover text when an inventory item is selected but I don't actually have inventory in this game so that bit seems unrelated.

As far as the hotspot room transfer problem goes, I checked for invisible GUI elements, walkbehinds, and the like and I don't see any. I'm still having the same problem.

I've uploaded a zip of my source files. If you're willing to take a look, I'll gladly buy you an internet beer (if such things were possible).

https://dl.dropboxusercontent.com/u/58679530/EFW.zip
#6
Hello

I've made a short, MacVenture style game in AGS and though I mostly have it working correctly, I have three stubborn problems that I'm hoping for help with.

1)
Given that it's a MacVenture style (first person), I created a character but don't have any graphics assigned to them. To transition between rooms, the player (the character's name is Horace) interacts with a hotspot with the following script.

Code: ags

Horace.ChangeRoom(20);


This works perfectly about 85% of the time. Other times, the player is transported to the incorrect room. I've checked and double checked that the room being referred to in the script is the correct one. The behavior is inconsistent.

2) Some of the Hotspots have deadzones. The player will not transport to the room in question unless a certain area on the Hotspot is clicked or the hotspot is clicked multiple times.

3) I'm using the LW_BASS_V2.0 template as I really only wanted the mouse to examine and interact. Is there a way to change where the hover text appears? The script seems to indicate that will appear near the item but since I don't have items (only hotspots to deliver text or move the player), the hover text always appears in the same location.

I appreciate your patience! I'm incredibly new to coding and the experience has been very rewarding.

-Gary-
SMF spam blocked by CleanTalk