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 - Trent R

#401
AGS Games in Production / Re: The Wanderer
Wed 04/03/2009 21:38:43
I think the scanlines could work to show when the game is paused (whenever a menu is shown)

But yes, love the art direction... and so jealous that I can't do anything remotely close.


~Trent
PS- 101 rooms? Awesome. :D And with a game like this, I'd totally explore everything (especially if the storyline tends you to explore)
#402
Ooh goody. Didn't even think of that.

Also realized that I never put up the float ones (cause I meant to put them between different  brackets).

For the Distance Forumula, I put ints as params, cause I'd use it mostly with player.x,y or mouse.x,y. But would it be better to use float parameters and make the end-user use IntToFloat all the time?


~Trent
#403
You'd only have to declare it in the room script, and not need to bother with the Global Variables pane.

~Trent
#404
An offshoot of my other thread, but what are some are mathmatical functions that you want to see or use. Also, post any that you currently have scripted and I will add them to this first post.

I think I'm pretty good at math, but it's been almost two years since I've done anything beyond basic algebra. I started by looking at the C# MathHelper class, but they sadly don't show the whole function (at least that I'm able to find ATM)

~Trent


Initial post: int: AbsInt, MinInt, MaxInt  float: AbsFloat, MinFloat, MaxFloat, DistanceFormula


Code: ags
int AbsInt(int value) { //Returns the Absolute Value of value.
  if (value<0) {value=value*(-1);}
  return value;
}

int MinInt(int value1, int value2) { //Returns the lesser of two int values.
  if (value1>value2) return value1;
  else return value2;
}

int MaxInt(int value1, int value2) { //Returns the greater of two int values.
  return (value1>value2)*value1 + (value1<=value2)*value2;
}

int Factorial(int value) { //Returns value!
  //Coming soon
}


Code: ags
float AbsFloat(this Maths*, float value) { //Returns the Absolute Value of value. |value|
  if (value<0.0) {value=value*(-1.0);}
  return value;
}

float MinFloat(this Maths*, float value1, float value2) { //Returns the lesser of two float values.
  if (value1<value2) return value1;
  else return value2;
}

float MaxFloat(this Maths*, float value1, float value2) { //Returns the greater of two float values.
  return (value1>value2)*value1 + (value1<=value2)*value2;
}

float DistanceFormula(this Maths*, int x1, int y1, int x2, int y2) { //Returns the distance between the two points
  float evalX, evalY, evalFinal;
  evalX=Maths.RaiseToPower((IntToFloat(x2)-IntToFloat(x1)), 2.0);
  evalY=Maths.RaiseToPower((IntToFloat(y2)-IntToFloat(y1)), 2.0);
  evalFinal=Maths.Sqrt((evalX+evalY));
  return evalFinal;
}

#405
To monkey: I figured out why I didn't realize sooner that this Maths* wouldn't work The extender function actually compiles and imports fine. But if you try to use it, you get one of three errors. CJ: Could that possibly been an error/warning that shows? But then again, it's very low priority too.

Anyways, I updated the original post. Changed LoseAllInventory due to what monkey siad. Added LoseInventoryMult and AddInventoryMult. And also Joe's SetWalkingSound and RemoveAllWalkingSounds (I haven't used sounds much, but that seems like it'd be useful for switching floor materials--Like Trilby or ATOTK)


~Trent
PS - I'm so psyched that I figured out (by accident) that /// comments work! I knew they did that in C#, but it always created the <summary> and <param> tags for you, so I assumed AGS couldn't do that yet. Couldn't be more excited!
#406
QuoteYou cannot possibly make an extender method for the Maths structure and actually use it. Maths is a managed struct which solely provides static methods.
The fact that it's managed means you cannot create an instance of it.
Just realized minutes ago about the managed type... I guess a Math or MathHelper struct would be best... and probably a different module too.

QuoteBesides int->float->int is okay. float->int->float is bad.
I'm trying to see where I've done that... are you speaking of if I could extend the Maths struct?

QuoteAnd if you're setting the inventory quantity to 0, is it really necessary to check if the character had the item to begin with?
If you insist on checking, I'd suggest you use this.InventoryQuantity > 0 instead of the function. Depending how many inventory items you actually have it could stand to be much faster that way with the reduced overhead.
As for that, it was cause I was thinking in my head of a LoseInventoryMult function, which I ended up writing differently.


Thanks for the input so far, I highly admire each of you guys.

~Trent
#407
Actually, I almost put AbsInt and AbsFloat as different functions. Would that really be useful? (I honestly have only used floats once so far in my project--trig functions)
Same with MinFloat, MaxFloat?

~Trent
#408
I'm starting to create a pseudo-module script filled with Extender functions. So far they're all math ones, plus one character. Are there any all-purpose extender functions that you have in your game? Please share them and suggestions for others.

~Trent


Initial post: character.LossAllInv, Maths.Abs,Min,Max
Update 1: character.LoseAllInventory, LoseInventoryMult, AddInventoryMult, SetWalkingSound, RemoveAllWalkingSounds

character.Extenders
Code: ags
ViewFrame *frame;


void LoseAllInventory(this Character*){ //Character loses every single inventory item.
  int i = 1;
  while (i <= (Game.InventoryItemCount)){
    this.InventoryQuantity[i]=0; //Be warned: This doesn't pass anything to on_event
    i++;
  } 
  UpdateInventory();
}

void LoseInventoryMult(this Character*, InventoryItem *item, int count){ //Character loses specified number of inventory item.
  int i;
  while (i<count){
    this.LoseInventory(item);
    i++;
  } 
}

void AddInventoryMult(this Character*, InventoryItem *item, int count){ //Character gains specified number of inventory item.
  int i;
  while (i<count){
    this.AddInventory(item);
    i++;
  } 
}


void SetWalkingSound(this Character*, int Sound, int Frame, int Frame2){
  int i=0, max=0;
  if(Game.GetLoopCountForView(this.NormalView)<8)  max = Game.GetLoopCountForView(this.NormalView);
  else   max = 8;
  while(i<max){ 
    frame = Game.GetViewFrame(this.NormalView, i, Frame);
    frame.Sound=Sound;
    if(Frame2!=-1){  
      frame = Game.GetViewFrame(this.NormalView, i, Frame2);
      frame.Sound=Sound;  
    }
    i++;
  }
}

void RemoveAllWalkingSounds(this Character*){
  int i=0, j=0, max;
  if(Game.GetLoopCountForView(this.NormalView)<8)  max = Game.GetLoopCountForView(this.NormalView);
  else  max = 8;
  while(i<max){ 
    while(j<Game.GetFrameCountForLoop(this.NormalView, i)){
      frame = Game.GetViewFrame(this.NormalView, i, j);
      frame.Sound=0;
      j++;
    }
    j=0;
    i++;
  } 
}
#409
Revan, that reminds me of ChaCha, a US based texting service that does the same thing. Cool thing is that it's free, except for whatever charges your carrier has.


~Trent
PS-Oooh, just found out they allow calling too!
#410
Oh duh. I told someone else that the other day... I should've caught that.


~Trent
#411
General Discussion / Re: PixelArt editor
Tue 03/03/2009 22:13:15
Quote from: SpacePaw on Mon 02/03/2009 22:26:12
As for the libraries I have no idea yet to be honest. I was searching for some books concerning programing 2d graphics but I didnt find much. I'm not sure if GDI+ will be enough for that :)
Maybe I'm an idiot and I'm hearing you wrong, but XNA has a graphics content pipeline....

A suggestion about shortcuts: Adobe Premiere had fully customizable shortcuts, for every function. But they also had shortcut templates (or called something like that) so if would automatically set up shortcuts to copy Premiere CS3, Final Cut, and other video editing programs. And of course, you could export your own preferences.

Although many graphics programs have fairly identical shortcuts, this wouldn't hurt to add in later in your development. And, this forum is the perfect source to ask "Hey, what are the shortcuts for Graphics Gale?" or such.


~Trent
#412
Quote from: From the Manual entry 'ChangeRoom'IMPORTANT: This command does not change the room immediately; instead, it will perform the actual room change once your script function has finished (This is to avoid problems with unloading the script while it is still running). This means that you should not use any other commands which rely on the new room (object positionings, and so on) after this command within the same function.

I think that since the command is delayed, it's trying to run all 4 of those ChangeRooms on the same character at once. Try changing those to else if (except the first one, of course)


~Trent
#413
QuoteI bet this question was asked a million times before, but i was too lazy to look it up.
Not a good attitude for your first post...

But nonetheless I will help. I have a few questions: Is the function linked to the correct event? Have you adjusted your top edge down? Is there a walkable area in that location? Have you considered using Regions (which also might be cleaner code)?


~Trent
#414
I'd like a keyboard shortcut that will show the parameters of the function you're currently in. Like what happens right after your type the opening parenthesis of
player.Walk(


~Trent
#415
Oh boy that was a good read. Thanks Vince.

~Trent
#416
Perhaps something like
Code: ags

//room_rep_exec
Hotspot *hotty=Hotspot.GetAtScreenXY(player.x, player.y);
bool greasedfloor;

if (hotty==hCreakyFloor && !greasedfloor) {
  //Can't step there!
}

But, Khris or someone else will probably soon come by and give you something better. := Cause they're cool like that.

~Trent
#417
Well, there is a event for standing on a hotspot. Why can't you just use that?

~Trent
#418
Awesome! Good to see new stuff on Jake.


~Trent
#419
Haha, I like your enthusiam.

I believe there's a few Math modules around... lemme see if I can find them.
[Edit]: Dang. Seems I'm wrong... but nonetheless you can actually script a lot of math functions using AGS script. For example, this recent thread for natural logs.


~Trent
#420
Maybe not the best way to do it, but perhaps using DynamicSprite.CreateFromFile could help you get around a giant exe. Then you can realease compressed gifs, as well as uncompressed hard-drive intensive gifs.

But it's possible that won't even work.

~Trent
SMF spam blocked by CleanTalk