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

#761
I believe this is on topic, but a knew problem has arisin with ints for me.   In the global script I have declared an int, and exported it accordingly.  The problem is that when I attempt to compile, I get an error telling me that I cannot export an import.  This is the opposite of what the manual says, that to import a variable it must have been exported from the global script!   ???   ???  ???

I tried not exporting, and then the integer in the room is an undefined token by the way.

Ideas anyone?

-Regards, Akumayo
#762
I think I should've figured that out sooner, but thanks for clearing it up completely.  :)
#763
it should be an operator, no?Ã,  In the manual:
Quote
You can add to and subtract from a variable using the += and -= operators. So, to add 3 to the current value of my_counter, do the following:
Ã,  my_counter += 3;

I could be wrong, it could be wrong, I don't know.Ã,  What I want
Code: ags

if ((health -= loss)<0) {

To do is check if health minus loss will be less than 0, and react accordingly, is there a better way to do this maybe?

EDIT--Fixed the problem, as it is += and -= can only be used to SET the int values, in if functions, simple + and - can be used and will work.
#764
I am having trouble using ints.Ã,  Here is of the things I have already done to try to resolve the problem:
-The globalscript now starts with all the int declarations.
-The globalscript now ends with all the export int lines
-The script header now has all the import int lines

The error:
-parse error in expr near 'health'

BTW:Ã,  'health' is defined as as int health in all the ways listed above.

Here's where it happens:
Code: ags

Ã,  if ((health -= loss)<0) {


Any ideas?
-Thanks, Akumayo
#765
like ausor said, shrink up the left foot a tiny bit, I also think a few dangling leather strands on her top would look nice...  It's a really beautiful sprite, way better than I could do.
#766
Advanced Technical Forum / Re: Globalint bug
Sun 23/10/2005 06:43:43
The correct code is:
if (GetGlobalInt(100)==2)
Right?

Are you sure it produced no errors that way, if not, CJ should definately make it.  That could really screw your game over in a hearbeat no?
#767
Hey guys, modified the module, renamed it and stuff, and it has a new function now (that I like a lot).  Here's the basics:

Code: ags

RandomBoundries(int min, int max);


This function is a general boundry random, inserting values:
Code: ags

RandomBoundries(7, 10);

Will return 7, 8, 9, or 10.

Code: ags

RandomDice(int amountofnumbers, int firstnumber, int secondnumber, optional int thirdnumber, optional int fourthnumber, optional int fifthnumber, optional int sixthnumber, optional int seventhnumber, optional int eigthnumber);


This function is a more advanced random choser.
Enter first the amount of numbers you want the function to
chose from, (2 minimum), and then enter the values.  Ex:
Code: ags

RandomDice(4, 5, 6, 10, 33);

Will return 5, 6, 10, or 33.

Code: ags

RandomWeightedDice(int firstcheatnumber, int firstnumberchance, int secondcheatnumber, int secondnumberchance, optional int thirdcheatnumber, optional int thirdcheatnumberchance, optional int fourthcheatnumber, optional int fourthcheatnumberchance);


This function is an advanced version of RandomDice.  It allows
for a certain chance of a number being called.  Chance values
must add up to total 100, and should not be negative to avoid
odd actions.  The default chosing requires four numbers, if you
want less, enter 0 for the chance of the number you do not wish
to appear.  Ex:
Code: ags

RandomWeightedDice(3, 30, 7, 60, 11, 10, 0, 0);

Will return 3 30% of the time, 7 60% of the time, and 11 10% of the time.

Created by Akumayo, with the help of strazer, Ashen, and scotch.

Download here (Thanks Neole!)
#768
Oh, thanks Ashen, I guess it's not a new idea at all  :)  I'll have to download that.
#769
Amen, the manual should still be updated to include this though I think.
#770
Woot ANARCHY!!!

Ahem, sorry about that, your speech got me all fired up...I'm better now.

Seriously though, I'm totally with SSH here, let's get the ball rolling moderators!
#771
I saw that (your answering post) but only also replied because I was under the impression that export's HAD to be at the end of the script.  Thanks for sharing that extra bit about after the definitions though, that does make things easier  ;D
#772
Perhaps my version of the manual is out of date, or simply a minor correction is needed.Ã,  It states:
Quote
export
export variable [, variable ... ] ;
Declares that variable can be exported and accessed by other scripts. You must place this at the end of your global script. You can export many variables with one export line.

For example:


export my_variable;
export counter, strength;

This exports three variables - my_variable, counter and strength.

As you can see, it states to export at the end of the global script, agian, I am not saying your wrong, but that the manual maybe has a minor error.
#773
On a slightly related subject, don't you think it would be interesting to add something in the repeatedly_execute that would first check to see if you had an item, and if you did woud proceed to animate it by changing it's spriteslot?  I always thaink that would look cool, but haven't seen it in any games.
#774
in the global script you must have:
Code: ags

int my_variable;

In the very bottom of the global script:
Code: ags

export my_variable;

In the Script Header:
Code: ags

import my variable;
#775
Yeah, I'll bet that'd be realatively easy, you could just ask the player, and if they wanted it off you could place a
Code: ags

character[TINT].ChangeRoom(-1);
#776
Seriously, I really support this idea!  I WANT this on the competitions forum!  I think if the time limit was like, one month, surely at least a nice beta could be released, and that would grow into a full-blown module.  Please re-consider moderators!
#777
Hrm...A GUI would be a lot better wouldn't it?  Anyway, I use a solid black character in Labyrinth to simulate growing darkness, and my game doesn't slow down much at all.  I'm running fullscreen with 640x400 resolution too.
#778
Silly me, thanks  ;D
#779
This is a nifty little script I use to light my backgrounds.Ã,  I thought I'd share.Ã,  It turns the WHOLE background to a certain lighting, as opposed to regions which do characters/objects only.Ã,  It's usefull for making a room dark before the player hits a lightswitch and such.

-Create a sprite the dimensions of your rooms and the color you want to tint the room (usually black for dark or white for light)
-Set View to this sprite and create a character, we'll call him TINT, he has the said view.Ã,  Place him at x=160, y=200

In the beginning of the script (before game_start function):
Code: ags

function TintLevel(int tint) {Ã,  //From 0, a totally lit room, to 100, a pitch black room
Ã,  character[TINT].Transparency = (100-(tint));
}


Then, if you want to change the lighting in a particular room, let's say you need to turn on a light.Ã,  In the room's startup script, call:
Code: ags

TintLevel(70);

Then, for the interaction of the character flicking the switch, call:
Code: ags

TintLevel(0);


If you want the tinting to be in EVERY room, useful for things like a steadily darker night, and a dungeon or cave.Ã,  This assumes EGO is your playable character.Ã,  InÃ,  repeatedly_excecute:
Code: ags

character[TINT].ChangeRoom((character[EGO].Room),Ã,  160,Ã,  200);
#780
OOOOO OOO OOO, I have a suggestion!

PLEASE O' PLEASE CJ, make the Random function expanded.Ã,  Having only a maximum requires "if" and "else" functions just to run the desired result, here's an example of what I mean:

Code: ags

SetGlobalInt(1, Random(2));
if (GetGlobalInt(1)==0) {
 AddInventory(13);
 }
if (GetGlobalInt(1)==1) {
 AddInventory(14);
 }
if (GetGlobalInt(1)==2) {
 AddInventory(15);
 }


BUT if the Random was expanded to include:
Code: ags

Random(int min, int max);


Then you could simply run
Code: ags

AddInventory(Random(13, 15));


And get the same effect!!!
SMF spam blocked by CleanTalk