
-----------------------------------
DanceMacabre
Mon Apr 17, 2006 6:46 pm

What is True? What is False? I dont get it.
-----------------------------------
What does it mean when something is true in turing? or False? how can I use this to move a character on the screen using charpress?

-----------------------------------
Delos
Mon Apr 17, 2006 7:34 pm


-----------------------------------
I'm afraid you'll have to be a little more explicit in what you're asking.  Explain your task clearly, show us what you have done so far, and if possible indicate the areas you suspect are giving you problems.

As for true/false, I would say they are the same as they are in the real world.  You might be specifically referring to Booleans.  These are binary variables that are either "true" or "false".  For instance:


var a_boolean : boolean
var answer : string

put "Are you awake?"
get answer
if answer = "yes" then
   a_boolean := true
elsif answer = "no" then
   a_boolean := false
end if

if a_boolean then
   put "Hello world!"
else
   put "Wakey wakey!"
end if


Notice a few things: in the final if clause, I needn't have explicitely defined the value of the boolean I was comparing:

if a_boolean then
% equivalent to:
if a_boolean = true then
% similarly:
if not a_boolean then
% equivalent to:
if a_boolean = false then


As for "charpress", no such command exists...there are analogues to it, but again I can't say until you've given us a little more to go on.

-----------------------------------
Cervantes
Mon Apr 17, 2006 7:43 pm


-----------------------------------
In Turing, the only thing that is true is true. The only thing that is false is false. In some other languages, if we need to evaluate a number like 3 (for the purpose of an if statement, for example) to a boolean value, it evaulates to 3. Some languages have 0 evaluate to false when we force it into a boolean, others to true.

I'm not sure what "charpress" is, but I'll assume it's like getch. Using getch, we get a single key from the keyboard. We store it in a variable, called key, for example.

Now, if key = 'w', we want to move forward (WASD keys, here). Say we press the 'w' key on the keyboard. That sets key to 'w'. So instead of having

if key = 'w'

we effectively have

if 'w' = 'w'

Well, it's pretty obvious that 'w' does equal 'w', so this evaluates to true. When the condition given for an if statement is true, we enter the if statement, and execute the code within it. In this case, the code within the if statement would be code to move our player forwards (or up, whatever you choose).

Check out the Edit: Dammit! That's two duel's I've lost today! This one badly.

-----------------------------------
Delos
Tue Apr 18, 2006 1:38 pm


-----------------------------------
9 minutes Minsc!  9 minutes...that's just wrong.  By the way, just saw the screenies of the new syntax highlighting from V3...:shock:.  Looks awsome.

-----------------------------------
Andy
Tue Apr 18, 2006 1:48 pm


-----------------------------------
it's okay, I dont know what true and false are neither
