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

#81
I have yet another outrageous demand to tack on, using mild sarcasm to illustrate the point.

In order to increase the speed,
a) increase the "speed".
b) decrease the "speed".
c) "speed" is AGS-slang for "RTFM".

How is this better than using "delay" when applicable?
#82
Hints & Tips / Re:MELRIN
Thu 20/11/2003 03:34:33
... :-\
Spoiler
...if you wasted your invisibility spell you just have to restart. i.e. restart, and this time when you use the invisibility sphere to get the torch, also light the torch before the effect wears off.
[close]
#83
You can find the CCS plugin by starting your search at the AGS main page.

However, I suspect that you will still find telling all the characters how to behave quite messy. It may be best to build the environment first, before adding any population management, otherwise you risk unreadable code.

When the time comes, the Finite State Machine plugin may also be of use to you.

[edit:afterthought]
Try PMing deltamatrix for tips. He's already worked with CCS.
#84
Hints & Tips / Re:Hood password
Wed 19/11/2003 09:39:07
I can't help.
I only know that I came up with some pretty cunning and well justified answers to no avail.
#85
Nice, but a bit risky as is ;)
If rate doesn't divide 100, then you'll overshoot the test values.

Modified version.
Code: ags

// objectnum, object to fade in or out.
// antispeed , 1 = fastest, 5 = slowest
// rate (transparency), 1 = slower, 20 = faster, 100 = immediate

function FadeObjectIn(int objnum, int speed, int rate) {
int trans = 100; // object initially invisible
while (trans > 0) { // as long as object hasn't fully faded in
trans = trans-rate; // subtract from transparency percentage
if(trans<0){trans=0;}//guarantee exact at finish.
SetObjectTransparency(objnum, trans); // change the object's transparency
Wait(antispeed); // pause.
}
}

function FadeObjectOut(int objnum, int speed, int rate) {
int trans = 0; // object initially visible
while (trans < 100) { // as long as object hasn't fully faded out
trans = trans+rate; // subtract from transparency percentage
if(trans>100){trans=100;}//guarantee exact at finish.
SetObjectTransparency(objnum, trans); // change the object's transparency
Wait(antispeed); // pause.
}
}

This assumes that the object transparency is already set at the initial value. e.g. Whatever is to fade out is fully opaque (0% transparent) before the function is called.
#86
If you are wanting to do a "what is (x,y) at time t" kind of function, then Steve's first post is the place to look for the answer, and his second will provide plenty of clues on how to implement it.

My code doesn't cover that, but if you are only concerned about getting the same answers at different game speeds then either of our methods will do, as they both essentially translate gamespeed to time, so that gamespeed is effectively cancelled out.
#87
Quote from: SteveMcCrea on Mon 17/11/2003 08:38:48
Well he did ask for the object to hit a point on the screen and go through a top height. You have to supply *some* start conditions, and what better than those deltree suggested?
Fair enough.
I wasn't criticising anyone though (in case it seems that way). I was mainly concerned that deltree might have confused his original intention with the particular context he was used to seeing it in.
Being misled by knowledge, or words to that effect.

And thanks for the compliment.
#88
Quote from: Squinky on Mon 17/11/2003 05:49:52
Problem is that 0,2 and 1,2 both have crazy big numbers and 0,3 and 1,3 read as 0.....

So am I not setting the array properly somehow and writing values into weird places or am I grabbing weird values from other places?
You have reversed your x and y, somewhere.
If "0,3" means x=0, y=3, then then conversion is 4*x+y.
What you are getting is stats[4*y+x], which is out of bounds for y>1.

It's only coincidence that the others look right, because (0,1) and (1,0) both happen to be 10.

[edit: oops. too slow again. Oh well, I'll add some more then]
Whether we use
numrows*column+row
or
numcols*row+column
(note the pattern)
is a design choice, and either will work. But it affects how entries are ordered within the array so we must be consistent once we have decided.
#89
Quote from: Squinky on Mon 17/11/2003 04:36:47I get the math, but I don't don't what this is for.
This may help clarify what's going on.
Code: ags

....x..0..1.
.y....------
.0...|.0..4.
.1...|.1..5.
.2...|.2..6.
.3...|.3..7.

Multiplying means adding whole extra columns, we then add the offset from the start of the column to get the exact position.
Imagine starting somewhere in the left column. Adding 4 moves you to the next one.
#90
Your arrays are all over the place, man! ;D

Have to fix them first.

int stats[8];
is correct, and will accept indices 0..7 (8 values).

Your coordinates should be x in {0,1}, y in {0,1,2,3}.

And the conversion should be 4*x+y.
(or x+2*y, just choose one though)

I don't know how 'hitpoints' emerge from your code, so I can't say more, but your arrays will be giving you garbage anyway.
#91
[edit: for latest version]
Remove red:--

if(chance<(getstats(1,4)-(getstats(2,1)))//this line is the problem one<--

I assume spaces are allowed between function names and parentheses? (I never write them like that so I wouldn't know)
#92
This will produce the correct movement.
You only need to emulate continuous functions if you are trying to predict or force the results, such as the highest point, which you don't if you're trying to be realistic. And if you do in some special case, then you can work out beforehand what inputs to provide.

Code: ags
//global y acceleration (pixels per sec per sec). You'll need to find a value of accel that looks good on screen.
#define accel 5

//variables
int xvel,yvel,xdiff,ydiff,vydiff,thrown,cpsec;

function game_start(){
//etc.
cpsec=GetGameSpeed();
thrown=-1;
}

function start_throw(int objID,int initxvel,int inityvel){
thrown=objID;
//velocity in pixels per second.
xvel=initxvel; //doesn't change (ignoring friction).
yvel=inityvel; //negative for upwards.
xdiff=0; //this stores fractional changes in x coordinate.
ydiff=0; // '' in y coordinate.
vydiff=0; // '' in y component of velocity.
}

function repeatedly_execute(){
int a,b;
  if(thrown!=-1){
    vydiff=vydiff+accel;a=vydiff/cpsec;
    if(a!=0){yvel=yvel+a;vydiff=vydiff-a*cpsec;}
    xdiff=xdiff+xvel;a=xdiff/cpsec;
    ydiff=ydiff+yvel;b=ydiff/cpsec;
    if((a+b)!=0){SetObjectPostion(thrown,GetObjectX(thrown)+a,GetObjectY(thrown)+b);xdiff=xdiff-a*cpsec;ydiff=ydiff-b*cpsec;}
  }
}

//set thrown=-1 when you want to stop it.

This could do with some refinement (if not actual debugging), but it should illustrate the basics.
[edit: See? I found something already  ^.^ *tweak, tweak*
Ok, so it wasn't quite as simple as planned. :p]
[edit2: much later. Stupid, stupid, stupid... Well, I couldn't leave it like that!]
#93
Advanced Technical Forum / Re:2d arrays....
Sun 16/11/2003 05:01:34
You must provide the correct types (but not names) in the import statement.

import function getBlah(int, int);
import function setBlah(int, int ,int);

[edit: oh, there were questions...]
Yes.
No. The room script doesn't access the array itself; it just calls functions.
Yes.
It's a good policy, but I think AGS zeros undefined values. And if not, your code can simply avoid using them before they are defined.
#94
Quote from: Pumaman on Fri 14/11/2003 09:24:35I'm not sure what you mean here. GUIOn is not blocking, but if the GUI you switch on is set as Popup Modal, then the game will be paused. If you don't want that, then set the GUI as "Normal".
Ok, good.
[edit]I thought I'd tried all the modes already, but ... well, somehow I missed it. All working now, thanks.
#95
I would say use whatever the engine does most efficiently, except ... that I just had visions of integer percentages :horrifed: and so it had better not be that ::)

(21*33)/100=6?

Make it absolute (if it goes ahead) so that whoever uses it knows exactly what to expect and can make their own functions based on arithmetic instead of experiment, and isn't compelled to quantize in 100ths. :P
#96
1:
Don't impose a (non-zero) margin inside the text region of text window guis. We have borders for that.

For maximum versatility, I suggest,
a) Allow user defined margins including negative values.
b) Centre the text area background horizontally before cropping.
This scheme encompasses a lot of design possibilities.

2:
Non-blocking GUIOn(). I may be able to do it with a normally transparent Persistent GUI, or faking it with overlays and such, but ... yuk.
#97
set-globalint and run-script could be used to signal dialogue events and specify what you want to output for them.
#98
Advanced Technical Forum / Re:2d arrays....
Thu 13/11/2003 07:13:24
 ;D At least it's a variable.
#99
Advanced Technical Forum / Re:2d arrays....
Thu 13/11/2003 06:58:54
Remember, Gilbot is using indices from 0..n-1 for the a and b values as well.

I believe the old dude was talking about Fortran, which is very much a living language.

As for uses, apart from the obvious spatial correspondence, they can be used to store relationships.
Example, you have 3 characters, related as follows:

Jane loves Mary
Jane fears Eric
Mary hates Jane
Mary loves Eric
Eric knows Jane
Eric fears Mary

So,
Code: ags

_____[col]___0_____1_____2___
row]...... Jane: Mary: Eric:
0___ Jane: ----- hates knows
1___ Mary: loves ----- fears
2___ Eric: fears loves -----

and col rel[col*3+row] row describes it.
Just be sure to remember which way around you are doing it.
#100
They have now been combined. Although officially still beta, I had no problems with it.
http://atticwindow.adventuredevelopers.com/index.php
SMF spam blocked by CleanTalk