turtle-gambit icon indicating copy to clipboard operation
turtle-gambit copied to clipboard

will you make a tutorial on how to use this amazing piece of code?

Open simonsterer061 opened this issue 4 years ago • 43 comments

will you make a tutorial on how to use this amazing piece of code?

simonsterer061 avatar Dec 08 '20 04:12 simonsterer061

I can give you some pointers, though I am completely unfamiliar with NodeJS, JavaScript and typescript, so I can't help you on the issues you will face. Hopefully someone else with an understanding of JavaScript can provide some insight. This "tutorial" will be mostly aimed at Linux as that's what I use, but I will try to include Windows instructions as well.

Prerequisites

First you need NodeJS, yarn and typescript installed on your system. You will also likely need chrome / chromium, though any web browser might be sufficient - I haven't tested without chromium installed. If you don't want to install npm packages globally, omit the -g flag from the commands!

For Ubuntu and derivatives

Open me!

You will need to add the yarn repository to your sources. The yarn package included by default in the Ubuntu repos is an outdated version called "cmdtest."

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

The following installs yarn, NodeJS and NPM (the latter two are requirements of yarn, so they are installed as well. If you already have NodeJS and NPM, use the --no-install-recommends flag to prevent yarn from installing NodeJS and NPM.)

sudo apt update sudo apt install yarn

Now you need to install typescript.

sudo npm install -g typescript sudo npm install -g puppeteer-core

For Fedora, CentOS and RHEL

Open me!

You can install yarn through yum, just add the repo and install.

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo

If you're on CentOS or RHEL, use the following.

sudo yum install yarn

If you're on Fedora, use the following.

sudo dnf install yarn

These should install yarn NPM and NodeJS, but I'm not entirely sure. If you use RHEL systems you should be able to figure out how to install NodeJS yourself, they might be in the yum repo as well - in which case just replace yarn with NodeJS.

Now you need to install typescript and puppeteer core.

sudo npm install -g typescript sudo npm install -g puppeteer-core

For Windows / macOS

Open me!

You can use the official installers to download NodeJS and NPM. You should use the long term support version, but you can try the latest as well.

Afterwards, open a cmd prompt or terminal and put in the following. You may need to preface with sudo on macOS, and run with admin privileges on Windows.

npm install -g yarn npm install -g typescript npm install -g puppeteer-core

Try the above without the -g flag if it fails, I'm unsure if you need to specify global installation on macOS or Windows.


Actually using the program

Now that these are installed, you need to clone this repository. You can either do this by downloading the zip and extracting it from the main page or by using git:

git clone https://github.com/ottomated/turtle-gambit

Place the repo wherever you wish, and cd into the directory.

cd /path/to/cloned/repo/

Now run the following.

yarn yarn dev

And you're golden. It should launch a web browser with the following link http://localhost:3000 or http://127.0.0.1:3000, which is a link to the program running on your computer. Theoretically, you can now open computer craft, run the startup.lua as Ottomated did in his video (paste turtle/startup.lua onto a pastebin and download it onto a floppy in CC) and it should work!


EDIT: My issue was to do with missing dependencies. I now get a different but smaller error related to puppeteer-core and Carlo. I've put that in at the bottom and added the additional dependencies to install above.

So, I actually haven't gotten it to work. As I said, I'm entirely unfamiliar with NodeJS, just giving you instructions in case you want to figure it out on your own or someone else familiar with NodeJS is kind enough to come along and debug. For those interested, my log is below:

Old Error log

yarn run v1.22.5 $ tsc && node lib/index.js (node:6115) UnhandledPromiseRejectionWarning: Error: net::ERR_CONNECTION_REFUSED at http://localhost:3000/ at navigate (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/FrameManager.js:101:37) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async FrameManager.navigateFrame (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/FrameManager.js:75:17) at async Frame.goto (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/FrameManager.js:385:12) at async Page.goto (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/Page.js:662:12) at async Window.load (/home/rick/Documents/turtle-gambit/node_modules/carlo/lib/carlo.js:347:5) -- ASYNC -- at Frame. (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/helper.js:108:27) at Page.goto (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/Page.js:662:49) at Page. (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/helper.js:109:23) at Window.load (/home/rick/Documents/turtle-gambit/node_modules/carlo/lib/carlo.js:347:22) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:6115) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6115) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

New Error log

(node:29495) UnhandledPromiseRejectionWarning: Error: Protocol error (Browser.grantPermissions): Unknown permission type: clipboardRead at /home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/Connection.js:74:56 at new Promise () at Connection.send (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/Connection.js:73:12) at BrowserContext.overridePermissions (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/Browser.js:349:28) at BrowserContext. (/home/rick/Documents/turtle-gambit/node_modules/carlo/node_modules/puppeteer-core/lib/helper.js:109:23) at App.init_ (/home/rick/Documents/turtle-gambit/node_modules/carlo/lib/carlo.js:62:11) at Object.launch (/home/rick/Documents/turtle-gambit/node_modules/carlo/lib/carlo.js:627:15) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:29495) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:29495) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Rick1029 avatar Dec 24 '20 07:12 Rick1029

So, I actually haven't gotten it to work. As I said, I'm entirely unfamiliar with NodeJS, just giving you instructions in case you want to figure it out on your own or someone else familiar with NodeJS is kind enough to come along and debug. For those interested, my log is below:

You need to navigate to the frontend folder and run yarn + yarn dev or build it and serve it via a webserver like apache/nginx

The error you are getting is it can't connect to the frontend (frontend isn't running the websocket, that's handled by another process, really they two could be built together)

derrickmehaffy avatar Dec 26 '20 00:12 derrickmehaffy

I've done everything here but I keep getting the error "TypeError: window.refreshData is not a function". I can't seem to find the fix to this. Can anyone help me? Thank you.

Zephyrsc avatar Dec 29 '20 08:12 Zephyrsc

What system are you running and what version of yarn and NodeJS did you install? (Check with node --version and yarn --version)

Rick1029 avatar Dec 29 '20 08:12 Rick1029

I have the same problem. Im using Windows 10 2004 Build 19041.685, Node v14.15.0 and Yarn 1.22.10

ixhbinphoenix avatar Dec 29 '20 20:12 ixhbinphoenix

I have also checked if its running on Node v12.20.0 Same Error

ixhbinphoenix avatar Dec 29 '20 20:12 ixhbinphoenix

What system are you running and what version of yarn and NodeJS did you install? (Check with node --version and yarn --version)

I'm using Node v14.15.3 and Yarn v1.22.10

ill try using Node v15.5.0 and see if it fixes the issue

Zephyrsc avatar Dec 29 '20 20:12 Zephyrsc

I also tried using 15.5.0 now and it shows the same error for me

ixhbinphoenix avatar Dec 29 '20 20:12 ixhbinphoenix

What system are you running and what version of yarn and NodeJS did you install? (Check with node --version and yarn --version)

I'm using Node v14.15.3 and Yarn v1.22.10

ill try using Node v15.5.0 and see if it fixes the issue

Node v15.5.0 is not working either

Zephyrsc avatar Dec 29 '20 20:12 Zephyrsc

I have some experience in JS and TS but no experience in React or Next.js. From what i can see there is no function called window.refreshData(). The custom window the frontend uses has refreshData() but it's just void and not a function.

ixhbinphoenix avatar Dec 29 '20 21:12 ixhbinphoenix

Screenshot (67) if you needed to see the exact error here it is.

Zephyrsc avatar Dec 29 '20 22:12 Zephyrsc

image

I found this block of code in the main .\turtle-gambit-master\src\index.ts (L34-37) that exposes the a refreshData() function on the web app. This might be the function that is trying to be invoked in .\turtle-gambit-master\frontend\pages\index.ts

Myoozik avatar Dec 30 '20 15:12 Myoozik

We should probably open a new issue for this, just to keep things organized for the future - since the maintainer won't. Anyone up to forking and actually implementing edits?

Rick1029 avatar Dec 30 '20 15:12 Rick1029

Yeah, imma make a new Issue, maybe someone will find a fix

AuroraBee avatar Dec 30 '20 15:12 AuroraBee

@Rick1029 I have an open fork that I can take some PRs on, though undecided if I want to act as a core maintainer. If someone else wants to take maintainership it might be better.

https://github.com/derrickmehaffy/turtle-gambit

derrickmehaffy avatar Dec 30 '20 16:12 derrickmehaffy

Yeah, imma make a new Issue, maybe someone will find a fix

New issue for the above bug: https://github.com/ottomated/turtle-gambit/issues/7

derrickmehaffy avatar Dec 30 '20 16:12 derrickmehaffy

See my comment in issue #7 for a fix.

Myoozik avatar Dec 31 '20 06:12 Myoozik

Another part you probably want to do is: Get an empty world.json file. check #8 for this, i actually have no idea how, i only get a matrix error, lemme see if i can reproduce problem.

AuroraBee avatar Dec 31 '20 14:12 AuroraBee

We definetely need some kind of clear info. I tried setting it up myself, but I faced two errors:

First one being the localhost refusing connecction on port 3000. I opened the port on my local network, not sure what is causing the error (more than probably a failed build) The second error saying that a module called "daterial-ui/core/Typography" cannot be found. However, trying to manually install it using yarn or npm does not work at all. Google does not return anything about this module.

XLuma avatar Jan 06 '21 01:01 XLuma

you need to launch the frontend first, go into the /frontend/ folder and run yarn, and then yarn dev. only then go into the root and run yarn dev.

AuroraBee avatar Jan 06 '21 10:01 AuroraBee

you need to launch the frontend first, go into the /frontend/ folder and run yarn, and then yarn dev. only then go into the root and run yarn dev.

I actually found out all errors were related because I had the turtle-gambit on my secondary drive rather than the C: drive, moving it actually fixed all of my issues

XLuma avatar Jan 07 '21 18:01 XLuma

weird, i actually have everything on my D:\ drive... and i am using windows aswell, so i do have a C:
but its good that your error is fixed :)

AuroraBee avatar Jan 08 '21 08:01 AuroraBee

image

I found this block of code in the main .\turtle-gambit-master\src\index.ts (L34-37) that exposes the a refreshData() function on the web app. This might be the function that is trying to be invoked in .\turtle-gambit-master\frontend\pages\index.ts

any luck on fixing this? this is the last error I have atm

Merith-TK avatar Jan 10 '21 19:01 Merith-TK

image I found this block of code in the main .\turtle-gambit-master\src\index.ts (L34-37) that exposes the a refreshData() function on the web app. This might be the function that is trying to be invoked in .\turtle-gambit-master\frontend\pages\index.ts

any luck on fixing this? this is the last error I have atm

Look at the closed issues. There's already one that was made for this error

Zephyrsc avatar Jan 10 '21 22:01 Zephyrsc

See my comment in issue #7 for a fix.

Myoozik avatar Jan 11 '21 02:01 Myoozik

so I have no idea how any of this works and am wondering if someone could help me to get this program started #20

MatthewBoi123 avatar Feb 09 '21 20:02 MatthewBoi123

Install the turtle Lua files on the turtle, set it up like how it was setup in the video.

On your pc, install yarn, npm, and NodeJS, this is what I know for the moment, don't have proper tools setup with my right now, but one of the folders you need to run with NodeJS, check documentation for NodeJS, yarn, and npm to find out more.

On Tue, Feb 9, 2021, 12:10 PM MatthewBoi123 [email protected] wrote:

so I have no idea how any of this works and am wondering if someone could help me to get this program started #20 https://github.com/ottomated/turtle-gambit/issues/20

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776211461, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPQOXVRZSVNSPZCPLAVT7DS6GJCNANCNFSM4URNE3JQ .

Merith-TK avatar Feb 09 '21 20:02 Merith-TK

uhh, man thats quite a bit ago, but you need to run yarn dev in the /frontend/ and root "/" folder, then your side should work. the turtle... you need to open a ngrok tunnel to your localhost on a certain port (maybe 5959, not sure) and edit some line past 100 from "ottomated smth smth" to the ngrok link, which leads to your computers 127.0.0.1, if you are running the turtle on your own computer, you might aswell jut ignore ngrok and put "127.0.0.1" in there instead.

greetings, Cubic Person who is slightly annoyed at having forgotten to turn email notifications off.

Am Di., 9. Feb. 2021 um 21:34 Uhr schrieb Merith [email protected]:

Install the turtle Lua files on the turtle, set it up like how it was setup in the video.

On your pc, install yarn, npm, and NodeJS, this is what I know for the moment, don't have proper tools setup with my right now, but one of the folders you need to run with NodeJS, check documentation for NodeJS, yarn, and npm to find out more.

On Tue, Feb 9, 2021, 12:10 PM MatthewBoi123 [email protected] wrote:

so I have no idea how any of this works and am wondering if someone could help me to get this program started #20 https://github.com/ottomated/turtle-gambit/issues/20

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776211461 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACPQOXVRZSVNSPZCPLAVT7DS6GJCNANCNFSM4URNE3JQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776225188, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQHNO5DUROLE55YLRTFBMG3S6GL4RANCNFSM4URNE3JQ .

AuroraBee avatar Feb 10 '21 07:02 AuroraBee

I've tested this, it needs an http server in between the front-end, and the turtle, so you need to use something like ngrok anyways... Idfk why, it just is.

My setup may have gone totally fekked during setup so I may be wrong, but it's what I had to do for it...

On Tue, Feb 9, 2021, 11:50 PM Cuboid404 [email protected] wrote:

uhh, man thats quite a bit ago, but you need to run yarn dev in the /frontend/ and root "/" folder, then your side should work. the turtle... you need to open a ngrok tunnel to your localhost on a certain port (maybe 5959, not sure) and edit some line past 100 from "ottomated smth smth" to the ngrok link, which leads to your computers 127.0.0.1, if you are running the turtle on your own computer, you might aswell jut ignore ngrok and put "127.0.0.1" in there instead.

greetings, Cubic Person who is slightly annoyed at having forgotten to turn email notifications off.

Am Di., 9. Feb. 2021 um 21:34 Uhr schrieb Merith <[email protected]

:

Install the turtle Lua files on the turtle, set it up like how it was setup in the video.

On your pc, install yarn, npm, and NodeJS, this is what I know for the moment, don't have proper tools setup with my right now, but one of the folders you need to run with NodeJS, check documentation for NodeJS, yarn, and npm to find out more.

On Tue, Feb 9, 2021, 12:10 PM MatthewBoi123 [email protected] wrote:

so I have no idea how any of this works and am wondering if someone could help me to get this program started #20 https://github.com/ottomated/turtle-gambit/issues/20

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776211461

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ACPQOXVRZSVNSPZCPLAVT7DS6GJCNANCNFSM4URNE3JQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776225188 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AQHNO5DUROLE55YLRTFBMG3S6GL4RANCNFSM4URNE3JQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776514969, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPQOXXFIQHRVRU3VTXECW3S6I3F7ANCNFSM4URNE3JQ .

Merith-TK avatar Feb 10 '21 07:02 Merith-TK

Awesome, thanks!

/ this message was automatically generated by gmail.

Am Mi., 10. Feb. 2021 um 08:53 Uhr schrieb Merith <[email protected]

:

I've tested this, it needs an http server in between the front-end, and the turtle, so you need to use something like ngrok anyways... Idfk why, it just is.

My setup may have gone totally fekked during setup so I may be wrong, but it's what I had to do for it...

On Tue, Feb 9, 2021, 11:50 PM Cuboid404 [email protected] wrote:

uhh, man thats quite a bit ago, but you need to run yarn dev in the /frontend/ and root "/" folder, then your side should work. the turtle... you need to open a ngrok tunnel to your localhost on a certain port (maybe 5959, not sure) and edit some line past 100 from "ottomated smth smth" to the ngrok link, which leads to your computers 127.0.0.1, if you are running the turtle on your own computer, you might aswell jut ignore ngrok and put "127.0.0.1" in there instead.

greetings, Cubic Person who is slightly annoyed at having forgotten to turn email notifications off.

Am Di., 9. Feb. 2021 um 21:34 Uhr schrieb Merith < [email protected]

:

Install the turtle Lua files on the turtle, set it up like how it was setup in the video.

On your pc, install yarn, npm, and NodeJS, this is what I know for the moment, don't have proper tools setup with my right now, but one of the folders you need to run with NodeJS, check documentation for NodeJS, yarn, and npm to find out more.

On Tue, Feb 9, 2021, 12:10 PM MatthewBoi123 [email protected] wrote:

so I have no idea how any of this works and am wondering if someone could help me to get this program started #20 https://github.com/ottomated/turtle-gambit/issues/20

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776211461

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ACPQOXVRZSVNSPZCPLAVT7DS6GJCNANCNFSM4URNE3JQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776225188

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AQHNO5DUROLE55YLRTFBMG3S6GL4RANCNFSM4URNE3JQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776514969 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACPQOXXFIQHRVRU3VTXECW3S6I3F7ANCNFSM4URNE3JQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ottomated/turtle-gambit/issues/3#issuecomment-776516332, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQHNO5AT7KDQXDWYCI6BPWDS6I3RHANCNFSM4URNE3JQ .

AuroraBee avatar Feb 10 '21 07:02 AuroraBee