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

#421
Interesting.  Okay then, thanks.
#422
Goot:

I'm not asking how to call a function from a room's interaction script...I want the function to be called whenever a specific interraction event gets triggered regardless of what room it is in...without having to copy and paste the function calls into every room interaction event
#423
Alright.

At top of global script file:

int fstep = 1; WORKS
int fstep = ints_to_float(0,050); DOESNT WORK


In repeatedly execute:

int fstep = ints_to_float(0,050);  WORKS

(ints_to_float(a,b) is a plugin function)
#424
Advanced Technical Forum / AGS changelist
Sat 06/11/2004 21:59:29
For some reason the changelist was on the forums, and now the link is broken now that the forums have changed servers...where is the changelist for the new version of AGS?
#425
I don't want them to repeatedly execute, I want them to execute when the certain interaction events of a room get triggered.
#426
where do I put a script to have it execute on an interaction event that happens for all rooms?
#427
Looks like INVENTORY, REDCURSOR, and WHITECURSOR are supposed to be replaced with the GUI / sprite numbers used in your game for those things
#428
General Discussion / Re: I bought a laptop!
Sat 06/11/2004 15:45:56
QuoteI have both of those cards, and ATis one is better

Well I just got the laptop, and discovered that this ATI card is not even REMOTELY CLOSE to being as good as the GeForce one.  I mean, it is not even in the same league.  The GeForce could run Doom3 in 1280x1024 at maximum texture quality, whereas this ATI card won't even ALLOW me to play it at anything higher than 640x280...which is not very smooth...and the colors and contrast are messed up and it doesn't look half as good s the GeForce playing it in 640x480.  What the heck?  You obviously haven't used these two cards!
#429
Yes!Ã,  I got it working!Ã,  This looks really beautiful...:)

Here is what the completed function looks like.Ã,  It was much more of a pain than I thought...especially determining the distance between two random numbers between 0-360 because of the whole modulo thing...wasted way too much time trying to figure that out!


function MoveCompass(int cobject, int cfirstsprite, int timer)
Ã,  //PRE: fticks is a global float for time that is reset on room load
Ã,  //Ã,  Ã,  Ã, fstart is a global float for starting degrees that is set to previous compass rotation on room load
Ã,  //Ã,  Ã,  Ã, cobject is the object on this room that represents the compass
Ã,  //Ã,  Ã,  Ã, cfirstsprite is the # of the first compass sprite (out of 359 total sprites)
Ã,  //Ã,  Ã,  Ã, timer is the timer that this function should use
Ã,  //POST: compass is moved a small amount, and a timer is set to move again if more movement is waiting
{
Ã,  if (IsTimerExpired(timer))
Ã,  {
Ã,  Ã,  //define constants
Ã,  Ã,  int fe = ints_to_float(2,718);
Ã,  Ã,  int ffreq = ints_to_float(0,-100);
Ã,  Ã,  int fstep = ints_to_float(0,050);
Ã,  Ã,  int fnorth = angle_from_degrees(int_to_float((GetRoomProperty("CompassNorth")-1)*45));
Ã, 
Ã,  Ã,  //set fstart if this is the first frame of animation
Ã,  Ã,  if (fstart==-1)
Ã,  Ã,  Ã,  fstart = angle_from_degrees(int_to_float(GetObjectGraphic(cobject)));Ã, 
Ã, 
Ã,  Ã,  //find magnitude of angle between the starting and north direction with correct sine
Ã,  Ã,  int fdiff, fdifftest;
Ã,  Ã,  fdiff = fsub(fstart, fnorth);
Ã,  Ã,  fdifftest = fsub(fsub(fnorth, angle_from_degrees(int_to_float(360))),fstart);
Ã, 
Ã,  Ã,  if (fless(fabs(fdifftest),fabs(fdiff)))
Ã,  Ã,  Ã,  fdiff = fdifftest;
Ã,  Ã, 
Ã,  Ã,  fdifftest = fadd(fsub(angle_from_degrees(int_to_float(360)), fstart), fnorth);

Ã,  Ã,  if (fless(fabs(fdifftest),fabs(fdiff)))
Ã,  Ã,  Ã,  fdiff = fdifftest;
Ã,  Ã, 
Ã,  Ã,  //compute new compass angle
Ã,  Ã,  int fang = fmul(fdiff, fticks);
Ã,  Ã,  int famp = fmul(degrees_from_angle(fdiff),pow(fe, (fmul(ffreq,fticks))));
Ã,  Ã,  int fres = float_to_int(fadd(fmul(famp, (cos(fang))),degrees_from_angle(fnorth)));
Ã, 
Ã,  Ã,  //set to proper range of sprites
Ã,  Ã,  fres = fres + cfirstsprite;
Ã, 
Ã,  Ã,  //make sure new angle is mod 360
Ã,  Ã,  while (fres>(cfirstsprite+359))
Ã,  Ã,  Ã,  fres=fres-360;
Ã,  Ã,  while (fres<cfirstsprite)
Ã,  Ã,  Ã,  fres=fres+360;Ã,  Ã, 

Ã,  Ã,  //update compass graphic
Ã,  Ã,  SetObjectGraphic(cobject,fres);

Ã,  Ã,  //if not reached total damping, continue--go until amplitude=0
Ã,  Ã,  if (fcomp(famp,0)!=0){
Ã,  Ã,  Ã,  Ã, SetTimer(timer,1);
Ã,  Ã,  Ã,  Ã, fticks = fadd(fticks,fstep);
Ã,  Ã,  } else {
Ã,  Ã,  Ã,  fticks = 0;
Ã,  Ã,  Ã,  fstart = -1;
Ã,  Ã,  Ã,  Display("done");
Ã,  Ã,  }
Ã,  }
}
#430
there appears to be a slight bug in the plugin support that doesn't allow the plugin features to be used in the global script outside of the main functions (ie, where you would define global variables). 
#431
QuoteI think that rotating a sprite saves memory, 'cause you would use even more memory if you had to import all the rotated sprites you need in to AGS.

that's true, for the rotating compass in my game that means I have 360 32-bit sprites...and that could be reduced down to 1 32-bit sprite.
#432
You never specified the data type for one of the input paramaters of the function
#433
well its good to see that CJ will be making this little fix

but I don't really see the urgency, redrum

who cares if "get up rock" works?  nobody is going to type that!
#434
Advanced Technical Forum / Re: sin(x)
Thu 04/11/2004 16:50:11
looked over the documentation, looks simple enough to use

i have a few suggestions

* add function for e
* rename log to do log base 10
* add ln to do log base e
* add function for log(a,b) for log base b
* add functions to do sin/cos for degree inputs, or make rad/deg mode a parameter
* functions to round, round down, or round up, without making it into an int

my biggest suggestion is in the naming of your functions.  as some of your examples show, these math expressions can get extremely long and confusing in a hurry especially due to AGS' improper order of operations handling.  if you copy the naming scheme used by the Ti calculators, and in general try to make them less than 5 characters, these math expressions could be made much less confusing to look at

aka "rad(x)" instead of "angle_from_degrees(x)"
"deg(x) instead of "degrees_from_angle(x)"
"float(x)" instead of "int_to_float(x)"
"int(x)" instead of "float_to_int(x)"
"int_up(x)"
"int_down(x)"

but....I will definitely be using this plugin a lot (I presume)
#435
Advanced Technical Forum / Re: Flashing light
Thu 04/11/2004 13:29:59
i think your other option would be to make the lights as partly transparent objects and then use individual timers for each one, which would allow you to control the frequency they each blinked at
#436
Advanced Technical Forum / Re: sin(x)
Thu 04/11/2004 13:27:06
Honestly, I don't understand why we can't just have floating points and math built into this game.  It is certainly the limiting factor.  Thanks for showing another way.  I'll have to keep struggling with it tommorrow because getting my function that uses the trig functions to work is just about as difficult as writing the trig functions and I didn't have time to get it working last night.  Arrgh.

Does your math plugin provide support for floating points????  I just gets so confusing when I have so many terms that need to be multiplie and divided inside and outside of these functions..
#437
Advanced Technical Forum / Re: sin(x)
Thu 04/11/2004 03:15:00
ok...multiplying x by 1000 (so essentially using 3 decimal places) the game does not crash

the final values for sin are either 0, 1, -1, 2, -2, 3, -3.

I should only be getting values of 0 (and technically 1 or -1 although practically never) because I will always be getting a value with magnitude <=1 and I think that AGS does not round up
#438
Advanced Technical Forum / Re: sin(x)
Thu 04/11/2004 03:08:33
well first of all...I'm only using 5 digit numbers

but your comment is probably very pertinent, because I accidentally neglected to mention that it did NOT crash when I removed all of the 10000's from the Taylor series.

...this of course did not produce the correct value for sin, though...

#439
i do not think it would look good if the fog followed the character....the fog isn't that smart

if you make the fog a transparent object, and place the reference line at the very bottom of the screen, then the player will be able to walk behind the fog

you could make multiple levels of fog on different layers by making the reference line higher up also

you could even animate the fog so that it was swirling around etc

if you did want the fog to be a transparent blob that followed over the character, you wouldn't need to make the fog a character..you could still have it be a regular object (animated or static) and just move it to follow the character
#440
Advanced Technical Forum / sin(x)
Thu 04/11/2004 02:35:54
Edit by strazer:

AGS 2.7 Beta 8 introduced the Maths.Sin function.




here is my attempt, which is not working.  the problem is somewhere in the Taylor approximation -- it seems to think I am dividing by zero.

************

function sin(int x)
{
  //add 5 decimel places (to hold decimels)
  x = 100000*x;
 
  //find equivalent value of x between -Pi to Pi (Taylor approx of 3 terms is nearly perfect here)
  while ((x-2*314159) >= -314159){
    x = x-2*314159;
  }

  //computer Taylor approximation
  //  ie. x = x - x^3/3! + x^5/5! - x^7/7!
  x = x-x*x*x/(6*100000*100000*100000)+x*x*x*x*x/(120*100000*100000*100000*100000*100000)-x*x*x*x*x*x*x/(5040*100000*100000*100000*100000*100000*100000*100000);
 
  //return integer
  return (x/100000);
}
SMF spam blocked by CleanTalk