Larry 7 template - Crits and Beta test

Started by Rui 'Trovatore' Pires, Sat 11/12/2004 00:00:17

Previous topic - Next topic

Rui 'Trovatore' Pires

Yes, I made a Larry 7 Template! Yes, like all my previous templates the code is very messy! :P

Basically I need criticism and beta testing on this. Play with it, break it, have fun, let me now, kay?

http://12.22.230.41/MicroTech/Hosted/Game/LSL7.zip


Oh, you'll need at least AGS v2.7 beta 7...

EDIT - Version 0.1 is up, includes bug fixes and discreet extras, like the ability of having more than 24 verbs/inv items in a menu list. Still un-reviewed by RickJ.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

viktor

wel I hawe the newest verion of AGS but I still can't open the template...
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Rui 'Trovatore' Pires

Really? It works for me. What happens when you try and load it? Usually AGS seems to crash if you're using an earlier version than the one the template was made with. Or do you not see the template at all? You are sure you're using the latest beta?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

viktor

I'm using the 2.62 version.  Since when was there a higher version?
I can't seem to find it anywhere on the main page...
signature" border="0
<a target='_blank' href='https://imgbb.com/'>resurrection pictures for facebook</a>

Privateer Puddin'


Rui 'Trovatore' Pires

#5
QuoteOh, you'll need at least AGS v2.7 beta 5...
:P

EDIT - Oh my... over 200 views, and still no reply... is it that bad?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

n3tgraph

As I posted on 'our' forums

It really kicks ass!!!!!
I'm amazed
* N3TGraph airguitars!

Rui 'Trovatore' Pires

I'm finding bugs I'm surprised no one noticed yet... I'll cook up another version with less bugs, more comments and use of the new GUI system.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

RickJ

Custom Properties
Have you considered adding a  text property for each of the verbs.  That way if someone checks a verb for an item they could just enter a text message for it right there. 

So if there isn't any other action defined then the message could be displayed.   If there isn't a custom message defined in the item's properties then you could display default messages according to item type as you are doing now. 


Lazy Z

Any chance you could release it for v. 2.62 too...? Or are you using AGS stuff that's only in the latest beta? Gah, that was a bad sentence. :P

Anyhow, I don't really want to upgrade to an experimental beta, so I won't be able to test your template, and I think others might feel the same. Which kinda sucks, since I love Larry 7's GUI. Oh, well.
'Twas brillig, and the slithy toves did gyre and gimble in the wabe. All mimsy were the borogroves and the mome raths outgrabe.'

Top-5 Games

Rui 'Trovatore' Pires

Rick J - <scratches head> I swear I'm trying to understand, but I can't quite...

Lazy Z - This latest beta does have a current bug that doesn't allow you restoring or saving, but if you are scripting you might as well get a hold of it - there's a lot of changes being made, permanent changes, that you might as well be prepared for by checking out the betas, which allows you to take one change at a time. And yes, there's a couple of features that I want, such as the recent ability to check where in the listbox the mouse is. I'll be changing my template to incorporate that.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

RickJ

For example:

  • For each verb check box in the custom properties schema add a corresponding text entry field.

  • Now edit the properties of an item such as a rock object.

  • Check the "Eat" verb (or "Drink" or whatever). 

  • Now enter the custom message in the text entry field: "You're not man enough to eat that rock, are you?"

  • If an action is defined for this item then the message is ignored as is done now.  If not then the custom property message is displayed instead.  If the message in the custom properties is empty then you can display the default message for that type of item as you do now.

Rui 'Trovatore' Pires

It's a great idea, but I think the current method not only makes it easier to manage the whole thing (it's all in the same script), your method would need exceptions - namely, the times when something ELSE happened instead of just displaying a message. THAT would need a script entry, and having some things in properties and some in script might not be too friendly...

...I think. Feel free to prove me wrong.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

RickJ

Ok, well I think you could do everythig in your NoMatch() function.  I have taken the liberty of dressing it up a bit and modifying the "TURN" verb as I suggested above.   I think you can see how to do this for the rest of the verbs.   

Code: ags

//===================================================================
function NoMatch() {
//
// This function is called if no other actions are defined for the 
// selected item. It displays a message defined for the selected item 
// and verb in the custom properties. If that message is an empty 
// string then a default message is displayed.
//===================================================================
   string name, msg;
   int    type;
  
   // Get the name of the location 
   GetLocationName(mouse.x, mouse.y, name);
   StrToLowerCase(name);

   // Get the type of the location 
   if (GetInvAt(mouse.x, mouse.y)!=-1) type = 4    // Inventory
   else type = GetLocationType(mouse.x, mouse.y);
  
 
   // Swim
   if (Said("swim")) Display("You'd look silly swimming on the %s, don't you think?", temploc);
 
   // Look
   if (Said("look")) Display("What you see is what you get.");
 
   // Examine
   if (Said("examine")) Display("Further examination of the %s reveals nothing new.", temploc);
 
   // Drink
   if (Said("drink")) Display("The %s is not intended for comsumption.", temploc);
 
   // Eat
   if (Said("eat")) Display("The %s is not intended for comsumption.", temploc);
 
   // Open
   if (Said("open")) Display("The %s doesn't seem to open.", temploc);
 
   // Close
   if (Said("close")) Display("The %s doesn't seem to close.", temploc);  
 
   // Read
   if (Said("read")) Display("There's nothing to read on the %s.", temploc);  
 
   // Rip
   if (Said("rip")) Display("Try as you might, you can't rip the %s.", temploc);  
 
   // Smell
   if (Said("smell")) Display("The %s has a farily non-descript smell.", temploc);  
 
   // Press
   if (Said("press")) Display("You press the %s, but nothing seems to happen.", temploc);  
 
   // Take
   if (Said("take")) Display("You can't seem to be able to take the %s.", temploc);  
 
   // Talk
   if (Said("talk")) Display("The %s does not respond.", temploc);  

   // Turn
   if (Said("turn")) {
      if (type==1) {                           // Hotspot
         GetHotspotPropertyText(GetHotspotAt(mouse.x, mouse.y), "TurnMsg",  msg):
         if ((StrComp(msg, "")!=0) Display(msg);
         else Display("You'd be hard pressed to turn the %s.", name); 
      }
      else if (type==2) {                      // Character
         GetCharacterPropertyText(GetCharacterAt(mouse.x, mouse.y), "TurnMsg",  msg):
         if ((StrComp(msg, "")!=0) Display(msg);
         else Display("You'd be hard pressed to turn the %s.", name); 
      }
      else if (type==3) {                      // Object
         GetObjectPropertyText(GetObjectAt(mouse.x, mouse.y), "TurnMsg",  msg):
         if ((StrComp(msg, "")!=0) Display(msg);
         else Display("You'd be hard pressed to turn the %s.", name); 
      }
      else if (type==4) {                      // Inventory
         GetInvPropertyText(GetInvAt(mouse.x, mouse.y), "TurnMsg",  msg):
         if ((StrComp(msg, "")!=0) Display(msg);
         else Display("You'd be hard pressed to turn the %s.", name); 
      }
      else {                                   // Unknown
         Display("Hard as you try you get no satisfaction."); 
      }
   }
}


One additional thought, I would add a check to see if the character was the player character or not.  If it was the PC then have a different default message (i.e. use personal pronouns etc instead of character's name).


Rui 'Trovatore' Pires

Ok, I think I see what you mean, but unless I'm wrong, if "turn key" actually DID something other than just display a message, the relevant code would be places here, right? And ditto for everything else, probably making the NoMatch function overloaded. And if a function gets too many if/else statements, AGS won't allow it to compile - I learned that the hard way. And we have to assume that the game made will accept a LOT of verbs. For my AGI template, I had to make THREE NoMatch functions, one calling the other once it was finished, because of this.

It's definitely a good idea, but I think it's not all that practical.

HOWEVER, you point about the PC's check is a very good one. I'll definitely add it, thanks!
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

RickJ

Quote
... if "turn key" actually DID something other than just display a message, the relevant code would be places here, right?
I think you would you put the code for "Turn key" in the same place you do now.  Why would it be placed in NoMatch()?  If I understand correctly the code that does the actions would call NoMatch() nothing was defined for the action, isn't this correct?

Rui 'Trovatore' Pires

Oh, silly me. Yes yes YES I see what you mean. I haven't had much time to update the template, and won't release it yet anyway becuase the latest beta has an issue with restarting, but I WILL do as you suggest. I understand now.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

RickJ

Here are a couple of other ideas to make your script more readable.

game_start(), releatedly_execute(), releatedly_execute_always()
I usually don't like to put much code into these system functions.   Instead I all the code into other functions and then call them from these system functions.  In your case I would probably make:
  • l7_start()
  • l7_execute()
  • l7_execute_always().

    Of course you could break thins down further is you wish (i.e. l7_something_start(), l7_anotherthing_start(), etc).

    Global vs Local
    I always like to name things so that I know what is local and what is global.   The way I choose to do it is to use mixed case for global functions and variables and to use all lowercase for local functions and variables.  For example the NoMatch() function above would become l7NoMatch() if were global and l7_no_match() if it were local.  There are of course many other ways of doing this. 

    CallRoomScript()
    Are you famillar with this and have you considered using it to implement actions?  The reason I ask is that this would allow all of the action code for a specific room to be included in that room's script.  This makes things scalable (i.e. No matter how many rooms are added the complexity and size of the global script doesn't increase).  I haven't absorbed your code enough to make a more specific  recommendation.








Rui 'Trovatore' Pires

1 - I see your point. It would be much more readable, yes. I'll do it.

2 - So for instance what's now add_inv should become AddInv? It was on purpose, so people wouldn't mistake it with the already existing function, and DoAction() and whatnot were only like that because there was none alike...

3 - Yes, I'm familiar with that, I though though it would be easier if I dumped it all in the room script and had it done with - this way the user would only have to mess with the room script.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

RickJ

Quote
... I see your point. It would be much more readable, yes. I'll do it.
It also makes it easier for other people to use your template.  Consider doing the same for the other system event handlers such as interface_click() etc.   

Quote
.. So for instance what's now add_inv should become AddInv? It was on purpose, so people wouldn't mistake it with the already existing function...
To avoid confusion with already existing functions I used a lowercase prefix.  So in the BlueGui it would have been bgAddInv().   Using the new OO stuff this would likely be Bg.AddInv().  So in your case you would have something like l7AddInv() or L7.AddInv().

Quote
...I thought  though it would be easier if I dumped it all in the room script and had it done with - this way the user would only have to mess with the room script.
That's why I asked about CallRoomScript().  I was thinking that interface_click() could just do a CallRoomScript() and pass the item number that was clicked in the action menu.  Then in the room script you would have the following to fill out however one desired.
Code: ags

function on_call(int verb) {
  // called when verb is selected from menu
   if (verb==0) {
   }
   else if (verb==1) {
   } 
   else if (verb==2) {
   }
   else if (verb==3) {
   }
   else if (verb==4) {
   }
   else if (verb==5) {
   }
   else if (verb==6) {
   }
   else if (verb==7) {
   }
   :
   :
   else if (verb==nn) {
   } 
}


I was also wondering about what you are doing in repeatedly_execute_always()?  I haven't yet spent a lot of time on it but in the little time have,  I didn't get  a feel for what was going on there.   Whenever I use  any of the repeatedlys I scrutinize what I am doing.

SMF spam blocked by CleanTalk