How To See Other Games' Code (current info posted in OP and Post 146 on 6/18/19)

Yeah I’ve skimmed this thread and obviously there have been some changes over the years, so I guess could anyone post a quick, current how-to guide on viewing code on purchased CoGs/HGs?

Through the websore, right? Because if it’s another platform, I too would be very interested to hear it.

Yeah, exactly. I am 100 percent willing and able to buy some games on the webstore if it means I can learn and look at the code.

No problem-o! I’m taking screenshots as we speak.

I think I might also wiki the first post to include them for future reference. :thinking:

1 Like

I don’t have screenshots to visualize it, but I’ve attempted to explain how to do it in the webstore here:

Finishing a how-to with screenshots will help a lot more people and will probably be more easy to understand and follow, so please finish your guide for that, impeccably-stressed!

There’s also a way to extract the app.asar file of the more modern CoG/HG games bought on Steam (there’s a different, easier method for older games like Tin Star), but it needs a bit of set up and I’d need to find the original post where that was explained to attempt to describe it in more simple words. As not every game is released on Steam in the first place though, the webstore is the way easier method, especially if you can buy in the webstore directly and don’t have to go the purchase transfer route first.

1 Like

@Eric_Moser Here ya go!


First thing you have to do is choose the game whose code you want to see!

I’m using Community College Hero 2 because I love staring at Hedonist’s beautiful nose as I work.

Click on Play Online.

You should arrive at this screen:

If you want to look at a full game's code, make certain that you are logged into the account that you bought the game with. If you are logged in, you will be able to see the option to sign out on the right-hand corner of the screen.

Note: You don’t have to be logged in to see a game’s code, but you will be blocked from seeing scenes you haven’t paid for. I don’t know how, please don’t ask me why, I’m assuming it’s actual wizardry. Ask Gandalf.

Next. Highlight the jumble of text after the game's name (excluding the forward slash).

Delete that sucker.

In its place, write the following: scenes/startup.txt

Then, of course, hit enter on that bad boy.

You should now arrive at this screen:

People experienced in code-diving or even game writers will recognize this screen, but for the newbies, this is the file that lists the game scenes and its stats (and achievement, if it has any).

Those $ in front of those scenes means that they’re locked behind a paywall. If you’re not logged into an account where you’ve bought this game then you will only be able to follow the next steps with the demo scenes (i.e. the ones without the $ in front of them).

Here's how you look at a specific scene:

I like to just copy & paste from the file itself, like so.

Highlight the startup in the url.

And replace it with the name of the scene whose file you wish to see.

Again, I just copy & paste it, but you do you. If your fingers need the workout, go for it!

Press enter and you'll be rewarded with the sweet, sweet code, oh yeah baby–


And that’s how you look at a game’s code!

Edit: I’ll be adding this to the first post for posterity’s sake. Be sure to link the first post instead if anybody asks you how you do that nifty code-diving thing they’ve been hearing around the water cooler or whatever, :stuck_out_tongue_winking_eye:

30 Likes

Okay that was as easy as I was hoping it was! Thanks for making it crystal clear.(and I might suggest adding the update to the title with today’s date so people see there is current info here, seeing as how the post is 6 years old)

4 Likes

Done and done!

Also sidenote least for those who purchase on google play when you click the upper corner while in the app/game where you look at achievements click on about instead where it will open the browser and take you to credits click on the url and it should be:

Ex: https://www.choiceofgames.com/user-contributed/community-college-hero/credits.html
Replace credits.html with scenes/startup.txt like so

Ex: https://www.choiceofgames.com/user-contributed/community-college-hero/scenes/startup.txt
I haven’t seen a way to get past the block, just briefly looking at it, but for me just seeing the startup.txt helped a lot when i first started learning to code but you can restore purchases to your CoG account from the apple/google store and log in via browser.

Sorry if this doesnt make sense im running on very little sleep right now with no caffeine

2 Likes

It’s ok, it makes total sense!

The reason there’s a block is because you haven’t purchased the game. There’s no way around that, as far as I know, except to buy it.

And yeah, the rest of your explanation is pretty much what I explained above, but thanks for including the links! I think that’ll help mobile users a lot in seeing what I’m talking about instead of trying to blow up my pics and being all—

image

mobile users @ me after my explanation

5 Likes

:joy_cat::joy_cat: i will admit that was pretty much me when i was reading your reply above :joy_cat::joy_cat:

When i meant the block i meant when the user leaves the app/actual game to open the browser the block is there even if they purchased it which can be fixed by logging in to their CoG account and restoring/linking their googleplay/apple purchases

  • I havent linked my stuff since theyre different emails but i plan on rebuying all my games with my email account that is connected to this account. Convoluted but im wierd and hey its my way of supporting these amazing writers :joy_cat: -
2 Likes

Yeah, that’s what I meant too. The block is a purchase (?) block. Unless you’re logged into an account that’s connected to a purchase—well, you already know, lol.

oh worm? That’s what I’m doing with Steam! Just throwing all my love cash at authors.

1 Like

Ok, so I tried to follow @CJW’s method of looking at WIP games’ code and uhhhhhhhhhhhhhhh…

W e l l. . .

Um…I’m just gonna let you all judge…?


The following tutorial can be done on any browser. I did it in both Chrome and Firefox, but I’m pretty sure you can do it in any browser, like…

oh my god i dont know any other browsers

Ahem.

How to look at a WIP game's code on Dashingdon (Browser Only)

Go to the WIP whose code you want to look at:

I’ll be using Wayhaven Chronicles as an example because why not, fren?

Chrome:

Firefox:

IGNORE MY BOOKMARKS HISSSSSSS

Right-click and go down to Inspect

On Firefox, this is known as Inspect Element:

Depending on what your settings are, your inspector will appear in different places. Personally, I prefer having the inspector in a different window:

Chrome:

image

Firefox:

image

But you do you, frendo. I believe in you :heart:

Now you just have to enter the console!

Chrome:

Firefox:

Again, the screenshots above are if you have the inspector open as a separate window.

And now here's the tricky part. In your console, manually type in (yeah, I know, there's no copypasta-ing—so sad) allScenes["startup"].lines.join.("")no, I have no idea what it means either, just do it.

Chrome:

Firefox:

No, as far as I know, there’s no way to clear your console history on Firefox like in Chrome, but uh…if you’ve made it this far…well…this is gonna be the least of your worries, frendo. :eyes:

And then you hit enter and all hell breaks loose:

Oh boy.

O h   b o y

From here you can copy and paste the whole thing if you want, but like...why tho?

You can paste it onto a separate program, like Notepad++ or even CSIDE, but lemme tell you frendo, it's. not. worth. it.

CSIDE:

Notepad++ (please note how tiny the scrollbar is):

also pls forgive and ignore my CK2 files, i like to cheat a lot and at one point my ruler went off to fight a bear that i tried to recruit to court but it was automatically killed after the encounter and i was trying to see if i could revive it because who doesn’t want a bear courtier???

Anyway, if you have patience, you can indent it to something resembling ChoiceScript and perhaps learn some coding along the way but if I were you I would just watch paint dry—

Oh yeah, and also there’s n’s everywhere???

? ? ?


EDIT:
It’s because when we went into SuperHacker mode, we wrote allScenes["startup"].lines.join("n") and for some reason the n puts in…n’s…everywhere???

Anyway, don’t do that. Stop. Don’t. Just leave the "" undefined, mkay? Don’t do what I did. Learn from my mistakes, fren.


Anyway, I tried. :woman_shrugging:

Edit: I FIGURED OUT WHY THERE WERE SO MANY N'S

Anyway, I hope you all enjoyed witnessing my descent into madness! :kissing_heart:

11 Likes

About extracting the code on Steam:

For starters, you will need to locate the games installation folder. By default the path should look somewhat like this:

Program Files\Steam\SteamApps\common\insertgamename

Installation path

Older games like Tin Star will have simpler folder contents than newer ones. To extract the code of these older games, we will basically extracting the gamename.exe file to view its contents. You will need to have 7-zip installed. I do not know if this works with other extraction tools as well, it doesn’t work with WinRAR for me.

Right-click the gamename.exe, go to 7-zip, then “Extract to gamename\”.

Right-click the exe

This will create a new folder with all the contents of the .exe file. In there is a folder “scenes” which holds all the .txt files with the game’s code. I’d recommend opening them in Notepad++ if you’ve got that installed.

Scenes folder

About newer games:

idonotlikeusernames has linked two methods to extract a game’s code earlier in this thread and you can find more detailed explanation to the nodejs method in a reply to that post:

This method will ultimately also result in a new folder being created where all the files have been extracted to and you’ll find the game’s code again in the folder “scenes”.

5 Likes

Is there a way to view the stats screen?

Instead of writting scenes/startup.txt, use scenes/choicescript_stats.txt

You can see the directory with all scenes of the game by adding scenes at the end of the link

That’s really clear info, thanks! Anyways just wondering how do you make sure you’re logged in? Is it the google play account etc that you bought the game on? Becuz I don’t seem to see any log in button on CoG main page

To see a game's code online, you need to have bought it from the CoG webstore, aka, this thing:

To purchase it, you hit the *Play Online* button,

and you will be transferred to the game page. From there you can purchase it.


But Rose! What if I didn’t by the game from the webstore? Will I have to buy it twice? :thinking:

Nope!

CoG is very generous, and you can send them an email to have your purchases from other platforms be transferred to the CoG webstore. This way, you can access a game online as though you bought it there yourself. The steps to doing so are detailed below:

Step 1: You need to email support@choiceofgames.com and provide the following information:

  • The email address you want it associated with
    • No, it doesn’t have to be the same email you use to log into the forum, it’s whatever email you want it to be associated with.
  • Receipts or other proof of purchase for the games

For Google Play, you can find receipts using the steps below:
  • If you didn’t delete them, you might still have your receipts in your inbox

or

  1. Go to payments.google.com while signed into your Google account
  2. Find “Other purchase activity”
  3. Click on “View Purchases”
  4. Select an order to see your receipt
    • Any games you purchased through Google Play should show up there. Chrome Webstore purchases will be there too.
  5. Take a screenshot of the receipt and attach it to the email you send to CoG

For the Apple App Store, you can find receipts using the steps below:
  1. On your device, open the App Store
  2. Select the profile icon in the top right
  3. Select your name, you may need to use Touch ID or enter your passcode to authenticate.
  4. Select Purchase History
  5. Find and select the purchase you want to see the receipt
    • For purchases older than 90 days, make sure you’re on the correct month and year that you purchased it as the App Store shows your most recent purchases first, so you may not see your receipt at fire
  6. Take a screenshot of the receipt and attach it to the email you send to CoG

For Steam, you can find receipts using the steps below:
  1. Open Steam
  2. Click your name in the upper right hand corner
  3. Select Account Details.
  4. Under Store and Purchase History click the link to View Purchase History
  5. Find the purchase you want and click on it to see the receipt
  6. Take a screenshot of the receipt and attach it to the email you send to CoG

For the Amazon App Store, you can find receipts using the steps below:
  1. Go to Your Orders
  2. Click View Order Details next to the order.
  3. Search through your orders until you find the order you want
  4. Click on Order Details to see the receipt
  5. Take a screenshot of the receipt and attach it to the email you send to CoG

And that should be it! In a day or two they’ll send their reply and you just log into the CoG webstore and boom! You got the game, lol.

If you're logged in, you'll see your email and the `logout` option below:

And the restore purchases option essentially works as a longform login:

image

2 Likes

Does it have to be pc? Cuz i click on it on the buy it now on phone and it redirects me to a playstore page

Nope, you can see the codes in phone too. How about try to search the game in browser instead?