# Declaration of void, and strategy question

This topic is 4676 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

First a good news, i finished my prototype to have my application interface completly created and controlled by AngelScript, and it is working very well and ask not too much work. It will simplify my life a very big lot :) and i would like to thanks AngelScript people for that. Now just for information in the last hours , i was stuck on a problem that make me some times to understand. I have a member function declared like that in a class: bool getValue(void) And i tried to declare it like this in AngelScript: r = mEngine->RegisterObjectMethod("ControlBool","bool getValue(void)",asMETHOD(WrapControlBool,getValue),asCALL_THISCALL); assert( r >= 0 ); And it doesn't work . I had to remove the void from my AngelScript declaration for it to work like this: r = mEngine->RegisterObjectMethod("ControlBool","bool getValue()",asMETHOD(WrapControlBool,getValue),asCALL_THISCALL); assert( r >= 0 ); I know it is not too much C++ style, but my remains of C languages make me continue to use it. That's it ;) Humm perhaps another strategy question, In My application each time i click on a control, it redefines a GlobalProperty control in AngelScript and execute the command associated with engine.ExecuteString()? Is there another way to envisage that (i am thinking of context and precompiled script perhaps) in this case or does it seems to you a solution as is? A great thanks anyway :D DaesDemon 
 0 
 Share this post Link to post Share on other sites 
 
 
 Advertisement WitchLord    4691 WitchLord Moderator 4691 Posted September 2, 2005 I'm pleased that you got your prototype working and that you are satisfied with AngelScript. Let me know when I can put up a link to your project on the AngelScript users page. [smile]I've changed the engine interface slightly for AngelScript 2.4.0 WIP 2, in an effort to make it easier to fix problems that arise while configuring the engine. The idea now is that you should set the output message stream right after creating the script engine, that way the engine will be able to give your human-readable messages that tells you what's wrong with the declarations used in the register methods.I'll also continue to change the way object types are registered, to force the correct usage, so that the application writer can more easily avoid difficult detect bugs. A common bug is for example to register a complex class, but not its assignment behaviour, which make AngelScript do a bitwise copy of the object in assignments, where it should have called the class's assignment operator. In a future version AngelScript will force the registration of the assignment behaviour, and other required behaviours, though the application can explicitly tell the engine to do bitwise copy if that is wanted. The thing is that AngelScript will not make any assumptions that may be potentially disastrous.Your way of handling the events in the scripts seems to be working well. But using contexts would make it more optimized, and would also allow you to pass parameters to the event handler, instead of storing them in global properties.Internally ExecuteString() wraps the string in a function declaration, compiles it, and executes it using a context. This makes it quite slow. Though for events that occur relatively rarely, such as user input, you'll probably never notice this. 0 Share this post Link to post Share on other sites DaesDemon    122 DaesDemon Member 122 Posted September 3, 2005 Quote:Original post by WitchLordI'm pleased that you got your prototype working and that you are satisfied with AngelScript. Let me know when I can put up a link to your project on the AngelScript users page. [smile]I'll surely inform you when i will have a site project open. Anyway, i am thinking that you will heard of me before as i 'll probably need your help again to understand subtil mechanisms of script writing with Angel ;) Thanks for your quick support, that is really helpfull.Quote:I've changed the engine interface slightly for AngelScript 2.4.0 WIP 2, in an effort to make it easier to fix problems that arise while configuring the engine. The idea now is that you should set the output message stream right after creating the script engine, that way the engine will be able to give your human-readable messages that tells you what's wrong with the declarations used in the register methods.Yes i am thinking that that would be of great help mainly for basic users like me ;) discovering syntax as the main problem in script wrinting is the debuging part. I tried to make a dump of the engine state with theses functions:[source language=c++] // Script functions int GetFunctionCount(const char *module); int GetFunctionIDByIndex(const char *module, int index); int GetFunctionIDByName(const char *module, const char *name); int GetFunctionIDByDecl(const char *module, const char *decl); const char *GetFunctionDeclaration(int funcID, int *length = 0); const char *GetFunctionName(int funcID, int *length = 0); const char *GetFunctionSection(int funcID, int *length = 0); // Script global variables int GetGlobalVarCount(const char *module); int GetGlobalVarIDByIndex(const char *module, int index); int GetGlobalVarIDByName(const char *module, const char *name); int GetGlobalVarIDByDecl(const char *module, const char *decl); const char *GetGlobalVarDeclaration(int gvarID, int *length = 0); const char *GetGlobalVarName(int gvarID, int *length = 0); void *GetGlobalVarPointer(int gvarID); int GetTypeIdByDecl(const char *module, const char *decl); const char *GetTypeDeclaration(int typeId, int *length = 0); to have an idea of what was the representation of my declarations for the engine but i haven't succeeded mainly , i think, because there is no possibilities to iterate through the type declaration as i have almost only that. But perhaps a debug function for the script Engine that would write a dump of every declarations in script language would be useful on a debugging purpose.Quote:I'll also continue to change the way object types are registered, to force the correct usage, so that the application writer can more easily avoid difficult detect bugs. A common bug is for example to register a complex class, but not its assignment behaviour, which make AngelScript do a bitwise copy of the object in assignments, where it should have called the class's assignment operator. In a future version AngelScript will force the registration of the assignment behaviour, and other required behaviours, though the application can explicitly tell the engine to do bitwise copy if that is wanted. The thing is that AngelScript will not make any assumptions that may be potentially disastrous.One of the great advantage of AngelScript for me is the C typed syntax which almost make me think of writing C++ and i don't find the declaration too much difficult comparing to others scripts languages.So the best for me would be to be able to use all C++ mechanism as it in AngelScript, and this is almost the case (except for pointers and some operators missing), so it is very usable with some little imagination as you showed me in the forum.To say the truth i try lua before, and it was not as understandable as AngelScript Documentation so i flip to AngelScript. Obviously i don't know all the mechanism of AngelScript as i have only code with it for a week now and i am sure there is some hidden treasures that will make my coder life more peaceful :) Quote:Your way of handling the events in the scripts seems to be working well. But using contexts would make it more optimized, and would also allow you to pass parameters to the event handler, instead of storing them in global properties.Internally ExecuteString() wraps the string in a function declaration, compiles it, and executes it using a context. This makes it quite slow. Though for events that occur relatively rarely, such as user input, you'll probably never notice this.Yes i understand ExecuteString is a kind of interpreter for string and it is why i'd ask that. But in my case, i will have loads of string commands like this:Panel.getObject().showBoundingBoxes(Control.getValue())or Control.setValue(Panel.getObject().getShowBoundingBoxes()) and that for my thousand of controls. so it is not function but little script string that i have to execute each time i use a control or want to update the control Value.So as far as i have understood of context, i would have to:1) make a wrapping function for each of my command string with my old global property in parameters (control in this case)2) Put every function in a module3) Build the module4) And Each time i use a control : a) Prepare a context for executing the function i need a) Send the Parameters to the wrap b) Execute the context c) get the result params if oneThe advantage of this method is that the script would be precompiled but as you said as i only requires very little command string , it would not make a great difference in this case.So for the moment , i will work a little on the project as it is now, and i will see later to put everything to precompiled state as it will not be hard to change my Script preparations and executing procedure.See you laterRegardsDaesDemon 0 Share this post Link to post Share on other sites 
 Sign in to follow this   Followers 0 
 Go To Topic Listing AngelCode Advertisement 
 Announcements GameDev.net AMA: Aaron Marsden, Twitch Influencer Marketing Specialist Advertisement Popular Tags 2D 3D Advice Algorithm Animation C# C++ Character Design DX11 DX12 GameMaker Gameplay General Java Learning Marketing Mobile Music OpenGL Open Source Optimization PC Unity Unreal Popular Contributors Week Month Year All Time 1 Fulcrum.013 40 2 jbadams 20 3 Hodgman 20 4 Rutin 17 5 lawnjelly 13 Show More Advertisement Popular Now 11 Best way to optimise 3d models By davejonesStarted Wednesday at 07:46 PM 28 WHO recognising 'gaming disorder' By jbadamsStarted Wednesday at 11:44 AM 12 OpenGL HDR tonemapping/exposure values By LewaStarted Tuesday at 03:24 PM 12 Is an IF always a bad thing? By NikiToStarted Tuesday at 03:18 PM 11 Delta Compression: how much compression? By tromtromStarted Tuesday at 03:09 PM Forum Statistics Total Topics 631407 Total Posts 2999915 GameDev.net GameDev.net Articles GameDev.net Event Coverage GameDev.net Forums GameDev.net Blogs GameDev.net Gallery GameDev.net News GameDev.net Projects GDNet Chat All Activity Search In Everywhere This Forum This Topic More options... Find results that contain... Any of my search term words All of my search term words Find results in... Content titles and body Content titles only Home Forums Affiliates AngelCode Declaration of void, and strategy question 
 
 
 × Existing user? Sign In Sign Up Browse Back Articles & Tutorials Back All Categories Audio Business Game Design Industry Programming Visual Arts Columns Back GameDev Unboxed Event Coverage Back All Events Game Developers Conference Power Up Digital Games Conference GameDev.Market Links News Podcasts Back All Podcasts Game Dev Loadout Archive Community Back Beginners Blogs Calendar Chat Forums Back All Forums Audio Business Game Design Programming Visual Arts Community Affiliates Topical Workshops Gallery Groups Projects Back All Projects Games Game Assets Game Mods Developer Tools Store Careers Back Contractors Hobby Projects Game Jobs Back Browse on GameDev.Jobs Post a Job Members Back Chat GDNet+ Membership Guidelines Leaderboard Online Users Awards Search Back All Activity My Activity Streams Back Latest Topics Featured Blogs Search var ipsDebug=false;var CKEDITOR_BASEPATH='//www.gamedev.net/applications/core/interface/ckeditor/ckeditor/';var ipsSettings={cookie_path:"/",cookie_prefix:"ips4_",cookie_ssl:true,upload_imgURL:"",message_imgURL:"",notification_imgURL:"",baseURL:"//www.gamedev.net/",jsURL:"//www.gamedev.net/applications/core/interface/js/js.php",csrfKey:"f2e7231885c7371846b4f95d66a56d91",antiCache:"2a361a8a02",disableNotificationSounds:false,useCompiledFiles:true,links_external:true,memberID:0,analyticsProvider:"ga",viewProfiles:true,mapProvider:'google',mapApiKey:"AIzaSyAeT7tk3vnWWmbgVISkLpbhkQvekG19rHM",}; ips.setSetting('date_format',jQuery.parseJSON('"mm\/dd\/yy"'));ips.setSetting('date_first_day',jQuery.parseJSON('0'));ips.setSetting('remote_image_proxy',jQuery.parseJSON('1'));ips.setSetting('ipb_url_filter_option',jQuery.parseJSON('"none"'));ips.setSetting('url_filter_any_action',jQuery.parseJSON('"allow"'));ips.setSetting('bypass_profanity',jQuery.parseJSON('0'));ips.setSetting('emoji_style',jQuery.parseJSON('"native"'));ips.setSetting('emoji_shortcodes',jQuery.parseJSON('"1"'));ips.setSetting('emoji_ascii',jQuery.parseJSON('"1"'));ips.setSetting('emoji_cache',jQuery.parseJSON('"1"'));ips.setSetting('quickSearchDefault',jQuery.parseJSON('"all"'));ips.setSetting('quickSearchMinimum',jQuery.parseJSON('3'));ips.setSetting('quickSearchShowAdv',jQuery.parseJSON('true'));ips.setSetting('quickSearchIn',jQuery.parseJSON('"title"')); { "@context": "http://schema.org", "@type": "DiscussionForumPosting", "url": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/", "discussionUrl": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/", "name": "Declaration of void, and strategy question", "headline": "Declaration of void, and strategy question", "text": "First a good news, i finished my prototype to have my application interface completly created and controlled by AngelScript, and it is working very well and ask not too much work.\nIt will simplify my life a very big lot :) and i would like to thanks AngelScript people for that.\n\nNow just for information in the last hours , i was stuck on a problem that make me some times to understand.\n\nI have a member function declared like that in a class:\nbool getValue(void)\n\nAnd i tried to declare it like this in AngelScript:\nr = mEngine-\u0026gt;RegisterObjectMethod(\"ControlBool\",\"bool getValue(void)\",asMETHOD(WrapControlBool,getValue),asCALL_THISCALL);\tassert( r \u0026gt;= 0 );\t\nAnd it doesn\u0027t work .\nI had to remove the void from my AngelScript declaration for it to work like this:\nr = mEngine-\u0026gt;RegisterObjectMethod(\"ControlBool\",\"bool getValue()\",asMETHOD(WrapControlBool,getValue),asCALL_THISCALL);\tassert( r \u0026gt;= 0 );\n\nI know it is not too much C++ style, but my remains of C languages make me continue to use it.\nThat\u0027s it ;)\n\nHumm perhaps another strategy question, \nIn My application each time i click on a control, it redefines a GlobalProperty control in AngelScript and execute the command associated with engine.ExecuteString()?\n\nIs there another way to envisage that (i am thinking of context and precompiled script perhaps) in this case or does it seems to you a solution as is?\n\nA great thanks anyway :D\nDaesDemon", "dateCreated": "2005-09-02T11:59:05+0000", "datePublished": "2005-09-02T11:59:05+0000", "pageStart": 1, "pageEnd": 1, "image": "https://secure.gravatar.com/avatar/15e1ee3ae02ffa8e9dade00af661318f?d=https://www.gamedev.net/uploads/monthly_2017_08/D.png.f8a250771dc52ee67fa369742ae9aead.png", "author": { "@type": "Person", "name": "DaesDemon", "image": "https://secure.gravatar.com/avatar/15e1ee3ae02ffa8e9dade00af661318f?d=https://www.gamedev.net/uploads/monthly_2017_08/D.png.f8a250771dc52ee67fa369742ae9aead.png", "url": "https://www.gamedev.net/profile/87186-daesdemon/" }, "interactionStatistic": [ { "@type": "InteractionCounter", "interactionType": "http://schema.org/ViewAction", "userInteractionCount": 506 }, { "@type": "InteractionCounter", "interactionType": "http://schema.org/CommentAction", "userInteractionCount": 2 }, { "@type": "InteractionCounter", "interactionType": "http://schema.org/FollowAction", "userInteractionCount": 5 } ], "comment": [ { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/?do=findComment\u0026comment=343072", "author": { "@type": "Person", "name": "DaesDemon", "image": "https://secure.gravatar.com/avatar/15e1ee3ae02ffa8e9dade00af661318f?d=https://www.gamedev.net/uploads/monthly_2017_08/D.png.f8a250771dc52ee67fa369742ae9aead.png", "url": "https://www.gamedev.net/profile/87186-daesdemon/" }, "dateCreated": "2005-09-02T11:59:05+0000", "text": "First a good news, i finished my prototype to have my application interface completly created and controlled by AngelScript, and it is working very well and ask not too much work.\nIt will simplify my life a very big lot :) and i would like to thanks AngelScript people for that.\n\nNow just for information in the last hours , i was stuck on a problem that make me some times to understand.\n\nI have a member function declared like that in a class:\nbool getValue(void)\n\nAnd i tried to declare it like this in AngelScript:\nr = mEngine-\u0026gt;RegisterObjectMethod(\"ControlBool\",\"bool getValue(void)\",asMETHOD(WrapControlBool,getValue),asCALL_THISCALL);\tassert( r \u0026gt;= 0 );\t\nAnd it doesn\u0027t work .\nI had to remove the void from my AngelScript declaration for it to work like this:\nr = mEngine-\u0026gt;RegisterObjectMethod(\"ControlBool\",\"bool getValue()\",asMETHOD(WrapControlBool,getValue),asCALL_THISCALL);\tassert( r \u0026gt;= 0 );\n\nI know it is not too much C++ style, but my remains of C languages make me continue to use it.\nThat\u0027s it ;)\n\nHumm perhaps another strategy question, \nIn My application each time i click on a control, it redefines a GlobalProperty control in AngelScript and execute the command associated with engine.ExecuteString()?\n\nIs there another way to envisage that (i am thinking of context and precompiled script perhaps) in this case or does it seems to you a solution as is?\n\nA great thanks anyway :D\nDaesDemon", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/" }, { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/?do=findComment\u0026comment=3240280", "author": { "@type": "Person", "name": "WitchLord", "image": "https://www.gamedev.net/uploads/monthly_2017_11/20171103_190026_small.thumb.jpg.3f2d8920c71792b585d94bc4f2a8bd69.jpg", "url": "https://www.gamedev.net/profile/3551-andreas-jonsson/" }, "dateCreated": "2005-09-02T13:53:22+0000", "text": "I\u0027m pleased that you got your prototype working and that you are satisfied with AngelScript. Let me know when I can put up a link to your project on the AngelScript users page. [smile]I\u0027ve changed the engine interface slightly for AngelScript 2.4.0 WIP 2, in an effort to make it easier to fix problems that arise while configuring the engine. The idea now is that you should set the output message stream right after creating the script engine, that way the engine will be able to give your human-readable messages that tells you what\u0027s wrong with the declarations used in the register methods.I\u0027ll also continue to change the way object types are registered, to force the correct usage, so that the application writer can more easily avoid difficult detect bugs. A common bug is for example to register a complex class, but not its assignment behaviour, which make AngelScript do a bitwise copy of the object in assignments, where it should have called the class\u0027s assignment operator. In a future version AngelScript will force the registration of the assignment behaviour, and other required behaviours, though the application can explicitly tell the engine to do bitwise copy if that is wanted. The thing is that AngelScript will not make any assumptions that may be potentially disastrous.Your way of handling the events in the scripts seems to be working well. But using contexts would make it more optimized, and would also allow you to pass parameters to the event handler, instead of storing them in global properties.Internally ExecuteString() wraps the string in a function declaration, compiles it, and executes it using a context. This makes it quite slow. Though for events that occur relatively rarely, such as user input, you\u0027ll probably never notice this.", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/" }, { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/?do=findComment\u0026comment=3241555", "author": { "@type": "Person", "name": "DaesDemon", "image": "https://secure.gravatar.com/avatar/15e1ee3ae02ffa8e9dade00af661318f?d=https://www.gamedev.net/uploads/monthly_2017_08/D.png.f8a250771dc52ee67fa369742ae9aead.png", "url": "https://www.gamedev.net/profile/87186-daesdemon/" }, "dateCreated": "2005-09-03T10:55:46+0000", "text": "I\u0027ll surely inform you when i will have a site project open. Anyway, i am thinking that you will heard of me before as i \u0027ll probably need your help again to understand subtil mechanisms of script writing with Angel ;) Thanks for your quick support, that is really helpfull.Yes i am thinking that that would be of great help mainly for basic users like me ;) discovering syntax as the main problem in script wrinting is the debuging part. I tried to make a dump of the engine state with theses functions:[source language=c++]// Script functionsint GetFunctionCount(const char *module);int GetFunctionIDByIndex(const char *module, int index);int GetFunctionIDByName(const char *module, const char *name);int GetFunctionIDByDecl(const char *module, const char *decl);const char *GetFunctionDeclaration(int funcID, int *length = 0);const char *GetFunctionName(int funcID, int *length = 0);const char *GetFunctionSection(int funcID, int *length = 0);// Script global variablesint GetGlobalVarCount(const char *module);int GetGlobalVarIDByIndex(const char *module, int index);int GetGlobalVarIDByName(const char *module, const char *name);int GetGlobalVarIDByDecl(const char *module, const char *decl);const char *GetGlobalVarDeclaration(int gvarID, int *length = 0);const char *GetGlobalVarName(int gvarID, int *length = 0);void *GetGlobalVarPointer(int gvarID);int GetTypeIdByDecl(const char *module, const char *decl);const char *GetTypeDeclaration(int typeId, int *length = 0); to have an idea of what was the representation of my declarations for the engine but i haven\u0027t succeeded mainly , i think, because there is no possibilities to iterate through the type declaration as i have almost only that. But perhaps a debug function for the script Engine that would write a dump of every declarations in script language would be useful on a debugging purpose.One of the great advantage of AngelScript for me is the C typed syntax which almost make me think of writing C++ and i don\u0027t find the declaration too much difficult comparing to others scripts languages.So the best for me would be to be able to use all C++ mechanism as it in AngelScript, and this is almost the case (except for pointers and some operators missing), so it is very usable with some little imagination as you showed me in the forum.To say the truth i try lua before, and it was not as understandable as AngelScript Documentation so i flip to AngelScript. Obviously i don\u0027t know all the mechanism of AngelScript as i have only code with it for a week now and i am sure there is some hidden treasures that will make my coder life more peaceful :) Yes i understand ExecuteString is a kind of interpreter for string and it is why i\u0027d ask that. But in my case, i will have loads of string commands like this:Panel.getObject().showBoundingBoxes(Control.getValue())or Control.setValue(Panel.getObject().getShowBoundingBoxes()) and that for my thousand of controls. so it is not function but little script string that i have to execute each time i use a control or want to update the control Value.So as far as i have understood of context, i would have to:1) make a wrapping function for each of my command string with my old global property in parameters (control in this case)2) Put every function in a module3) Build the module4) And Each time i use a control : a) Prepare a context for executing the function i need a) Send the Parameters to the wrap b) Execute the context c) get the result params if oneThe advantage of this method is that the script would be precompiled but as you said as i only requires very little command string , it would not make a great difference in this case.So for the moment , i will work a little on the project as it is now, and i will see later to put everything to precompiled state as it will not be hard to change my Script preparations and executing procedure.See you laterRegardsDaesDemon\n", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/343072-declaration-of-void-and-strategy-question/" } ] } { "@context": "http://www.schema.org", "@type": "WebSite", "name": "GameDev.net", "url": "https://www.gamedev.net/", "potentialAction": { "type": "SearchAction", "query-input": "required name=query", "target": "https://www.gamedev.net/search/?q={query}" }, "inLanguage": [ { "@type": "Language", "name": "English (USA)", "alternateName": "en-US" } ] } { "@context": "http://www.schema.org", "@type": "Organization", "name": "GameDev.net", "url": "https://www.gamedev.net/", "logo": "https://www.gamedev.net/uploads/themes/monthly_2017_04/gamedev-logo-2017-368x76.png.e986e41d566ff6c90485a5304985ed5f.png", "address": { "@type": "PostalAddress", "streetAddress": "", "addressLocality": null, "addressRegion": null, "postalCode": null, "addressCountry": null } } { "@context": "http://schema.org", "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "item": { "@id": "https://www.gamedev.net/forums/", "name": "Forums" } }, { "@type": "ListItem", "position": 2, "item": { "@id": "https://www.gamedev.net/forums/forum/32-affiliates/", "name": "Affiliates" } }, { "@type": "ListItem", "position": 3, "item": { "@id": "https://www.gamedev.net/forums/forum/34-angelcode/", "name": "AngelCode" } } ] } { "@context": "http://schema.org", "@type": "ContactPage", "url": "https://www.gamedev.net/contact/" } Important Information By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.   I accept Participate in the game development conversation and more when you create an account on GameDev.net! Sign me up!