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

#1
Quote from: monkey0506 on Thu 29/06/2017 10:17:45
You just need to move the definition of the set_Minute extender method to be above the definition of set_Second. AGS can't call functions that have been imported (declared) but not yet defined (:~().

P.S. writeprotected members are public (for reading, not setting, obviously). You probably don't want to expose the same member in two different ways. Either use a writeprotected member with a SetMember public function OR make the member protected instead.
Thanks, it is work.
#2
Hi. I have a header
Code: ags
struct GlobalTime {
writeprotected int second;
writeprotected int minute;
import attribute int Second;
import attribute int Minute;
}

a script
Code: ags
int get_Second(this GlobalTime*) 
{
  return this.second;
}
int get_Minute(this GlobalTime*) 
{
  return this.minute;
}
void set_Second(this GlobalTime*, int second) 
{
  while (second >=60)
    {
      second-=60;
      this.set_Minute(this.get_Minute() + 1); 
//Game don't allow to use attribute in script where I do a attribute definition, but this line do a error
//'.set_Minute' is not a public member of 'GlobalTime'. Are you sure you spelt it correctly (remember, capital letters are important)?

    }    
  this.second = second;
}
void set_Minute(this GlobalTime*,  int minute) 
{
  while (minute >=60)
    {
      minute-=60;
    }
  this.minute = minute;
}
#3
Quote from: Crimson Wizard on Wed 05/04/2017 09:06:48
"Damage" is an attribute. Functions get_Damage and set_Damage are functions that are used by the attribute.
When you write "Sword.Damage = X", set_Damage is called instead. When you write "String dam = Sword.Damage;", get_Damage is called instead.

AGS currently has a limitation that you cannot use attribute directly in the same script where you define these get_ and set_ functions. So, if you need to use that attribute in same script, then instead of "Sword.Damage" you need to use "Sword.get_Damage()" or "Sword.set_Damage(x)";

In all other scripts you may write "Sword.Damage".
Oh, that's the problem)
Quote from: Crimson Wizard on Wed 05/04/2017 09:06:48
This makes me suspect that you are not posting the actual latest version of your script.
Maybe. But I thank you for clarification, I understood this features.
Quote from: Crimson Wizard on Wed 05/04/2017 09:06:48
In AGS you can import structure simply by declaring it in the script header. Then this structure will be available in all the lower scripts.
Just move your struct declaration out of the script module body (asc) to the header (ash).
It is works. Thanks.
Attribute.ash
Code: ags
struct Weapon {
       protected String damage; // this is our actual property to store the damage
       import attribute String Damage; // this of course is our attribute
       import String get_Damage();
       import void set_Damage(String damage);
     };

Attribute.asc
Code: ags
     String Weapon::get_Damage() {
       return this.damage; // return the data stored in the actual property
     }
     
     void Weapon::set_Damage(String damage) {
       //smt
       this.damage = damage;
     }

Lower script "Without Attribute.asc"
Code: ags
     int TIME = 0;
     Weapon Sword;
    function repeatedly_execute_always() {
       TIME++;
       if (TIME == 160)
       {
         Sword.Damage = "Hi!";
         Display("Works %s", Sword.Damage);
       }   
     }

AGS displayed "Works Hi!" in the fourth second.
#4
Quote from: Crimson Wizard on Sun 02/04/2017 17:31:23
You ARE calling attributes from the same script where getter and setter are defined:
Code: ags
    struct Weapon {
       protected String damage; // this is our actual property to store the damage
       import attribute String Damage; // this of course is our attribute
       import String get_Damage();
       import void set_Damage(String damage);
     };
     
     String Weapon::get_Damage() {
       return this.damage; // return the data stored in the actual property
     }
     
     void Weapon::set_Damage(String damage) {
       //smt
       this.damage = damage;
     }
     
     int TIME = 0;
     Weapon Sword;
     function repeatedly_execute_always() {
       TIME++;
       if (TIME == 160)
       {
         Sword.Damage = "Hi!";
         Display("Works %s", Sword.Damage);
       }   
     }

There is error in fourth second(

Quote from: Crimson Wizard on Sun 02/04/2017 17:31:23
You need to change Sword.Damage to calling actual functions:
Code: ags

     function Smt2() {
         Sword.set_Damage("Hi!");
         Display("Works %s", Sword.get_Damage());
     }

But it is two simple functions, not attribute.
#5
import function doesn't work.
Header
Code: ags
import function Smt2();

Script
Code: ags
// new module script
    struct Weapon {
       protected String damage; // this is our actual property to store the damage
       import attribute String Damage; // this of course is our attribute
       import String get_Damage();
       import void set_Damage(String damage);
     };
     
     String Weapon::get_Damage() {
       return this.damage; // return the data stored in the actual property
     }
     
     void Weapon::set_Damage(String damage) {
       //smt
       this.damage = damage;
     }
     
     int TIME = 0;
     Weapon Sword;
     function Smt2() {
         Sword.Damage = "Hi!";
         Display("Works %s", Sword.Damage);
     }

Global Script
Code: ags

//another code
int TIME = 0;
function repeatedly_execute_always() {
  TIME++;
  if (TIME == 40)
  {
    TIME = 0;
    Smt2();
  }
}


#6
For example new script
Code: ags
struct Weapon {
   protected String damage; // this is our actual property to store the damage
   import attribute String Damage; // this of course is our attribute
   import String get_Damage();
   import void set_Damage(String damage);
 };
 
 String Weapon::get_Damage() {
   return this.damage; // return the data stored in the actual property
 }
 
 void Weapon::set_Damage(String damage) {
   //smt
   this.damage = damage;
 }
 
 int TIME = 0;
 Weapon Sword;
 function repeatedly_execute_always() {
   TIME++;
   if (TIME == 160)
   {
     Sword.Damage = "Hi!";
     Display("Works %s", Sword.Damage);
   }   
 }

Now there is error:
#7
I have a structure with attribute in script, but I didn't call attributes from this script. How can I fix it (I maybe don't understand smt)?
#9
Thanks) But I didn't find SSH's Shadow module( It is sad :cry:
#10
Oh, genial is simple.
#11
Hi! Site ssh.me.uk is broken. Modules disappeared and it is sad. Anybody have modules from good coder SSH?
#12
Site is broken( Link is broken(
#13
Hi! AGS is able to make a global variable. Do AGS is able to make a global #define MyReplace 1?
#14
Hi. I have a example code of dialog
Code: ags
@1
Smb: I wanna drink.
  if (Ã'Ego.HasInventory(iJuice))
    Ã'Ego.LoseInventory(iJuice);
stop

I want to branch out a dialog
Code: ags
@1
Smb: I wanna drink.
  if (Ã'Hero.HasInventory(iVodka)) {
    Ã'Hero.LoseInventory(iVodka);
    //goto-dialog X or dialog_request
    }
    else
    {
    //goto-dialog X or dialog_request
    }
stop

How can I can do it?

Another question: What are RUN_DIALOG_GOTO_PREVIOUS, RUN_DIALOG_RETURN and RUN_DIALOG_STOP_DIALOG doing?
#15
There are details under spoiler.
Spoiler
[close]
AGS Editor shows that font has 10pt in both cases.
#16
QuoteI can delete everything in Speech, but not AudioCache/ - why?
When you import audio files into AGS, you'll probably notice that a folder inside your game folder, called AudioCache, starts to fill up with files. What is it and why is it there?
Well, when you import audio into AGS, you might be importing it from anywhere -- it could be off your hard drive, but it might also be off a USB stick or a CD. AGS can't rely on the audio files always being there because you might remove the USB stick or delete the files on it.
Therefore, when you import audio into AGS it makes a copy of the file in the AudioCache folder. AGS also remembers where the file came from, and when you compile your game it will check if the file has been updated in its original location -- if so it will copy the latest version to the AudioCache.
But if the source file no longer exists, your game will continue to build just fine because AGS has its own copy of the file.
This allows AGS to stick to one of its core principles, that all the files you need to build your game are within the game's folder. That way, you have complete security in knowing that by backing up your game folder, your game will be safe if the worst happens.
QuoteCan I delete all room data?
Discards all the data that the engine has in memory about when the player last visited ROOM_NUMBER, and resets it as if they'd never been there. The next time the player goes to that room, all the objects and scripts will be in their initial state (as set up in the editor), and not how they were when the player left the room. The "First time enters room" event will be run when they enter this room again.
This function is useful if you want to have a "View intro" option to allow the player to watch an intro again - this function can reset all the objects in the intro rooms to their starting positions.
NOTE: You cannot reset the current room (ie. the room that the player is in).
Example:
ResetRoom(0);
will reset the intro room so it can be played again if the player wants to.
QuoteIs there an option to put all music, speech, rooms and other info into the .exe file?
DefaultBundlingType in AudioType's Editor
#17
Issue from Wiki title
QuoteA VERY important point to make here is that you can NOT use an attribute in the same script where the getter and setter methods are defined. If you try, you'll get an error like this:

---------------------------
Adventure Game Studio
---------------------------
An internal error has occurred. Please note down the following information.
If the problem persists, post the details on the AGS Technical Forum.
(ACI version 3.20.1101)

Error: is_script_import: NULL pointer passed

---------------------------
OK   
---------------------------

Not particularly friendly as it doesn't actually tell you what's going on, leaving you to ask, "WTF?!?" Just note again that this is all unsupported technology so if you did go post in the Technical Forum you're likely to get asked what you think you're doing...In case you do see that error try looking for cases where you've used an attribute in the same script where its accessor functions are defined. If you need access to that value, use the property (or whatever else is storing the data) or call the get or set function directly.
But AGS is not able to import a structure. Or Don't I understand?
#18
Advanced Technical Forum / Re: Custom WinSetup
Sun 26/02/2017 13:12:29
Thanks for tips. It is useful info for me ;)
#19
Advanced Technical Forum / Custom WinSetup
Sun 26/02/2017 05:36:28
Hi, guys.
I want to make a game with 320x180 resolution (aspect ratio 16x9), but Winsetup has resolution 320x200 (default) and full-screen game with this resolution is blurred and with black left and black right lines. It is bad effect for inexperienced users (gamers). I would like to fix it, i.e. I would like to remove this resolution and resolutions with with the aspect ratio 4x3, I would like to leave only screen resolution in full-screen mode. I was reading a lot of posts in forum about this problem and I understood that it is not possible.
I read that I can change Acsetup.cfg, but directory with this file is different in different OS (XP,7) and depends on general setting "Save Game Folder". I do not know how to find this directory, if I'll write own winsetup.
But can I change winsetup?

Sorry for my bad English.
#20
Your trouble is in a Walkwhere optional parameter.
Code: ags
Character.Walk(int x, int y, optional BlockingStyle, optional WalkWhere);

Explanation
QuoteIf walkWhere is eWalkableAreas (the default), then the character will attempt to get as close a possible to (X,Y) by using the room's walkable areas.
If walkWhere is eAnywhere, then the character will simply walk directly from its current location to (X,Y), ignoring the room walkable areas.
Right example
Code: ags
cEgo.Walk(155, 122, eBlock, eWalkableAreas);
SMF spam blocked by CleanTalk