{"action":"created","issue":{"url":"https://api.github.com/repos/OpenTechEngine/Discussions/issues/6","labels_url":"https://api.github.com/repos/OpenTechEngine/Discussions/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/OpenTechEngine/Discussions/issues/6/comments","events_url":"https://api.github.com/repos/OpenTechEngine/Discussions/issues/6/events","html_url":"https://github.com/OpenTechEngine/Discussions/issues/6","id":99667774,"number":6,"title":"scripting and scripting related stuff","user":{"login":"BielBdeLuna","id":2709433,"avatar_url":"https://avatars.githubusercontent.com/u/2709433?v=3","gravatar_id":"","url":"https://api.github.com/users/BielBdeLuna","html_url":"https://github.com/BielBdeLuna","followers_url":"https://api.github.com/users/BielBdeLuna/followers","following_url":"https://api.github.com/users/BielBdeLuna/following{/other_user}","gists_url":"https://api.github.com/users/BielBdeLuna/gists{/gist_id}","starred_url":"https://api.github.com/users/BielBdeLuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BielBdeLuna/subscriptions","organizations_url":"https://api.github.com/users/BielBdeLuna/orgs","repos_url":"https://api.github.com/users/BielBdeLuna/repos","events_url":"https://api.github.com/users/BielBdeLuna/events{/privacy}","received_events_url":"https://api.github.com/users/BielBdeLuna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-08-07T15:16:31Z","updated_at":"2015-10-13T16:56:08Z","closed_at":null,"body":"I'm currently adding the path routines to the AI and tried something: in c++ and other languages you can write parts of the methods of a class in another file.\r\nThis might prove useful in order to have the code well separated in groups of methods or functions that correspond to an area, could this be done in idTechX script? it can be done\r\n\r\nas long as in the script-object (idTechX has no objects, but has script-objects which depends on entities) those functions are introduced, you can then extend them in any other file, as long as then the file is included\r\n\r\nso you can have:\r\n\r\na ai.script file an then a ai_extra.script file\r\n\r\nand in ai.script you can have this:\r\n\r\n```\r\nobject super_cool_ai : super_cool_ai_base {\r\n\r\n    void super_cool_fucntion();\r\n    void not_so_super_cool_function();\r\n\r\n};\r\n\r\nvoid  super_cool_ai::not_so_super_cool_function(){\r\n    // not so super cool code here\r\n}\r\n```\r\n\r\nand in ai_extra you have this:\r\n\r\n```\r\nvoid  super_cool_ai::super_cool_function(){\r\n    // super cool code here\r\n}\r\n```\r\n\r\nyou then in the main.script file add this:\r\n\r\n```\r\n#include ai.script\r\n#include ai_extra.script\r\n```\r\n\r\nidTechX will accept the code, so this means that the engine will keep searching unfound functions until the end of the files and if he doesn't find it then it will error out to desktop with the pertinent message.\r\n\r\nthis is great to have the AI code not in a single file like how it was in doom3 scripting but have it well separated in different files\r\n\r\nit would be great though to have those separated methods be able to be reused whenever it's necessary for the user, but this can only be done in two different occasions:\r\n\r\n- it needs to be used in a superclass form the class the user is reclaiming that method, so the method can use variables already initiated by the superclass\r\n\r\n- or have those methods be self contained so they can be used anywhere, but then this is more akin to the \"subs\" (subroutines) than those out of the class defined file methods.\r\n\r\nmaybe the best practice would be to make an AI that uses the least amount of variables so it's more process intensive but allows for even more flexibility? and maybe use variables just for the most generalist functions so they are initiated in the well above superclass stratification?"},"comment":{"url":"https://api.github.com/repos/OpenTechEngine/Discussions/issues/comments/147776516","html_url":"https://github.com/OpenTechEngine/Discussions/issues/6#issuecomment-147776516","issue_url":"https://api.github.com/repos/OpenTechEngine/Discussions/issues/6","id":147776516,"user":{"login":"BielBdeLuna","id":2709433,"avatar_url":"https://avatars.githubusercontent.com/u/2709433?v=3","gravatar_id":"","url":"https://api.github.com/users/BielBdeLuna","html_url":"https://github.com/BielBdeLuna","followers_url":"https://api.github.com/users/BielBdeLuna/followers","following_url":"https://api.github.com/users/BielBdeLuna/following{/other_user}","gists_url":"https://api.github.com/users/BielBdeLuna/gists{/gist_id}","starred_url":"https://api.github.com/users/BielBdeLuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BielBdeLuna/subscriptions","organizations_url":"https://api.github.com/users/BielBdeLuna/orgs","repos_url":"https://api.github.com/users/BielBdeLuna/repos","events_url":"https://api.github.com/users/BielBdeLuna/events{/privacy}","received_events_url":"https://api.github.com/users/BielBdeLuna/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T16:56:08Z","updated_at":"2015-10-13T16:56:08Z","body":"I'm done with the scripting of enemies, now I'm proceeding to make it playable in IdTechX:\r\n\r\nhttps://github.com/BielBdeLuna/idTechX_GPL_scripts/tree/untested/script/ai\r\n\r\nATM the code is there but it's not tested in IdTechX, only the actual FSM is untested the rest is working fine in-engine. (at least compiles fine)"}}