Re: Games and Threads?!

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 28 Sep 2009 11:58:20 -0600

On Sep 27, 2009, at 6:10 PM, Lara O. Delirio wrote:

> I'm doing a paper about NCL, and it is required to do a simple
> game, but I don't think that it is possible to do a interative game
> with the language. My question is if it's really a language to deal
> just with plots, maps and diagrams, or there ir a way to get user's
> input ?
> And the other is: Does NCL gives support to threads?
>
> thank you
>

Hi Lara,

NCL is not really designed as an interactive language; that is,
there's no way to prompt for user input directly from an NCL script.

What most of our users do in this case is wrap a shell script around
the NCL script, prompt for the user input, and then pass the user
input to the NCL script via command line options:

Here's a very simple example:

Shell script:

#!/bin/sh

echo -n "Enter a floating point value: "
read x
echo -n "Enter a title (no quotes): "
read title

echo "x = $x"
echo "title = $title"

eval ncl x=$x \'title=\"$title\"\' your_script.ncl

And here's what a simple "your_script.ncl" would look like, that
accesses these variables:

begin
; Instead of exiting, you could also provide a default value for 'x'.
   if(.not.isvar("x")) then
     print("No value provided for 'x'. Exiting")
     exit
   end if

   if(.not.isvar("title")) then
     print("No title provided. Exiting.")
     exit
   end if

   print("x = " + x)
   print("title = '" + title + "'")

   y = x * 100.
   print("y = x*100 = " + y)

end

NCL does not support threads, sorry.

--Mary

> --
> Lara O. Delirio
> Percomp - Embedded
> Graduação Ciência da Computação
> Universidade Federal de Campina Grande
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 28 2009 - 11:58:20 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 29 2009 - 10:11:39 MDT