Author Topic: Nscript  (Read 4468 times)

0 Members and 1 Guest are viewing this topic.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Nscript
« on: October 23, 2010, 06:35:00 pm »
So i just wanted a thread to talk about the scripting engine i wrote for Nightmare, i call it Nscript because of Nightmare script :P Its a very simple scripting language with simple and easy to understand syntax.  For example to create an object:

Code: [Select]
#ActionActor #Global Sound background_loop1 ambiance.wav
#ActionActor specifies the type of the object.  Currently it can only be of type ActionActor (any object ingame) or Trigger (triggers events).
#Global means that this object can be used by all scripts
Sound means that it is a Sound object
background_loop1 is the name of the object
ambiance.wav is the input into creating the object, in this case it tell the object to use the sound file ambiance.wav

then i can do things like

Code: [Select]
background_loop1 play
background_loop1 pause
background_loop1 stop
background_loop1 playLoop

I can also create objects that are visually present in the world

Code: [Select]
#ActionActor StaticImage flashlight flashlight.bmp
creates an Image object with no special properties with the image of a flashlight taken from file flashlight.bmp.  I can then use some special object commands like:

Code: [Select]
flashlight addToWorld 50 50           puts the flashlight into the world at coordinates 50,50
flashlight move 20 20 10               moves the flashlight 20 units to the right and 20 units down in the space of 10 frames

Now this is all fine and dandy, but how do you do those cool things like closing a door when you get close to it?  Well that involves a new type of object called a Trigger object.  Here is how you create one:

Code: [Select]
#Trigger TriggerRect door_close 50 50 80 80
this command creates a TriggerRect object.  This object triggers when the player is within the region defined by 50,50 and 80,80.  For the trigger to activate code, you need an entrance point.

Code: [Select]
If door_close
door_1 close
Sleep

the IF tells the trigger that "when the player comes into your area of 50,50 80,80, start this code right here!".  It then closes the door and goes back to sleep.  Going to sleep just means that the script isnt doing anything.  The only way to wake the script up is for one of its triggers to wake it up and start some code.  So this is our final script example

Code: [Select]
#ActionActor Door door_1 unlocked open 0
#Trigger TriggerRect door_close 50 50 80 80
door_1 addToWorld 50 60
Sleep

If door_close
door_1 close
door_1 lock
Terminate

this script creates a door and a trigger, and when the player walks by the door, the script closes it, locks it, and then stops executing.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Nscript
« Reply #1 on: October 23, 2010, 06:52:42 pm »
Wow looks pretty cool :D so people could make their own games with this engine when you are done with it?
/e

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Nscript
« Reply #2 on: October 23, 2010, 06:54:30 pm »
Possibly, the engine is quite specific to Nightmare right now.  Like commands like TurnFlashlightOff, or GiveFlashlight :P but it could definitely be modified for top down games.  Although horror would definitely be its specialty.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Nscript
« Reply #3 on: October 23, 2010, 06:55:39 pm »
Ah ok sweet :)
/e

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Nscript
« Reply #4 on: October 23, 2010, 06:57:55 pm »
And it cant do things like loops or conditionals, so that makes it a bit more simple.  Its definitely very specific to nightmare ^^

Offline qazz42

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1130
  • Rating: +30/-12
  • hiiiiiiiii
    • View Profile
Re: Nscript
« Reply #5 on: October 23, 2010, 07:06:36 pm »
lol, when I saw this I thought it a nspire scripting language XD

pretty good tho, keep it up :)

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Nscript
« Reply #6 on: October 23, 2010, 07:41:02 pm »
lol, when I saw this I thought it a nspire scripting language XD

pretty good tho, keep it up :)

^this.  ;)

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nscript
« Reply #7 on: October 23, 2010, 07:45:08 pm »
Nice! Someone should port Blinded by the Dark to Greenfoot :D
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Nscript
« Reply #8 on: March 03, 2011, 12:29:30 am »
* Binder News tries to shake the idea of writing a complex scripting engine out of his head
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nscript
« Reply #9 on: March 03, 2011, 12:47:16 am »
Er... necropost? ANyway I wonder what software did that require...
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Nscript
« Reply #10 on: March 03, 2011, 01:05:02 am »
Lol necropost.  It actually required no extra software, as the compiler is written in java directly into my game, and the scripts themselves are just text files.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nscript
« Reply #11 on: March 04, 2011, 01:04:04 am »
Ah ok, well I was wondering more if you ever released that script or something. Also with all the Nspire stuff going on when I see this thread name I always think it's a new TI-Nspire project. :P
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)