{"action":"created","comment":{"url":"https://api.github.com/repos/KSP-KOS/KOS/pulls/comments/27768010","id":27768010,"diff_hunk":"@@ -1739,11 +1716,8 @@ public class OpcodeWait : Opcode\n \n         public override void Execute(ICpu cpu)\n         {\n-            object waitTime = cpu.PopValue();\n-            if (waitTime is double)\n-                cpu.StartWait((double)waitTime);\n-            else if (waitTime is int)\n-                cpu.StartWait((int)waitTime);\n+            object arg = cpu.PopValue();\n+            cpu.StartWait(Convert.ToDouble(arg));","path":"src/kOS.Safe/Compilation/Opcode.cs","position":53,"original_position":53,"commit_id":"16f715fc244e78989669c425ce73bb04b10f032c","original_commit_id":"16f715fc244e78989669c425ce73bb04b10f032c","user":{"login":"Dunbaratu","id":5216848,"avatar_url":"https://avatars.githubusercontent.com/u/5216848?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunbaratu","html_url":"https://github.com/Dunbaratu","followers_url":"https://api.github.com/users/Dunbaratu/followers","following_url":"https://api.github.com/users/Dunbaratu/following{/other_user}","gists_url":"https://api.github.com/users/Dunbaratu/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunbaratu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunbaratu/subscriptions","organizations_url":"https://api.github.com/users/Dunbaratu/orgs","repos_url":"https://api.github.com/users/Dunbaratu/repos","events_url":"https://api.github.com/users/Dunbaratu/events{/privacy}","received_events_url":"https://api.github.com/users/Dunbaratu/received_events","type":"User","site_admin":false},"body":"We have methods over in FunctionBase that do safe numeric conversions (safe in that they will trap System casting exceptions and transform them into KOS exceptions instead, so users don't see the raw System exceptions when they pass bogus types of values to the functions.) \r\n\r\nIt occurs to me that we might want to do a refactor later that adds that sort of thinking to all these kRISC opcode parameters.  Many of them are coming from the compiler directly injecting the ML code with the results of user expressions.","created_at":"2015-04-04T09:48:54Z","updated_at":"2015-04-04T09:48:54Z","html_url":"https://github.com/KSP-KOS/KOS/pull/726#discussion_r27768010","pull_request_url":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726","_links":{"self":{"href":"https://api.github.com/repos/KSP-KOS/KOS/pulls/comments/27768010"},"html":{"href":"https://github.com/KSP-KOS/KOS/pull/726#discussion_r27768010"},"pull_request":{"href":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726"}}},"pull_request":{"url":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726","id":32631324,"html_url":"https://github.com/KSP-KOS/KOS/pull/726","diff_url":"https://github.com/KSP-KOS/KOS/pull/726.diff","patch_url":"https://github.com/KSP-KOS/KOS/pull/726.patch","issue_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/726","number":726,"state":"open","locked":false,"title":"Resolves #688, #722 - WAIT is no longer a trigger.","user":{"login":"Dunbaratu","id":5216848,"avatar_url":"https://avatars.githubusercontent.com/u/5216848?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunbaratu","html_url":"https://github.com/Dunbaratu","followers_url":"https://api.github.com/users/Dunbaratu/followers","following_url":"https://api.github.com/users/Dunbaratu/following{/other_user}","gists_url":"https://api.github.com/users/Dunbaratu/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunbaratu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunbaratu/subscriptions","organizations_url":"https://api.github.com/users/Dunbaratu/orgs","repos_url":"https://api.github.com/users/Dunbaratu/repos","events_url":"https://api.github.com/users/Dunbaratu/events{/privacy}","received_events_url":"https://api.github.com/users/Dunbaratu/received_events","type":"User","site_admin":false},"body":"In addition to fixing the mentioned issues, this should also be slightly simpler and more efficient.\r\n\r\nRemoved WAIT from the trigger system and just made it do a simple loop right there in the mainline code where it was defined,  akin to this psuedocode:\r\n```\r\n    do\r\n            wait 1 (fixed)update tick.\r\n            evaluate expression\r\n    until expression is true\r\n```\r\nThis is literally exactly the same performance as the old way (because the trigger checked the condition every (fixed)update, and so does this), but without eating into the precious limited resource of trigger instructions per update.\r\n\r\nThis will also be slightly less ML code *except* in the case where the script uses the same WAIT UNTIL expression repeatedly in more than one place in the source code.  Then this will admittedly result in a slightly bigger ML file than it would have before (because before the expression's instructions were only compiled once regardless of how many times the expression was mentioned in wait statements, and all the additional places the same wait expression existed it just referred back to the existing trigger.)\r\n\r\nI would argue that that's actually a \"good\" thing, though, because users *should* expect that programming by cut-and-paste would result in inefficiently repeated code in the ML file, and not rely on the compiler to optimize away what is essentially a redundancy that exists in the source code.\r\n","created_at":"2015-04-04T09:21:52Z","updated_at":"2015-04-04T09:48:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8335ffa15b380edaa4007b90cc1d7e7d21b54ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726/commits","review_comments_url":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726/comments","review_comment_url":"https://api.github.com/repos/KSP-KOS/KOS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/726/comments","statuses_url":"https://api.github.com/repos/KSP-KOS/KOS/statuses/16f715fc244e78989669c425ce73bb04b10f032c","head":{"label":"Dunbaratu:fixes-688-fixes-722-mainline-wait-refactor","ref":"fixes-688-fixes-722-mainline-wait-refactor","sha":"16f715fc244e78989669c425ce73bb04b10f032c","user":{"login":"Dunbaratu","id":5216848,"avatar_url":"https://avatars.githubusercontent.com/u/5216848?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunbaratu","html_url":"https://github.com/Dunbaratu","followers_url":"https://api.github.com/users/Dunbaratu/followers","following_url":"https://api.github.com/users/Dunbaratu/following{/other_user}","gists_url":"https://api.github.com/users/Dunbaratu/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunbaratu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunbaratu/subscriptions","organizations_url":"https://api.github.com/users/Dunbaratu/orgs","repos_url":"https://api.github.com/users/Dunbaratu/repos","events_url":"https://api.github.com/users/Dunbaratu/events{/privacy}","received_events_url":"https://api.github.com/users/Dunbaratu/received_events","type":"User","site_admin":false},"repo":{"id":18195960,"name":"KOS-1","full_name":"Dunbaratu/KOS-1","owner":{"login":"Dunbaratu","id":5216848,"avatar_url":"https://avatars.githubusercontent.com/u/5216848?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunbaratu","html_url":"https://github.com/Dunbaratu","followers_url":"https://api.github.com/users/Dunbaratu/followers","following_url":"https://api.github.com/users/Dunbaratu/following{/other_user}","gists_url":"https://api.github.com/users/Dunbaratu/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunbaratu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunbaratu/subscriptions","organizations_url":"https://api.github.com/users/Dunbaratu/orgs","repos_url":"https://api.github.com/users/Dunbaratu/repos","events_url":"https://api.github.com/users/Dunbaratu/events{/privacy}","received_events_url":"https://api.github.com/users/Dunbaratu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Dunbaratu/KOS-1","description":"Fully programmable autopilot mod for KSP. Originally By Nivekk","fork":true,"url":"https://api.github.com/repos/Dunbaratu/KOS-1","forks_url":"https://api.github.com/repos/Dunbaratu/KOS-1/forks","keys_url":"https://api.github.com/repos/Dunbaratu/KOS-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Dunbaratu/KOS-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Dunbaratu/KOS-1/teams","hooks_url":"https://api.github.com/repos/Dunbaratu/KOS-1/hooks","issue_events_url":"https://api.github.com/repos/Dunbaratu/KOS-1/issues/events{/number}","events_url":"https://api.github.com/repos/Dunbaratu/KOS-1/events","assignees_url":"https://api.github.com/repos/Dunbaratu/KOS-1/assignees{/user}","branches_url":"https://api.github.com/repos/Dunbaratu/KOS-1/branches{/branch}","tags_url":"https://api.github.com/repos/Dunbaratu/KOS-1/tags","blobs_url":"https://api.github.com/repos/Dunbaratu/KOS-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Dunbaratu/KOS-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Dunbaratu/KOS-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/Dunbaratu/KOS-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Dunbaratu/KOS-1/statuses/{sha}","languages_url":"https://api.github.com/repos/Dunbaratu/KOS-1/languages","stargazers_url":"https://api.github.com/repos/Dunbaratu/KOS-1/stargazers","contributors_url":"https://api.github.com/repos/Dunbaratu/KOS-1/contributors","subscribers_url":"https://api.github.com/repos/Dunbaratu/KOS-1/subscribers","subscription_url":"https://api.github.com/repos/Dunbaratu/KOS-1/subscription","commits_url":"https://api.github.com/repos/Dunbaratu/KOS-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/Dunbaratu/KOS-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/Dunbaratu/KOS-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/Dunbaratu/KOS-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/Dunbaratu/KOS-1/contents/{+path}","compare_url":"https://api.github.com/repos/Dunbaratu/KOS-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Dunbaratu/KOS-1/merges","archive_url":"https://api.github.com/repos/Dunbaratu/KOS-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Dunbaratu/KOS-1/downloads","issues_url":"https://api.github.com/repos/Dunbaratu/KOS-1/issues{/number}","pulls_url":"https://api.github.com/repos/Dunbaratu/KOS-1/pulls{/number}","milestones_url":"https://api.github.com/repos/Dunbaratu/KOS-1/milestones{/number}","notifications_url":"https://api.github.com/repos/Dunbaratu/KOS-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Dunbaratu/KOS-1/labels{/name}","releases_url":"https://api.github.com/repos/Dunbaratu/KOS-1/releases{/id}","created_at":"2014-03-28T00:09:16Z","updated_at":"2015-01-04T19:29:21Z","pushed_at":"2015-04-04T09:05:28Z","git_url":"git://github.com/Dunbaratu/KOS-1.git","ssh_url":"git@github.com:Dunbaratu/KOS-1.git","clone_url":"https://github.com/Dunbaratu/KOS-1.git","svn_url":"https://github.com/Dunbaratu/KOS-1","homepage":null,"size":28144,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"KSP-KOS:develop","ref":"develop","sha":"7b06dc07b939f305a8166bd6f3cdd2f61c1bb041","user":{"login":"KSP-KOS","id":6767371,"avatar_url":"https://avatars.githubusercontent.com/u/6767371?v=3","gravatar_id":"","url":"https://api.github.com/users/KSP-KOS","html_url":"https://github.com/KSP-KOS","followers_url":"https://api.github.com/users/KSP-KOS/followers","following_url":"https://api.github.com/users/KSP-KOS/following{/other_user}","gists_url":"https://api.github.com/users/KSP-KOS/gists{/gist_id}","starred_url":"https://api.github.com/users/KSP-KOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KSP-KOS/subscriptions","organizations_url":"https://api.github.com/users/KSP-KOS/orgs","repos_url":"https://api.github.com/users/KSP-KOS/repos","events_url":"https://api.github.com/users/KSP-KOS/events{/privacy}","received_events_url":"https://api.github.com/users/KSP-KOS/received_events","type":"Organization","site_admin":false},"repo":{"id":17217530,"name":"KOS","full_name":"KSP-KOS/KOS","owner":{"login":"KSP-KOS","id":6767371,"avatar_url":"https://avatars.githubusercontent.com/u/6767371?v=3","gravatar_id":"","url":"https://api.github.com/users/KSP-KOS","html_url":"https://github.com/KSP-KOS","followers_url":"https://api.github.com/users/KSP-KOS/followers","following_url":"https://api.github.com/users/KSP-KOS/following{/other_user}","gists_url":"https://api.github.com/users/KSP-KOS/gists{/gist_id}","starred_url":"https://api.github.com/users/KSP-KOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KSP-KOS/subscriptions","organizations_url":"https://api.github.com/users/KSP-KOS/orgs","repos_url":"https://api.github.com/users/KSP-KOS/repos","events_url":"https://api.github.com/users/KSP-KOS/events{/privacy}","received_events_url":"https://api.github.com/users/KSP-KOS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KSP-KOS/KOS","description":"Fully programmable autopilot mod for KSP. Originally By Nivekk","fork":false,"url":"https://api.github.com/repos/KSP-KOS/KOS","forks_url":"https://api.github.com/repos/KSP-KOS/KOS/forks","keys_url":"https://api.github.com/repos/KSP-KOS/KOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KSP-KOS/KOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KSP-KOS/KOS/teams","hooks_url":"https://api.github.com/repos/KSP-KOS/KOS/hooks","issue_events_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/events{/number}","events_url":"https://api.github.com/repos/KSP-KOS/KOS/events","assignees_url":"https://api.github.com/repos/KSP-KOS/KOS/assignees{/user}","branches_url":"https://api.github.com/repos/KSP-KOS/KOS/branches{/branch}","tags_url":"https://api.github.com/repos/KSP-KOS/KOS/tags","blobs_url":"https://api.github.com/repos/KSP-KOS/KOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KSP-KOS/KOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KSP-KOS/KOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/KSP-KOS/KOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KSP-KOS/KOS/statuses/{sha}","languages_url":"https://api.github.com/repos/KSP-KOS/KOS/languages","stargazers_url":"https://api.github.com/repos/KSP-KOS/KOS/stargazers","contributors_url":"https://api.github.com/repos/KSP-KOS/KOS/contributors","subscribers_url":"https://api.github.com/repos/KSP-KOS/KOS/subscribers","subscription_url":"https://api.github.com/repos/KSP-KOS/KOS/subscription","commits_url":"https://api.github.com/repos/KSP-KOS/KOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/KSP-KOS/KOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/KSP-KOS/KOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/KSP-KOS/KOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/KSP-KOS/KOS/contents/{+path}","compare_url":"https://api.github.com/repos/KSP-KOS/KOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KSP-KOS/KOS/merges","archive_url":"https://api.github.com/repos/KSP-KOS/KOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KSP-KOS/KOS/downloads","issues_url":"https://api.github.com/repos/KSP-KOS/KOS/issues{/number}","pulls_url":"https://api.github.com/repos/KSP-KOS/KOS/pulls{/number}","milestones_url":"https://api.github.com/repos/KSP-KOS/KOS/milestones{/number}","notifications_url":"https://api.github.com/repos/KSP-KOS/KOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KSP-KOS/KOS/labels{/name}","releases_url":"https://api.github.com/repos/KSP-KOS/KOS/releases{/id}","created_at":"2014-02-26T16:43:31Z","updated_at":"2015-04-03T15:39:52Z","pushed_at":"2015-04-04T09:21:52Z","git_url":"git://github.com/KSP-KOS/KOS.git","ssh_url":"git@github.com:KSP-KOS/KOS.git","clone_url":"https://github.com/KSP-KOS/KOS.git","svn_url":"https://github.com/KSP-KOS/KOS","homepage":null,"size":29381,"stargazers_count":91,"watchers_count":91,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":50,"mirror_url":null,"open_issues_count":161,"forks":50,"open_issues":161,"watchers":91,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726"},"html":{"href":"https://github.com/KSP-KOS/KOS/pull/726"},"issue":{"href":"https://api.github.com/repos/KSP-KOS/KOS/issues/726"},"comments":{"href":"https://api.github.com/repos/KSP-KOS/KOS/issues/726/comments"},"review_comments":{"href":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726/comments"},"review_comment":{"href":"https://api.github.com/repos/KSP-KOS/KOS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KSP-KOS/KOS/pulls/726/commits"},"statuses":{"href":"https://api.github.com/repos/KSP-KOS/KOS/statuses/16f715fc244e78989669c425ce73bb04b10f032c"}}}}