Log in

View Full Version : Unknown identifier 'WriteIn'



Kobalt888
05-07-2011, 04:52 PM
I was following Coh3n's guide on simba scripting, and when I typed it in for practice just as he did, id get this error;

Unknown identifier 'WriteIn'

And when I copied/pasted it, it compiled fine.
I proofread for any errors and could not find anything.

program PuttingTogetherBasics;


var
Logs: Integer;
Exp: Extended;

const
NUMBER_OF_LOGS = 500;
TREE_TO_CUT = 'Magic';

procedure HowManyLogs;
begin
Logs := 250;
Exp := 195.5;

WriteIn('We have chopped' + IntTostr(logs) +'logs this seesion!';
Wait(500);
WriteIn('We want to chop' + IntToStr(NUMBER_OF_LOGS) +'logs';
Wait(500);
WriteIn('We are chopping' + TREE_TO_CUT +'trees!');
Wait(500);
WriteIn('We have gained' + FloatToStr(Logs * Exp)+'xp this seesion!;);
end;

function WeAreBored: string;
var
s:String;
begin
Result:='What are we going to do now?'
s:='We are very bored chopping all these logs!;
Wait(500);
WriteIn(s);
end;

begin
ClearDebug;
HowManyLogs;
WriteIn(WeAreBored);
end.


And here was the normal one from Coh3n:


program PuttingTogetherBasics;

// Declareing variables globally
var
Logs: Integer;
Exp: Extended;

// Declareing constants
const
NUMBER_OF_LOGS = 500; // Notice the integer
TREE_TO_CUT = 'Magic'; // Notice the string

// Using a procedure
procedure HowManyLogs;
begin
// This is how we ASSIGN a type to a variable; Remember this ;)
Logs := 250; // Notice we can use the variable "Logs" because it's declared globally
Exp := 195.5;

Writeln('We have chopped ' + IntToStr(Logs) + ' logs this session!'); // Notice the '+', this is required if you are going to Writeln a constant or variable
Wait(500); // This is new, but don't worry; this is a simple procedure that waits the given time in milliseconds (1000ms = 1s)
Writeln('We want to chop ' + IntToStr(NUMBER_OF_LOGS) + ' logs.');
Wait(500);
Writeln('We are chopping ' + TREE_TO_CUT + ' trees!');
Wait(500);
Writeln('We have gained ' + FloatToStr(Logs * Exp) + ' xp this session!');
//FloatToStr is used to convert extended values to strings; it works the same as IntToStr
end;

// Using a function
function WeAreBored: string;
var // Declareing variables locally
s: String;
begin
Result := 'What are we going to do now?'; // Notice that "Result" is a string because the function returns a string
s := 'We are very bored chopping all these logs!';
Wait(500);
Writeln(s); // Notice no "IntToStr" because the variable "s" is already a string
end;

begin // Don't forget to put your procedures/functions in the main loop!
ClearDebug; // This procedure just clears the debug box when you click run
HowManyLogs;
Writeln(WeAreBored); // Since WeAreBored returns a string and Writeln() takes a string as its parameters, the function itself can be called
end. //Notice the '.', signalling the end of the script


Any help is appreciated.
-Kobalt

Rich
05-07-2011, 04:55 PM
It's WriteLn, with an L, not I.

Also WriteIn('We have chopped' + IntTostr(logs) +'logs this seesion!';
Wait(500);
WriteIn('We want to chop' + IntToStr(NUMBER_OF_LOGS) +'logs');
Wait(500);
WriteIn('We are chopping' + TREE_TO_CUT +'trees!');
Wait(500);
WriteIn('We have gained' + FloatToStr(Logs * Exp)+'xp this seesion!;);
end;Should beWriteLn('We have chopped' + IntTostr(logs) + ' logs this session!';
Wait(500);
WriteLn('We want to chop' + IntToStr(NUMBER_OF_LOGS) + 'logs');
Wait(500);
WriteLn('We are chopping' + TREE_TO_CUT + ' trees!');
Wait(500);
WriteLn('We have gained' + FloatToStr(Logs * Exp) + 'xp this session!');
end;The extra spacing doesn't matter; it just makes it easier to read.

Kobalt888
05-07-2011, 04:58 PM
Hahah...
Thanks rich :D

Home
05-07-2011, 04:58 PM
Here is the fixed one. Just little mistakes and typos (Remember It's Writeln not WriteIn)
And some other mistakes too.
Compare it to your original.
Too lazy to make big thread about errors.
Sorry :)

program PuttingTogetherBasics;


var
Logs: Integer;
Exp: Extended;

const
NUMBER_OF_LOGS = 500;
TREE_TO_CUT = 'Magic';

procedure HowManyLogs;
begin
Logs := 250;
Exp := 195.5;

Writeln('We have chopped' + IntTostr(logs) +'logs this seesion!');
Wait(500);
Writeln('We want to chop' + IntToStr(NUMBER_OF_LOGS) +'logs');
Wait(500);
Writeln('We are chopping' + TREE_TO_CUT +'trees!');
Wait(500);
Writeln('We have gained' + FloatToStr(Logs * Exp)+'xp this seesion!');
end;

function WeAreBored: string;
var
s:String;
begin
Result:='What are we going to do now?'
s:= 'We are very bored chopping all these logs!';
Wait(500);
Writeln(s);
end;

begin
ClearDebug;
HowManyLogs;
Writeln(WeAreBored);
end.

~Home

Kobalt888
05-07-2011, 05:43 PM
Thanks!

Sex
05-07-2011, 07:38 PM
Also, try changing the report a bit.
Writeln('We have chopped' + IntTostr(logs) +'logs this seesion!');
Wait(500);
Writeln('We want to chop ' + IntToStr(NUMBER_OF_LOGS) + ' logs');
Wait(500);
Writeln('We are chopping ' + TREE_TO_CUT + 'trees!');
Wait(500);
Writeln('We have gained' + FloatToStr(Logs * Exp) + 'xp this session!');