{"action":"opened","issue":{"url":"https://api.github.com/repos/jpcsupplies/Economy_mod/issues/2","labels_url":"https://api.github.com/repos/jpcsupplies/Economy_mod/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/jpcsupplies/Economy_mod/issues/2/comments","events_url":"https://api.github.com/repos/jpcsupplies/Economy_mod/issues/2/events","html_url":"https://github.com/jpcsupplies/Economy_mod/issues/2","id":102870155,"number":2,"title":"Script needs to be able to read/write the bank balance file","user":{"login":"jpcsupplies","id":13939039,"avatar_url":"https://avatars.githubusercontent.com/u/13939039?v=3","gravatar_id":"","url":"https://api.github.com/users/jpcsupplies","html_url":"https://github.com/jpcsupplies","followers_url":"https://api.github.com/users/jpcsupplies/followers","following_url":"https://api.github.com/users/jpcsupplies/following{/other_user}","gists_url":"https://api.github.com/users/jpcsupplies/gists{/gist_id}","starred_url":"https://api.github.com/users/jpcsupplies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpcsupplies/subscriptions","organizations_url":"https://api.github.com/users/jpcsupplies/orgs","repos_url":"https://api.github.com/users/jpcsupplies/repos","events_url":"https://api.github.com/users/jpcsupplies/events{/privacy}","received_events_url":"https://api.github.com/users/jpcsupplies/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-24T19:14:12Z","updated_at":"2015-08-24T19:14:12Z","closed_at":null,"body":"The script should at least be able to read and write to a bank balance file, at present all my attempts to do so have failed. Most file operation methods appear to be blocked by keen except for:\r\nWrite: \r\nMyAPIGateway.Utilities.WriteFileInLocalStorage(\"bank.txt\", [data structure]));\r\nPaths:\r\nMyAPIGateway.Utilities.ShowMessage(\"path\", togame);\r\nMyAPIGateway.Session.CurrentPath\r\nPath.GetFileNameWithoutExtension(MyAPIGateway.Session.CurrentPath);\r\nstring.Format(\"bank{0}.txt\",Path.GetFileNameWithoutExtension(MyAPIGateway.Session.CurrentPath));\r\n\r\nProposed file logic -\r\nPseudo Code (loading):\r\ncreate an array of each element:(uid, balance, timestamp)\r\ncreate a counter for incrementing array\r\nopen bank.txt for reading\r\n Repeat (if not EOF)\r\n  read line from file, (split it by , )  write data to array element[counter]\r\n(eg 12345,100,1/1/11 12:00)\r\n  increment counter +1\r\n Until end of file\r\nclose bank.txt\r\nnumber of bank balances = counter\r\ncounter = 0\r\n\r\ndo stuff\r\n\r\nPseudo Code (writing):\r\nhaving previously read data into array elements from loading:(uid, balance, timestamp)\r\nif  (have added in new player balance, or updated existing balance in array)\r\nset counter to number of records in array\r\nopen bank.txt for writing\r\n until counter<0 \r\n  take array element [counter], (deliminate elements with ,) write as line to file\r\n  (eg 12345,100,1/1/11 12:00)\r\n  increment counter -1\r\n repeat\r\nclose bank.txt"}}