AngelScript 1.7.0 beta 4 released
#1 Moderators - Reputation: 2327
Posted 26 April 2004 - 11:16 AM
#2 Members - Reputation: 158
Posted 26 April 2004 - 12:38 PM
Up until this point, my command console could only execute global functions by their name w/o any arguments (well, a lie, I put some makeshift code in there to allow me to pass integers and floats).
Anyways, nice work
Joe
#3 Members - Reputation: 158
Posted 26 April 2004 - 02:35 PM
My engine is single-threaded and the only time I seem to have a problem with ExecuteString is when the statements being executed take a long time to finish. Or, even worse, it enters a never ending loop.
It would be nice if ExecuteString took a parameter that started the context suspended so that the call to ExecuteString returned immediately. I could then use GetContextForExecuteString and timeshare it with the engine and all the other script contexts with ExecuteStep as I normally do.
#4 Members - Reputation: 140
Posted 26 April 2004 - 06:10 PM
Will get back with comments. i would like to know if the full 1.7.0 can contain customizable strings for compiler output. would help a lot.
Jayanth.K
[edited by - EddHead on April 27, 2004 1:13:31 AM]
#5 Moderators - Reputation: 2327
Posted 27 April 2004 - 03:13 AM
Good idea, I''ll add that flag to the call.
EddHead:
I''m not sure what you mean with ''environment variable'' style global variables. Could you explain?
Currently the only way of having your own customized error messages are to open the source code and change the texts found in the as_texts.h file. If you have an idea for how to do this dynamically at run-time I''m ready to listen.
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#6 Moderators - Reputation: 2327
Posted 27 April 2004 - 01:08 PM
1) ExecuteString() has a new parameter, a flag that can be either 0 or asEXECSTRING_ONLY_PREPARE. With asEXECSTRING_ONLY_PREPARE ExecuteString() compiles the string and prepares the context but doesn''t execute it. To execute the string the application must use GetContextForExecuteString() and then call Execute() or ExecuteStep() on the context received. (thanks goes to Andrew "Desdemona" Wright for that idea)
2) ExecuteString() can now access global variables declared in the script.
3) I''ve transformed global script constants into read-only global script variables. This simplified the code a lot, however it may bring some compilation errors to your scripts in case you use global constants to initialize other global constants or variables. This also means that the compiler is no longer able to optimize operations with these global constants.
I will redo the broken funcionality before the final release, but I think you would be interested in this interim release anyway because of the added funcionality.
Regards,
Andreas Jönsson
Author of AngelScript
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#7 Anonymous Poster_Anonymous Poster_* Guests - Reputation:
Posted 27 April 2004 - 09:58 PM
why not a global pointers for this release. I like to store my globals objects to share with the rest of my functions. For example:
[on globals]
cGUI* gMainMenu;
cGUI* gError;
void OnCallbackMenu( int iMsg )
{
if( iMsg == -1 ) // On error.
{
gMainMenu->Freeze( true );
gError->Show( true );
}
}
void OnCallbackError( int iMsg )
{
if( iMsg==0 ) // Close error.
{
gMainMenu->Freeze( false );
gError->Show( flase );
}
}
Thanks,
Gunder Wulde.
#8 Moderators - Reputation: 2327
Posted 28 April 2004 - 09:36 AM
Thanks, for spotting that.
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#9 Members - Reputation: 140
Posted 28 April 2004 - 09:19 PM
or something like that
Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com
#10 Moderators - Reputation: 2327
Posted 29 April 2004 - 07:14 AM
Global variables can also be initialized with expressions using the condition operator ?:, the only thing that cannot be done is using the incremental operators, assignments, nor function calls.
I''ve fixed a bug that prevented scripts from declaring global variables as pointers. Thanks Gunder Wulde for spotting that.
A slight design flaw has been discovered Andrew "Desdemona" Wright, and that is related to function overloading. The problem is that a literal integer constant do not decide to use a function taking an int as parameter if there is also another function taking a float, in this case it gives an error reporting the two functions as multiple matches. Currently the solution is to manually cast to int, but I''ll change AngelScript to give preference to a cast between int and uint over a cast between integer and floating point.
There is yet another flaw where a pointer cannot be assigned a 0, if the pointer type is using behaviour functions. The problem is that the 0 isn''t a reference. AngelScript will resolve this by placing the 0 in a temporary variable for the assignment.
The next version fixing these two problems should be out any day now.
Regards,
Andreas Jönsson
Author of AngelScript
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#11 Moderators - Reputation: 2327
Posted 29 April 2004 - 11:18 AM
Well, two engine instances do not share anything except what the host application registers with them. If you have script constants that you wish to share between engine instances I suggest that you store these constants in a script section that will be compiled together with the dynamically loaded scripts.
But your question has given me the idea of letting the host application enumerate globally declared script variables. With the changes that I made for version 1.7.0 this should be quite easy to do.
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#12 Members - Reputation: 158
Posted 29 April 2004 - 11:48 AM
int asIScriptEngine::ExecuteString(const char* stmts, asIScriptContext** ctx, asIStreamOutput* out, int stackSize);
Instead of AngelScript managing a single context for ExecuteString, it would take the context pointer you provide, initialize it, and return immediately. The client application would then be responsible for managing these contexts as they would do with any other context. This method could create multiple concurrent contexts, instead of a single context currently dedicated for the method. (At this point GetContextForExecuteString would become obsolete).
If the user passed a null pointer in, that could mean to execute the statements immediately before returning from the method call.
Anyways, just an idea. I am not sure how that would interfere with the current design, but it seems more versatile.
Joe
#14 Moderators - Reputation: 2327
Posted 29 April 2004 - 03:12 PM
GetContextForExecuteString() would only be able to return the internal context. The engine wouldn''t keep track of contexts created by the user.
I would have to change the way the engine keeps the compiled code for the ExecuteString statements. Right now it overwrites the previous compilation.
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#15 Moderators - Reputation: 2327
Posted 30 April 2004 - 01:38 PM
That aside, I''ve also fixed the last missing points in the library before the final release. Namely:
When finding the matching overloaded function, a conversion between signed and unsigned integers are given priority over conversion between integer and float (thanks Andrew "Desdemona" Wright)
bug fix: A pointer with an assignment behaviour can now be assigned a null pointer.
I will now take some time to update the manual for the real 1.7.0 release, and fix any bugs that might arise.
When that is finished I will move on to version 1.7.1 which will support the different flags for the ExecuteStep() method. And after that I will bring in the concept of modules in version 1.8.0, which will allow applications to compile parts of the scripts under different namespaces, and also recompile the modules individually without affecting contexts running code from other modules.
Regards,
Andreas Jönsson
Author of AngelScript
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#16 Members - Reputation: 122
Posted 03 May 2004 - 01:42 AM
#17 Moderators - Reputation: 2327
Posted 03 May 2004 - 06:03 AM
unfortunately, it is not quite that trivial to implement save/load of compiled scripts. This is because of the many runtime links with the host application.
I will implement it, but at the moment there are other things that are more important. For example the module/namespace support I mentioned in the last post. Once that is done I''ll reevaluate what to implement next, and perhaps I decide to do saving and loading.
May I ask why, saving/loading is so important for you? The compile times are quite low so I don''t think you would notice much difference in load-time if that is the reason. Should it be because you want to protect your script code, then I suggest you look into encryption instead, as simply compiling it doesn''t really protect it since the AS library is open source.
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game
#19 Anonymous Poster_Anonymous Poster_* Guests - Reputation:
Posted 05 May 2004 - 05:29 AM
Encryption is currently nothing more but fancy obfuscation because you still have to store the key somewhere.
The ideal solution would be a mix of the two.






