Advertisement Jump to content
  • Advertisement

dxj19831029

Member
  • Content Count

    100
  • Joined

  • Last visited

Community Reputation

122 Neutral

About dxj19831029

  • Rank
    Member
  1. dxj19831029

    Add a dynamic script section

    Thanks a lot. I copied the codes from the functions(you pointed to me) to asCBuilder::buildString, it works for me. Do you want to code to merge? (you can also help me to check the memory leak stuff if you want the code) :) Cheers Quote:Original post by WitchLord Ah, yes. asCBuilder::BuildString is taking a few shortcuts because it assumes no arguments or return value for the function. You need to modify that function as well to do what is done for ordinary functions in asCBuilder::RegisterScriptFunction, i.e. you need to use determine the type of the return value and the parameters from the parsed nodes using CreateDataTypeFromNode() and ModifyDataTypeFromNode(). Then you need to inform the asCScriptFunction of these as is done in asCModule::AddScriptFunction(). Regards, Andreas
  2. dxj19831029

    Add a dynamic script section

    hehe, Quote: Where ModifiedExecuteString is the version of ExecuteString that wraps the string in str = "int ExecuteString(int value){\n" + str + "\n; return 0;}"; I did this way, it failed to setArgument, since it report asINVALID_ARG error. line 850, as_context.cpp. if( arg >= (unsigned)initialFunction->parameterTypes.GetLength() ) { status = asEXECUTION_ERROR; return asINVALID_ARG; } I check the parameterTypes value, it said 0 parameter0, but the decl for the function is correct inside initialFunction. :).
  3. Nice game. :) Quote:Original post by jal_ We've just released the new version of our little game with the angelscripted gametype "plugins". Here's a copy/paste of the release blah-blah: Quote:Warsow 0.5 is finally released after a long time of hard work and a few release candidates tested by the community. With version 0.5 Warsow reaches a major milestone in its development. Feature-wise and technically, Warsow is now more complete, stable and polished than ever! Some of the new features in Warsow 0.5: » Weapon settings, armor settings and movement system have been tweaked and revised » Weapons can stun players, making them unable to walljump for a short period of time after being hit » Warsow 0.5 introduces AngelScript gametype scripting, inviting everyone to create their own custom gametypes » Warsow 0.5 has new maps, textures, playermodels, engine features, visual effects... even a brand new weapon! » Warsow 0.5 comes with new gametypes: Team Domination, Headhunt, Bomb & Defuse For more details, check out the changelog... That is, if you're not already downloading Warsow 0.5! Game's website: http://www.warsow.net/ The gametype scripts are working wonderfully by now :)
  4. dxj19831029

    Add a dynamic script section

    ParseFunctionDeclaration(0, string, execfunc, false); I try this: string is definitin or decl, but both of them are not working, it seems like break engine internal state. Thanks
  5. dxj19831029

    Add a dynamic script section

    em.. got an problem. str = "int ExecuteString(int value){\n" + str + "\n; return 0;}"; int r = builder.BuildString(str.AddressOf(), (asCContext*)exec); The compiled function can not pass in any arguements. asCScriptFunction *execfunc = asNEW(asCScriptFunction)(engine,module); // line 216 as_builder.cpp. I found the execfunc does not have parameter list, how do I let engine to pass the function and add parameter list in? is this simple? will "ParseFunctionDeclaration" function do it? Cheers Quote:Original post by WitchLord Not quite that simple. If you look into the BuildString you'll see that the r value that it returns is just a success or failure, not the function id. The function id is fixed to asFUNC_STRING, regardless of the function name. I lied before, the function compiled by ExecuteString is not stored in the module but rather in the context. So when the context is released the function will be released as well, or when the context is used for another ExecuteString call.
  6. dxj19831029

    Add a dynamic script section

    :) I got it. Thanks Quote:Original post by WitchLord Not quite that simple. If you look into the BuildString you'll see that the r value that it returns is just a success or failure, not the function id. The function id is fixed to asFUNC_STRING, regardless of the function name. I lied before, the function compiled by ExecuteString is not stored in the module but rather in the context. So when the context is released the function will be released as well, or when the context is used for another ExecuteString call.
  7. dxj19831029

    Add a dynamic script section

    Correct me if I am wrong. if every time I use the different name for wrapper function: str = "void ExecuteString(){\n" + str + "\n;}"; // use differen function name. int r = builder.BuildString(str.AddressOf(), (asCContext*)exec); the compile code will stay inside the script module, I only need to hold r value, and I can use r value to prepare on different context isn't it? Do I need to use PrepareSpecial() or prepare() is enough? Cheers Quote:Original post by WitchLord No, the script code is not released when the builder goes out of scope. Only the next time ExecuteString is called (or the module is released). If you call ExecuteString with your own context and the flags asEXECSTRING_USE_MY_CONTEXT | asEXECSTRING_ONLY_PREPARE, then the function will only compile the function and prepare the context but not execute it. This will let you set any parameters for the function you want just like any other script function call. Of course, you still need to change the code that ExecuteString wraps your script in so that the built function is prepared to receive arguments.
  8. dxj19831029

    Add a dynamic script section

    nice future. :) for now, I may need to hack your executeString function. int r = builder.BuildString(str.AddressOf(), (asCContext*)exec); with this statement inside executeString(), does that means the new compile code will be released after builder is out of scope? r = ((asCContext*)exec)->PrepareSpecial(asFUNC_STRING, mod); with asCContext and PrepareSepcial, I still can set the arguements and get the return value, correct? Cheers Quote:Original post by WitchLord Version 2.18.0 will hopefully allow you to dynamically build new functions for already compiled modules. This will allow you to implement your own ExecuteString without the current limitations. Until then it is not really possible to do what you need.
  9. dxj19831029

    Debugger call-stack

    so nice example. I have a few questions. Do you support intellinse system? I tried, not output. Is that possible we could use your debugger inside our projects? how, I am not so familar with C# projects. :) Cheers. Quote:Original post by SiCrane I have an example of a simple AngelScript debugger here. I haven't updated it to the most recent version yet and it uses .NET bindings, but it should give you an idea of how you can use AngelScript's debugging API.
  10. dxj19831029

    Add a dynamic script section

    Hey, My question is this: I have a module which is build successfully, I dynamically genereated some script code, I wanna execute those script code without recompile the script module, what should I do? I was using executeString, but it had too many limitations: no parameters, no return values. Thanks.
  11. dxj19831029

    Debugger call-stack

    /test/test_future/test_debug.cpp it has a simple example. :) hope it will help u. Quote:Original post by Carrot Hi, can anyone point me in the direction of an example showing how to build a list of current variables in the call-stack? I need to display (possibly edit) the variables available during the line-callback function as a debugger would. I assume I use GetCallstackFunction, but where to go from there? Thanks, Ciaran.
  12. dxj19831029

    template with handle

    Quote:Original post by WitchLord I assume you're talking about the new script array template add-on. Yes, you can use array<clsA@>. The RegisterVector template is based on std::vector and won't perform the proper reference counting necessary to do an array of object handles. clsShape@ shape; // passed with executeString array<clsShape@> shapes; // executeString return -1. Anything wrong?
  13. dxj19831029

    template with handle

    Hey, I just wonder if I can use array<clsA@> inside script? Also, if I use Vector template to register a reference class clsA, what should I register as: RegisterVector<clsA>(clsA[], clsA, pScriptEngine); or RegisterVector<clsA*>(clsA[], clsA, pScriptEngine); Cheers
  14. dxj19831029

    Exception inside script code

    Does the angelscript code support throw exception and handle the exception? let's say (script code): try { object.fireExeption(); } catch { // doing something } I don't want to handle the exception inside C++ code, so does angelscript support it? any plan?
  15. dxj19831029

    Assert failed

    Cool. Thanks! I will try asPopActiveContext and push. It may be good if you provide a interface to switch script context. :) Anyway, Thanks for help Cheers Quote:Original post by WitchLord No, the asPopActiveContext won't destroy anything. As I mentioned before, the only problem that may occur is if you use asGetActiveContext anywhere, since it may return the wrong context pointer. Doing a switch fiber within a function called from the script, should in theory not cause any problem. If the function call is not part of any expression in the script, then it should be perfectly safe. The script engine is designed so that it doesn't leave any loose references on the stack between statements. I'll have to look into ways to support asGetActiveContext even with fiber switches in a future release.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!