M30W Programming Forum

M30W is a text-based version of Scratch

You are not logged in.

Announcement

This is the development forum for M30W (also known as Emerald, do not confuse with Emerald Programming Language).
Our Non-development forums are available here

M30W(Emerald) 0.3 is out! (Download) Requires Python 2.6 or higher.
Opal 0.3(A better command line M30W) is out! (Download) Requires Python 2.6 or higher.
M30W 0.3.6 GUI barebones (Download) Requires Python 2.6 or higher and wxPython
Diamond-2 RED2 GUI Barebones (Fancy M30W editor) s out! (Download) Requires .NET Framework 3.5 or higher, does not require Python
M30W++ GUI barebones (Java M30W) Alpha 1 is out! (Download) Requires Java.


Gershmer.net, our hosting, will close in February 2011. We have not fully decided what to do with our hosting after that, but we will tell you when we decide.

Adverts

Adverts

#1 2010-01-15 07:39:27

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Denoting variables in print and ask commands

Why type
print answer \yes,

if you can type
print [answer]

or
print <answer>

?
From the m3ow side, this could be done by a loop which goes through contents of brackets, or a RegExp matching everything inside. Or, if it works, simply make a replace, like in c#:
"Hello, are you <randomName>".Replace("<randomName>",names[random.next(0,names.Length]).

Get what I mean?


http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

2010-01-15 07:39:27

AdBot
Advertisements

#2 2010-01-15 19:01:36

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Denoting variables in print and ask commands

filo5 wrote:

Why type
print answer \yes,

if you can type
print [answer]

or
print <answer>

?
From the m3ow side, this could be done by a loop which goes through contents of brackets, or a RegExp matching everything inside. Or, if it works, simply make a replace, like in c#:
"Hello, are you <randomName>".Replace("<randomName>",names[random.next(0,names.Length]).

Get what I mean?

I like <answer>
But im totaly lost with all the programming stuff, ill probably understand it eventualy.


I am A M30Wr.
I always get the last word.

Offline

 

#3 2010-01-15 23:41:45

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: Denoting variables in print and ask commands

I like that idea. Just make sure that is doesn't end up like LISP (Lots of Insignificant Silly Parentheses).


Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

#4 2010-01-16 08:57:17

filo5
Diamond Creator
From: Catford, London, UK
Registered: 2009-10-08
Posts: 253
Website

Re: Denoting variables in print and ask commands

No, it would end up like:

Code:

ask "What's your name?", <answerName>
ask "How old are you, <answerName>?", <answerAge>
ask "So... What's your favourite colour?", <answerColour>
ask "Tell me, do you like M3OW?", <answerLike>
var LikeOrNot
if <answerLike> = "yes"
{
  set <LikeOrNot> to "like"
}
else
{
  set <LikeOrNot> to "don't like"
}
print "So, <answerName>, you're <answerAge> years old,"
print "Your favourite colour is <answerColour> and you <LikeOrNot> this program"
print "------"
print "Thank you!"

http://img8.imageshack.us/img8/429/filo5newsigsg1planf.png

Offline

 

#5 2010-01-16 09:10:22

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: Denoting variables in print and ask commands

Perfect. ;)


Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

#6 2010-01-16 17:10:35

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Denoting variables in print and ask commands

filo5 wrote:

No, it would end up like:

Code:

ask "What's your name?", <answerName>
ask "How old are you, <answerName>?", <answerAge>
ask "So... What's your favourite colour?", <answerColour>
ask "Tell me, do you like M3OW?", <answerLike>
var LikeOrNot
if <answerLike> = "yes"
{
  set <LikeOrNot> to "like"
}
else
{
  set <LikeOrNot> to "don't like"
}
print "So, <answerName>, you're <answerAge> years old,"
print "Your favourite colour is <answerColour> and you <LikeOrNot> this program"
print "------"
print "Thank you!"

Very easy to understand and simple to do.

floppygunk wrote:

Perfect. ;)

I totaly agree!


I am A M30Wr.
I always get the last word.

Offline

 

Adverts

Board footer

Powered by FluxBB
Hosted by PunBB-Hosting