Author Topic: BASS Stub - A Lightweight BASS template  (Read 18738 times)

Re: BASS Stub - A Lightweight BASS template
« Reply #20 on: 26 Jun 2013, 13:57 »
I'm a little confused.

There is no need to call Game.GetLocationName here, because you already know that it is "game.inv_activated" item id, therefore you can use inventory[game.inv_activated].Name; but further, you don't really need to compare Names, you can just compare pointers:
And then you have this:
Quote
Code: Adventure Game Studio
  1. // if player has active item in hand, use it no matter what (we may get "unhandled event" here)
  2. if (mouse.Mode == eModeUseinv)
  3. {
  4.    if (player.ActiveInventory.Name != Game.GetLocationName(mouse.x, mouse.y))
  5.       inventory[game.inv_activated].RunInteraction(eModeUseinv);
  6. }
  7.  

You're assuming that the object, hotspot, character or inventory item you're hovering over won't ever have identical names. I don't understand your logic here.

This would be better:
Code: Adventure Game Studio
  1. if (mouse.Mode == eModeUseinv)
  2. {
  3.   InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
  4.   if (item != null && player.ActiveInventory != item) inventory[game.inv_activated].RunInteraction(eModeUseinv);
  5.   else if (GetLocationType(mouse.x,mouse.y) != eLocationNothing) ProcessClick(mouse.x, mouse.y, eModeUseinv);
  6. }




Also, I very much dislike you doing this!:
Code: Adventure Game Studio
  1. if (inventory[game.inv_activated].IsInteractionAvailable(eModeUseinv) == 1)
It's a boolean and you're checking if it's 1. I know AGS's booleans are actually integers and this code will always work. But you shouldn't make this a practice. It should either be the two with no exceptions:
Code: Adventure Game Studio
  1. if (inventory[game.inv_activated].IsInteractionAvailable(eModeUseinv))
  2. // OR
  3. if (inventory[game.inv_activated].IsInteractionAvailable(eModeUseinv) == true)
If AGS ever gets a variable overhaul turning booleans into actual booleans, then this code could throw an error (if it's strict). Plus it's a VERY misleading condition statement that will only confuse people trying to understand the code.
« Last Edit: 26 Jun 2013, 14:08 by Ryan Timothy »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #21 on: 26 Jun 2013, 14:08 »
I'm a little confused.
<...>
You're assuming that the object, hotspot, character or inventory item you're hovering over won't ever have identical names. I don't understand your logic here.

I am sorry for confusion, Ryan, for the last code example I just mindlessly copied existing code, because the purpose of that example was to show different condition (mouse.Mode == eModeUseinv). I did not even paid attention to what is in the block.
Also, I was speaking about section of code under "button = eMouseLeftInv". There can't be any characters there.
If you read my posts further, you will see that I made two suggestions on how to optimize item comparisons.

Although your variant combines two of them :). First you take item from screen coordinates and then still use inventory[game.inv_activated]. If you use "game.inv_activated" there's no need to check item under mouse.
« Last Edit: 26 Jun 2013, 14:11 by Crimson Wizard »

Re: BASS Stub - A Lightweight BASS template
« Reply #22 on: 26 Jun 2013, 14:22 »
My apologies. It's been ages since I've last used the game.inv_activated that I honestly couldn't remember what it was. I had also forgotten that AGS had a onClick handler for eMouseLeftInv. So it should've just been this:

Code: Adventure Game Studio
  1. if (mouse.Mode == eModeUseinv)
  2. {
  3.   // I don't know how this module was scripted, so as a fail-safe, I put: player.ActiveInventory != null
  4.   if (player.ActiveInventory != null && game.inv_activated != player.ActiveInventory.ID) inventory[game.inv_activated].RunInteraction(mouse.Mode);
  5. }

Edit: Also, I've never played BASS, if you're not going completely strict, the other option is this:
Code: Adventure Game Studio
  1. if (mouse.Mode == eModeUseinv)
  2. {
  3.   if (player.ActiveInventory != null && game.inv_activated == player.ActiveInventory.ID)
  4.   {
  5.     player.ActiveInventory == null;  // deselect inventory item if you click the same item on itself
  6.     mouse.Mode = eModePointer;
  7.   }
  8.   else inventory[game.inv_activated].RunInteraction(mouse.Mode);
  9. }
« Last Edit: 26 Jun 2013, 14:27 by Ryan Timothy »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #23 on: 26 Jun 2013, 14:28 »
My apologies. It's been ages since I've last used the game.inv_activated that I honestly couldn't remember what it was.
I never knew about it until Monsieur OUXX asked something related on forums.

There are a lot of "game" members, some of which have quite non-obvious meaning, and allow to change different aspects of the engine, that cannot be affected otherwise.

cat

  • Mittens Baronet
  • AGS Baker
  • Angelica Crosley
    • cat worked on a game that was nominated for an AGS Award!
      cat worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #24 on: 01 Jul 2013, 10:17 »
- The original BASS changed to an "exit" signs when over places where the character would leave the room. Useful, in my opinion, will do that.

I did something like that for SheepQuest, using custom properties to define the direction. I could clean up the code and donate it for your template if you want (that is - after OROW of course, this week I have different priorities ;) )

Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #25 on: 01 Jul 2013, 11:37 »
Cat, that's a great offer, please do. I *have* done pretty much the same already, using regions and custom props to allow for different "direction" cursors... I'd sure like to see how our code compares!

Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template (v2.0)
« Reply #26 on: 03 Jul 2013, 16:01 »
*Bump* Version 2.0 is up; see first post.
« Last Edit: 03 Jul 2013, 16:03 by Ghost »

Re: BASS Stub - A Lightweight BASS template
« Reply #27 on: 04 Jul 2013, 11:21 »
This is very useful!  Thanks for developing this template!

frenzykitty

  • Oh. HI!
    • I can help with animation
    •  
    • I can help with making music
    •  
    • I can help with voice acting
    •  
    • I can help with web design
    •  
Re: BASS Stub - A Lightweight BASS template
« Reply #28 on: 23 Aug 2013, 09:54 »
I don't know if I'm being a total idiot - but if I try and change the resolution of my game, things start acting very strangely?

For example if I make a new room after changing the resolution, it still makes it in the original resolution of the template? Am I being really stupid (laugh)


Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #29 on: 23 Aug 2013, 13:41 »
Changing resolution works fine for me, but the test room, having a 320x240 image, may look odd because the image won't fill the screen (backgrounds aren't resized).
Does the new room actually tell you it's still 320x240? Have you imported an image that works with your resolution?

Re: BASS Stub - A Lightweight BASS template
« Reply #30 on: 12 Sep 2013, 15:16 »
I'm not sure if this is the right place to ask this but, does this template support saving and loading? If not, can I add that function manually or is there a plugin or something to do that? I hope the question is not sheer ignorance but this template works really perfect for me.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #31 on: 12 Sep 2013, 15:43 »
I'm not sure if this is the right place to ask this but, does this template support saving and loading? If not, can I add that function manually or is there a plugin or something to do that? I hope the question is not sheer ignorance but this template works really perfect for me.
Although this is not a direct answer to your question, I think it is worth to clarify - that the AGS template does not make any restrictions to your game, all it does is providing a starting script/resources. You may remove/rewrite any parts of it, even most of it if you like. Similarly you can add anything.

Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #32 on: 12 Sep 2013, 15:44 »
The template has no custom-made save/load fucntions, but you can easily use AGS script to add that- read up the commands
RestoreGameDialog(), RestoreGameSlot() and SaveGameDialog(), SaveGameSlot()
in the AGS manual to learn how loading/saving works.

Then, you can just create a GUI with buttons that call your load/save functions. (The template, for example, has a "quit" button in the slide-in inventory GUI- you could also place load/save buttons there!)

For future reference, a template is a collection of scripts (and assets). You can ALWAYS alter/expand a template because once you create a new game from it, you can see all the code (and assets). Plugins are different since they are compiled by the author and can't be (easily) modified.

Hope this gets you started!

__
[edit]

Crimson was faster! But I was more elaborate! Mwuhaha!

Re: BASS Stub - A Lightweight BASS template
« Reply #33 on: 12 Sep 2013, 16:31 »
This is great, thank you!

Here is my contribution - a special BASS version of Character.Say()!

Code: Adventure Game Studio
  1. function Say_BASS_Style(this Character*, String message)
  2. {
  3.   String bass_style = "";
  4.   int space_idx = message.IndexOf(" ");
  5.   bool prev = false;
  6.   while (space_idx != -1)
  7.   {
  8.     String part = message.Substring(0, space_idx + 1);
  9.     message = message.Substring(space_idx + 1, message.Length - (space_idx + 1));
  10.     if (prev)
  11.     {
  12.       prev = false;
  13.     }
  14.     else if (Random(1) == 0)
  15.     {
  16.       part = part.UpperCase();
  17.       prev = true;
  18.     }
  19.     bass_style = bass_style.Append(part);
  20.     space_idx = message.IndexOf(" ");
  21.   }
  22.   if (!prev && Random(3) == 1) message = message.UpperCase();
  23.   bass_style = bass_style.Append(message);
  24.   return this.Say(bass_style);
  25. }

( (laugh)  (laugh)  (laugh) )

Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #34 on: 12 Sep 2013, 19:37 »
Here is my contribution - a special BASS version of Character.Say()!

wItcHCrAfT !1!11 :=

Anian

    • I can help with backgrounds
    •  
    • I can help with characters
    •  
    • I can help with play testing
    •  
    • I can help with web design
    •  
Re: BASS Stub - A Lightweight BASS template
« Reply #35 on: 19 Sep 2013, 01:05 »
Very nice.
I don't want the world, I just want your half

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: BASS Stub - A Lightweight BASS template
« Reply #36 on: 20 Apr 2015, 17:20 »
Reporting a small issue with AGS 3.3.0 RC1:
When you click the "quit button" then the standard "Quit/Play" built-in dialog window appears but the text is shifted down 5 pixels lower or so. Its upper part is on the button, but its lower part pours out.
I haven't seen that with any other 3.3.0 RC1 game, so I guess it's caused by the template.

===========

@Ghost : I have migrated your template to 32-bits. PLEASE DOWNLOAD THAT VERSION AND DO ALL YOUR FURTHER CHANGES BASED ON IT.
« Last Edit: 20 Apr 2015, 17:34 by Monsieur OUXX »
 

Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #37 on: 20 Apr 2015, 22:57 »
When you click the "quit button" then the standard "Quit/Play" built-in dialog window appears but the text is shifted down 5 pixels lower or so. Its upper part is on the button, but its lower part pours out.
I haven't seen that with any other 3.3.0 RC1 game, so I guess it's caused by the template.
Yes, the text shift is caused by the template replacing the default fonts with ttfs that support the full range of characters. I am aware of this, but so far nobody really complained about it, and these days you see very few of the build-in windows being used anyway. I'll document it in an updated version- the solution is to simply reset the fonts.

@Ghost : I have migrated your template to 32-bits. PLEASE DOWNLOAD THAT VERSION AND DO ALL YOUR FURTHER CHANGES BASED ON IT.
I appreciate your work, but out of interest: I understand that 16bit is the hard default and 32bit isn't used that often and several people avoid it to keep their game smaller. Isn't it simpler to upgrade the (very few) sprites yourself when you want 32bit? I am genuinely curious.
« Last Edit: 20 Apr 2015, 23:26 by Ghost »

Monsieur OUXX

  • Cavefish
  • Mittens Vassal
  • Mittens Half Initiate
    • I can help with proof reading
    •  
    • I can help with translating
    •  
    • I can help with voice acting
    •  
Re: BASS Stub - A Lightweight BASS template
« Reply #38 on: 21 Apr 2015, 08:48 »
There was another thread where it was discussed that 32-bits should now be the standard so I did that, but there seems to have been some misunderstanding, maybe on my side. So hold on. (roll)
 

Ghost

  • AGS Baker
  • Rottwheelers
  • Still haunting :)
    • Ghost worked on a game that was nominated for an AGS Award!
      Ghost worked on a game that won an AGS Award!
Re: BASS Stub - A Lightweight BASS template
« Reply #39 on: 21 Apr 2015, 14:51 »
No problem at all; as I said I really appreciate the effort you went through. (nod)