Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Dylan velez · Oct 18, 2013 at 02:14 AM · ingamegeneral programming

in-game programming console(how to?)

hello guys.

I wanted to ask if you can point me in the right direction or help me in the making of an ingame programming console. i'll be more specific:

i'm working on a project for my university to teach programming in an interactive way so i came up with the idea of making a game where you could program your character, it will basically be a 2D side scroller game where there's a little guy walking and solving puzzles or doing some stuff, the game will offer a variety of levels where each level is about a programming subject(ie. variables, control flow, loops, etc) and each level will have a console where the user can insert some instructions and it will be parsed and if they are correct then the character will be programmed to do whatever the user said to.

for example in the level of variables it would be something like

Objective : make your character remember your name..

then the user would type in the console var name = 'myname' and click run and the character would say the name in the variable..

in control flow would be like

Objective: there are obstacles in the lvl , if you encounter them make your player run away

so the user would tipe

 if(obstacleIsHigh)
     jump;
 else if(obstacleIsVeryHigh)
     runAway;

. . .

this is something like the thing i want to achieve, it's from codecademy.com alt text

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Oct 18, 2013 at 03:16 AM 0
Share

Javascript has an "eval" method, but other than that this is a duplicate question, just do a google search :)

avatar image Dylan velez · Oct 18, 2013 at 03:30 AM 0
Share

i've been searching a lot but i cannot seem to find anything, could you link me to the duplicate?

avatar image DylanW · Oct 18, 2013 at 04:42 AM 0
Share

This is an excellent idea!

avatar image Benproductions1 · Oct 18, 2013 at 07:19 AM 0
Share

@Dylan_velez
http://answers.unity3d.com/questions/7885/interpret-unityscript-at-runtime.html
Thats the only one I could find within 5 $$anonymous$$utes, however I remember there being a question that asked the exact same thing before... I just can't find it ;)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Hoeloe · Oct 18, 2013 at 06:17 AM

Well, what you need is some kind of programming language to use in the console, and some kind of parser & compiler to convert the script to actual instructions. For this kind of simple console language, designing your own language and writing a compiler for it shouldn't be a huge undertaking, but you may be better off finding a pre-made scripting implementation of something like Lua, and using that.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Oct 18, 2013 at 07:11 AM 0
Share

You can actually compile JScript and C# at runtime using the CodeDomProvider from .NET
Unfortunately the compiler used is not included when you build so some workarounds are required

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Scene saving 3 Answers

How to prevent MoveToward from reducing the speed? 0 Answers

CS8025 error 1 Answer

Can you deploy to mobile with Unity 4.3 free? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges