Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


- - - - -

AngelScript 1.9.0 WIP 4 (2004/08/31)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
45 replies to this topic

#1 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 16 August 2004 - 01:30 PM

Dear subscribers, I've had quite a lot of slack time at work lately so I've been able to put in a few hours here and there on AngelScript, this is why you've been seeing so many updates lately. Today I bring you the first work-in-progress version of 1.9.0 with the following changes: - Renamed RegisterTypeBehaviour() to RegisterObjectBehaviour() - Removed the flags asCALL_RETURNBYVAL and asCALL_RETURNBYREF - Removed the flags asOBJ_IS_COMPLEX and asOBJ_IS_NOT_COMPLEX - Compiler no longer outputs unecessary messages, such as "Building..." - Each error message now follows a standard format: {section name} ({row}, {col}) : {Error or Warning} : {Message} - Included support for saving and loading compiled bytecode (thanks Dennis Bollyn) I will probably release at least one more WIP this week. Though I haven't decided if I'll add dynamically growing script stacks first, or dynamic binding between modules. Regards, Andreas Jönsson Author of AngelScript [Edited by - WitchLord on August 31, 2004 7:50:38 PM]
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Sponsor:

#2 EddHead   Members   -  Reputation: 140

Like
0Likes
Like

Posted 16 August 2004 - 06:25 PM

Can you Add custom build/error messages to the TODO list of 1.9.0?
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

#3 zola   Members   -  Reputation: 122

Like
0Likes
Like

Posted 16 August 2004 - 08:37 PM

Cool :)

Would it be very difficult to have something like typedef in the scripts? So we could define aliases for the angelscript datatypes.

I know that I could replace the types during binding generation myself, but one thing I use Angelscript for is to experiment with algorithms. Once they are done I would like to cut and paste them into my C++ code. Typedefs would help to keep the code intact.

Keep up the good work.

Regards
Tom

#4 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 17 August 2004 - 01:43 AM

EddHead:

Are you talking about translated messages? I don't think I will do this dynamically as it would be easier to just translate the static text strings in as_texts. If you want present the messages in a different way than is returned by the library you can easily do so by parsing the message. Every message follow the same pattern:

<script name> (<row>, <col>) : <Error or Warning> : <message string>

If this is not what you meant, perhaps you would like to tell me (again) in more detail just exactly what you need with custom messages.

zola:

It certainly would be possible, though it probably would require quite a lot of work. I'm sorry to say that I'll have to put this at the bottom of the to-do list.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#5 Gyrbo   Members   -  Reputation: 187

Like
0Likes
Like

Posted 17 August 2004 - 07:19 AM

zola: how about using the typdef in your C(++) code? You can probably also do a simply search-and-replace, but that's most likely not the answer you want ;).

#6 EddHead   Members   -  Reputation: 140

Like
0Likes
Like

Posted 17 August 2004 - 07:20 PM

What i meant was, if i needed to change messages like Building.... to something else, from the host app if necessary! i wasnt talking about the format of the error code, just the strings used in them, including removing them altogether, just to make sure i treat each type of script init seperately( different messages to each script module GUI / State Changes etc.)
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

#7 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 18 August 2004 - 01:31 AM

Well, I've removed unecessary messages altogether. You'll no longer see "Building..." nor "Completed (0 errors, 0 warnings)". The only messages that are output are error messages and warnings. This will allow you to write whatever you like before and after compiling.

If you want a count of the errors and warnings you'll have to do a search for ": Error" or ": Warning" in the strings. It will be a bit more work for the application writer, but not too much I think, and it gives more flexibility.

bool isError = strstr(msg, ": Error") ? true : false;


I have ideas of making the error messages even more standardized and give each one of them a message number. The message number can be used to filter output, show help text, or even translate the message string. But I don't think I'll do this for this version.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#8 zola   Members   -  Reputation: 122

Like
0Likes
Like

Posted 18 August 2004 - 09:05 AM

All I really needed was a possibility to change the basic type names for uint8 uint16 etc.
It turned out to be really easy, I just extend the tokenWords array and added my token aliases.

#9 EddHead   Members   -  Reputation: 140

Like
0Likes
Like

Posted 18 August 2004 - 06:20 PM

Are you planning to support static variables in 1.9.0?

Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

#10 abrken   Members   -  Reputation: 130

Like
0Likes
Like

Posted 18 August 2004 - 08:57 PM

Quote:
Original post by WitchLord
The only messages that are output are error messages and warnings. This will allow you to write whatever you like before and after compiling.


As I was aswering to my last post about the '{' bug, I have realized that some messages are very important and hope that what you have written is partialy false :

in this compilation report

Building...
Parsing: "FlipImage"
Error : (53, 0) Expected expression value
Error : (53, 0) Unexpected end of file
Compiling function 'AcceuilEng_MOUSE_0' in "AcceuilEng_MOUSE_0"
Error : (4, 1) Function 'FlipImage' not found
Compiling function 'AcceuilFra_MOUSE_0' in "AcceuilFra_MOUSE_0"
Error : (4, 1) Function 'FlipImage' not found
Completed. (errors: 4, warnings: 0)


do the
Parsing: "FlipImage"
or
Compiling function 'AcceuilEng_MOUSE_0' in "AcceuilEng_MOUSE_0"
is still present in 1.9.x or not ?

If not, this is not a good thing because without those lines we wont be able to find in witch part of code the errors are detected when using multiple AddScriptSection call.

AbrKen.

#11 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 19 August 2004 - 01:57 AM

The output for your example would be like this:


FlipImage (53, 0) : Error : Expected expression value
FlipImage (53, 0) : Error : Unexpected end of file
AcceuilEng_MOUSE_0 (4, 1) : Error : Function 'FlipImage' not found
AcceuilFra_MOUSE_0 (4, 1) : Error : Function 'FlipImage' not found


The only thing missing is the function name, but you'll be able to find the error by the line number. I hope that's ok?

Maybe I could add the function name for those messages where it is known. Do you think it is necessary?


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#12 abrken   Members   -  Reputation: 130

Like
0Likes
Like

Posted 19 August 2004 - 02:44 AM

Honestly I think that's enought for most application ... but in my case it is not !

The missing function name will miss me.

My application have global script and script triggered by event (like a browser).

The script that are triggered are named "not pure" because it is encapsulated with some code that is injected at runtime.

AcceuilEng_MOUSE_0 is triggered on a mouse hot spot click in page AcceuilEng.

When the user define the script his got an emply blank page where ... he write the script.
But in some case, he can use a trick to add it's own functions in the script.
The trick is to enter the ending code encapsulation, the declare your function with the correct beginning code encapsulation.

The code encapsulation is at the beginning :

void thefunctionname(){asBStrSetTransaction(1);{


The code encapsulation is at the ending :

}asBStrFreeTransaction(1);}


Example :
The user enter a script on mouse hot spot click in page AcceuilEng.

He (or she) enter a script like that :

TheOtherCode();

and nothing else.

The application then translate this to :

void AcceuilEng_MOUSE_O()
{asBStrSetTransaction(1);{
TheOtherCode();
}asBStrFreeTransaction(1);}


Now the tricky user wants something special and use the trick in its code and enter :


TheOtherCode();
gogo(1, 5);
}asBStrFreeTransaction(1);}

int gogo(int i, int j)
{
return i * j;
}

void TrickyEnd()
{asBStrSetTransaction(1);{


If the user enter a compilation error in its gogo function the actual AS outputs :


Building...
Compiling function 'gogo' in "AcceuilFra_OnBeforeParse"
Error : (9, 1) Function 'TheBuggyCall' not found
Completed. (errors: 1, warnings: 0)


but in 1.9.x it will (I think if I have well understood !) output :

AcceuilFra_OnBeforeParse (9, 1) : Error : Function 'TheBuggyCall' not found


gogo is missing !

But once again, I think it's enought for most applications.



#13 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 19 August 2004 - 03:08 AM

Understood. I'll provide some way of showing the function name as well. Right now I think it will be like so:


AcceuilFra_OnBeforeParse (9, 1) : Info : Compiling int gogo(int, int)
AcceuilFra_OnBeforeParse (9, 1) : Error : Function 'TheBuggyCall' not found


That way you'll get the extra information of the exact function interface in case of function overloads.

The info line will only appear if there was an error or warning in the function.

What do you think about that?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#14 abrken   Members   -  Reputation: 130

Like
0Likes
Like

Posted 19 August 2004 - 03:37 AM

Simply great !

#15 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 22 August 2004 - 05:33 AM

The latest WIP has been uploaded.
Changes:

- Removed the need to pass stack size when calling Prepare() or ExecuteString()
- Added the method SetDefaultContextStackSize()
- New error message asINVALID_CONFIGURATION, which is returned by Build() if the configuration failed
- The context stack now dynamically grows as needed
- bug fix: An unclosed statement block could lead to assert failure in the parser (thanks Alain "abrken" Bridel)
- Removed AS_CALL from the interface. This changes the exported function names.
- bug fix: An object with asBEHAVE_ASSIGNMENT registered could be assigned even though it was declared as const (thanks _MrC_)
- Added informational compiler messages that tell what function or global variable is currently being compiled when an error or warning occurs.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#16 EddHead   Members   -  Reputation: 140

Like
0Likes
Like

Posted 23 August 2004 - 03:19 AM

Is there a way we could make the engine display messages sectionwise rather than filewise. this would help me load multiple files into one engine instance and debug correctly (relevant line numbers for error messages). Are static variables supported in 1.9.0?
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

#17 Lbas   Members   -  Reputation: 122

Like
0Likes
Like

Posted 23 August 2004 - 05:55 AM

Regarding compiling messages, I know there's probably more important features to focus on but...

What about a SetErrorFormat( strFormat ) (or such) where user could pass desired report format using template paramaters (for example %f for fileName, %s for section, %l for line number, %c for column number, and so on...).

This way, you could, for example, format report messages in Visual compliant form, so that, when debugging you can redirect message to the Debug tab (using OutputDebugString()) and double-click on the message line in the Debug tab to directly access to the file/line of buggy code (formating messages "%f(%l) : ....").

#18 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 23 August 2004 - 06:12 AM

EddHead:

The messages report the section name. Exactly what the section name means is up to you, but I suggest that you set the section name to the filename from where the code was loaded.

What do you mean with static variables? The script global variables keep their value between executions, is this what you mean with static?

lbas:

I don't see much need for a way to change the format dynamically, but I could support different formats during compile time with a #define in as_config.h. Let me know what format you want to have and I'll prepare it for you.





AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#19 EddHead   Members   -  Reputation: 140

Like
0Likes
Like

Posted 23 August 2004 - 06:09 PM

I was aware of that, but i thought having a local static was more legible than global variables. global variables are pretty good enough though. What would your suggestion be to properly manage about 50 odd script files meant for AI and initialization? (number of engineinstances versus scriptsections)
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

#20 Andreas Jonsson   Moderators   -  Reputation: 3416

Like
0Likes
Like

Posted 24 August 2004 - 01:33 AM

Oh, you meant local static variables, like:


void func()
{
static int local_static;

... do something
}


Well, I agree that it is a better coding practice to use them in situations where they really are local to the functions. But I think this is not really necessary to implement them in AngelScript, at least not yet.

My suggestion is that you have one engine instance per interface to your application, i.e. all your AI entities will probably use the same interface to the application so they should share one engine. Whether your scripts for initialization will use another engine or not depends on if they need access to application functionality that the AI routines shouldn't have access to. It might also be advantageous to use one module per AI entity type, in which case all the types can use the exact same function names, and also have global variables that are only shared between entities of that type.

Ideally you'd map one script file to each script section, and use the filename for the script section name. To the script library there is no difference if you would use separate script sections or concatenate all of them into one.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS