{"id":23790346,"url":"https://github.com/fudgepop01/aiscriptpad-editor","last_synced_at":"2025-02-21T12:44:17.444Z","repository":{"id":42763429,"uuid":"277676452","full_name":"fudgepop01/aiscriptpad-editor","owner":"fudgepop01","description":"an extension for vscode that makes editing aiscriptpad files much nicer","archived":false,"fork":false,"pushed_at":"2023-07-06T14:32:19.000Z","size":7441,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T17:21:15.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fudgepop01.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-07T00:19:35.000Z","updated_at":"2022-03-08T13:29:38.000Z","dependencies_parsed_at":"2023-01-31T16:15:36.497Z","dependency_job_id":null,"html_url":"https://github.com/fudgepop01/aiscriptpad-editor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudgepop01%2Faiscriptpad-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudgepop01%2Faiscriptpad-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudgepop01%2Faiscriptpad-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fudgepop01%2Faiscriptpad-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fudgepop01","download_url":"https://codeload.github.com/fudgepop01/aiscriptpad-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240018687,"owners_count":19734872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-01T17:21:22.952Z","updated_at":"2025-02-21T12:44:17.409Z","avatar_url":"https://github.com/fudgepop01.png","language":"TypeScript","readme":"# aiscriptpad-editor README\r\n\r\nThis is an extension developed to assist in the editing of files generated by\r\n[AIScriptPad](https://www.dropbox.com/s/pclv5x1vmk8o6fh/AIScriptPad2.0PM.zip?dl=0),\r\na separate program created/modified by `Mr. AI | Sluigi123`, and `Bero`.\r\n\r\n**The Supported File Types Include:**\r\n- `.as`\r\n- `.aipd`\r\n- `.atkd`\r\n\r\nThis extension adds the following features to vscode when editing those files:\r\n\r\n- reading configuration from a given `include` folder\r\n  - this can be configured in settings\r\n  - defaults to `[current workspace root]/Include` as `./Include`\r\n- autocompletion with argument support and documentation\r\n- hover documentation\r\n- jump to referenced label\r\n  - done by ctrl+clicking on `Seek` or `Goto` instructions\r\n- syntax highlighting\r\n\r\n## As of [0.2.0], this Extenison ALSO adds...\r\n\r\nthe ability to compile and export the scripts! **(WINDOWS ONLY)**\r\n\r\nOpen the command panel with `Ctrl+Shift+P` and choose \"export data from pac file\"\r\nto extract the AI files from a pac file, and choose \"compile AI to pac file\"\r\nto compile the AI files back into the pac file.\r\n\r\nalternatively, you can right click on a folder or pac file and choose the command from\r\nthe bottom of that menu!\r\n\r\n## [0.3.0] - Macros, Globals, Named Variables/Constants, and Helper Functions!\r\n\r\nSo yeah I added a preprocessor. It's important to note that a `__preprocessed` folder will\r\nnow be created whenever scripts are compiled. This is to assist with debugging.\r\n\r\n### Named Variables/Constants\r\n\r\nLets start with named variables / constants:\r\n\r\nto assign a name to a variable, you can use the following format:\r\n\r\n`#let varName = var4`\r\n\r\nthis allows you to use `varName` at a *later point in the code* and have it automatically\r\nreplaced by the variable you assigned it to when it comes time to compile. This makes things\r\nsignificantly more readable.\r\n\r\nso, after defining `varName` like that, any `varName` will be replaced with `var4`.\r\n\r\nConstants are similar, except they get replaced by a value instead of a numbered variable\r\n\r\n`#const my_constant = 69`\r\n\r\nthis will replace all instances of `my_constant` with `69` whenver it's used later on in the code.\r\n\r\nYou can also redeclare these with the same format if you really want to, but it's not recommended.\r\n\r\n### Globals\r\n\r\nGlobals are just global named constants and variable names that you can define if you so desire.\r\n\r\nJust make a `globals.as` file and put all your `#let` and `#define` statements in there. Then you\r\ncan use them in the other `.as` files without needing to redeclare them.\r\n\r\n### Macros\r\n\r\nMacros are just reusable pieces of code. They are **all defined in one** `macros.as`\r\n**file** that's placed in the same place as all the other files. They start with `#macro macro_name`\r\nand end with `#endmacro`\r\n\r\nHere's one example that also uses named variables:\r\n\r\n```\r\n/*\r\n  calculates the distance from the target position\r\n\r\n  expects the following:\r\n    var9 = targetXOffset\r\n    var10 = targetYOffset\r\n    var11 = targetXRange\r\n    var12 = targetYRange\r\n  modifies the following:\r\n    var13, var14\r\n  defines the following:\r\n    targetXDistance (var13)\r\n    targetYDistance (var14)\r\n*/\r\n#macro CALC_TARGET_DISTANCES() // the () was added in 0.4.0\r\n  #let targetXOffset = var9\r\n  #let targetYOffset = var10\r\n  #let targetXRange = var11\r\n  #let targetYRange = var12\r\n  DrawDebugPoint TopNX TopNY 255 0 0 255\r\n\r\n  #let targetX = var13\r\n  #let targetY = var14\r\n  targetX = OTopNX + (targetXOffset * Direction * -1)\r\n  targetY = OTopNY + targetYOffset\r\n  // account for target's \u0026 own velocity\r\n  targetX = targetX + (OXSpeed * 10) - (XSpeed * 7)\r\n  targetY = targetY + (OYSpeed * 4) - (YSpeed * 4)\r\n  DrawDebugRectOutline targetX targetY targetXRange targetYRange 0 255 0 255\r\n\r\n  #let targetXDistance = var13\r\n  #let targetYDistance = var14\r\n  targetXDistance = targetX - TopNX\r\n  targetYDistance = targetY - TopNY\r\n#endmacro\r\n```\r\n\r\nIn other files, whenever a line consisting exclusively of `CALC_TARGET_DISTANCES` is encountered,\r\nit will be replaced by the contents of that macro. This will *also* declare/redeclare any\r\nvariable names and constants that were used inside that macro, so after using the macro in\r\nanother file, you can also use `targetXDistance` and `targetYDistance` (and the others, but\r\nthose `targetXDistance` and `targetYDistance` are the important ones)\r\n\r\n### Helper \"Functions\"\r\n\r\nthere are a few things you can surround certain kinds of values with to convert them to a\r\nnumeric or argument equivalent:\r\n\r\n- `color(0x[hex value here])`\r\n  - converts a hex value to a series of four values 0 through 255 representing red, green, blue, and alpha\r\n- `str(\"[string here]\")`\r\n  - converts a string to a series of 5 numbers representing the text. Every 3 characters is 1 value.\r\n- `strv(\"[string here]\")`\r\n  - converts a string of 3 characters **OR LESS** to a single number representing that text\r\n- `hex(0x[hex value here])`\r\n  - converts a hex number to a standard number. This is necessary if you want to use a hex value representation\r\n    of a number in your source code.\r\n\r\n## [0.4.0] - Templated Macros\r\n\r\nMacros can now take arguments! That means you can make them do things like use different variables\r\nor even inline values! As such, **the syntax for defining macros has changed slightly since 0.3.0**:\r\n\r\nHere is how you can define and use a macro with templated parameters:\r\n\r\n```\r\n#macro TEMPLATED_MACRO(var1, amount)\r\n  #let tempVar = {var1}\r\n\r\n  // do stuff with tempVar\r\n#endmacro\r\n```\r\n\r\n\u003e **NOTE:**\r\n\u003e\r\n\u003e It is important that you don't get *too* carried away and start treating macros like\r\n\u003e standard functions! Each time you use a macro the full text is inserted. They were mainly made\r\n\u003e to allow users to make use of all 10 \"local\" variables rather than make some convoluted system\r\n\u003e involving lots of consistency.\r\n\r\nAnyway, enjoy!\r\n\r\n## [0.5.0] - Template Files \u0026 Snippets\r\n\r\nNow you have the ability to create and read from a folder named `shared` in the `include` directory!\r\nWhat this means is you're now able to define multiple things across multiple projects *including* code.\r\nFor macros and globals, simply make `macros.as` and `globals.as` files within the `shared` directory. \r\nFor code, create a `templates` folder inside the `shared` folder and add whatever `.as` files you want to\r\nshare across all projects.\r\n\r\nThese template files can include things called `snippets` - they're basically the same thing as macros but \r\nthey're special. They take *no* arguments and are used inside the template files with `{TEMPLATE_NAME}`.\r\nTo fill in these templates on a per-project basis, make a file of the same name within the project's directory.\r\nHere, you'll create a `TEMPLATE_NAME` snippet with `#snippet` and `#endsnippet`.\r\n\r\nin this case it would be:\r\n\r\n```\r\n#snippet TEMPLATE_NAME\r\n  // whatever code you want here\r\n#endsnippet\r\n```\r\n\r\nEven if you have template files, you can override them by just structuring a file of the same name as you normally would.\r\n(The key part it searches for is any line starting with `id `).\r\n\r\nFurthermore, any constants and macros defined in the shared `globals.as` and `macros.as` can be overwritten in a similar way.\r\nJust make a constant / macro of the same name and it'll automatically be overwritten!\r\n\r\n## [0.6.0] - Custom Preprocessor Scripts!\r\n\r\nNow you can create your own custom preprocessing functions! \r\n\r\nMake a file named `scripts.js` in the same place as `globals.as` and `macros.as` in the *shared* folder. In here you can create functions just as you normally would with javascript. Anything you want to use as a preprocessor function should be prefaced with the `export` keyword. \r\n\r\nAll parameters recieved will be of javascript type `string`. These functions should return a string. This return value will automatically be preprocessed - so no worries there. \r\n\r\n```js\r\nexport const testFunc = () =\u003e {\r\n  return `// this is the output of testFunc`;\r\n}\r\n\r\nexport function argFunc(arg1) {\r\n  return `// you passed in: \"${arg1}\"`;\r\n}\r\n```\r\n\r\nYou can access globally defined constants with a special `$globals` variable. This contains all the constants as key/value pairs, where the key is the constant name and the value is the constant value. The following will list out each defined global as well as its value in a line comment:\r\n\r\n```js\r\nexport const listGlobals = () =\u003e {\r\n  let out = \"\";\r\n  for (const [key, val] of Object.entries($globals)) {\r\n    out += `// ${key}: ${val}\\n`;\r\n  }\r\n  return out;\r\n}\r\n```\r\n\r\nOnce defined, you can call the function with `$function_name_here()`. Ex.\r\n\r\n```\r\n$testFunc()\r\n\r\n$argFunc(hello world)\r\n```\r\n\r\nwill get transformed into the following when you compile it:\r\n\r\n```\r\n// this is the output of testFunc\r\n\r\n// you passed in \"hello world\"\r\n```\r\n\r\nUse this to automate certain tasks that would otherwise be extremely tedious!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudgepop01%2Faiscriptpad-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffudgepop01%2Faiscriptpad-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffudgepop01%2Faiscriptpad-editor/lists"}