SRL Archive - General

Need help with this, if you can please


Blue90

2011-11-05 17:40:12

Hello, as you may know im a damn noobie on this great community, and just like most users im from rsbuddy. I decided to quit my old ways, and stop leeching off others. This is why I am here in the programming section trying to get some help with this, granted I am a beginner, I still want to provide some good feed to the community. I am looking into making a FDK bot but currently there isnt no MSI methods/functions which are gathered for the frost dungeon. If you can please help me with this, I am trying to add another another const to the assignment but continue to experience a Type mismatch at line 18, I added the variables which is a integer, and declared it to on top of the script so it should be declared to all functions/precedures that arent already assigned one.

Here is the log FINISHED! :) Thanks for the help guys Edit: Will use standards next time. So far so good, starting to come along :)

program puttingtogetherbasics;
var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;
const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut_2='Yew';
procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5;
Timer:=200.00;

Writeln('We are waiting '+FloatToStr(Timer/100)+' Seconds to continue');
Writeln('We currently have '+IntToStr(Logs)+' chopped');
Wait(500);
Writeln('We would like to obtain '+IntToStr(Number_Of_Logs)+' before we are done');
Writeln('We are chopping '+(Tree_To_Cut)+' trees!');
Writeln('When we are done chopping magics, we are going to chop '+(Tree_To_Cut_2)+' trees!');
Writeln('We have gained ' + FloatToStr(Logs*Exp) + ' cutting magics!');
Writeln('We have gained ' +FloatToStr(Logs2*Exp)+' cutting Yews!');
end;
function WeAreBored:String;
var
s:String;
begin
result:='Done chopping yews';
s:='We are bored, we are going to chop now';
wait(500);
writeln(s);
writeln('Chopping yews...'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;
begin
Cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.

Blue90

2011-11-05 17:42:43

I also tried to switch the logs to a extended format, it didnt work. As it I tried 250.00..

Harry

2011-11-05 17:49:08

Semicolons you're missing after your WriteLns. Make sure you don't forget those. Welcome.

Blue90

2011-11-05 17:50:45

Awesome, i'll try that.

tom99

2011-11-05 17:50:48

Here it is

You were trying to use this function, inttostr on extended. that only work with integer. also next time use code brackets :)
thats without quotes["simba"]Your code in here [" /simba "]

var
Logs:integer; //Changed this to integer
Exp:Extended;
Timer:Integer;
const
NUMBER_OF_LOGS=500;
TREE_TO_CUT='Magic';

Procedure HowManyLogs;
begin
Logs:=250;
Exp:=195.5;
Timer:=420;
Writeln('We are currently waiting'+IntToStr(Timer)+' Before we continue')

Writeln('We chopped'+IntToStr(Logs)+'logs this session!')
Wait(500);
Writeln('We want to chop'+IntToStr(NUMBER_OF_LOGS)+'LOGS.');
Writeln('We are chopping'+TREE_TO_CUT+'trees!')
Wait(500);
Writeln('We have Gained'+ FloatToStr(Logs*Exp)='xp this session!')
end;
function WeAreBored:string;
var
s:String;
begin
Result:='What are we going to do now?';
s:='We are bored lets chop logs';
Wait(500);
Writeln(s);
end;
begin
cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.

KingKong

2011-11-05 17:51:03

Put a semicolon at the end of the statement on line 19 and change the type of Logs to Integer on line 3

E: Damn, ninja'd by tom

Blue90

2011-11-05 18:00:36

Still a bit confused,there is semi-colons after every Waitln, would you happen to have teamviewer? if you arent busy that is.

i luffs yeww

2011-11-05 18:04:56

Writeln('We have Gained'+ FloatToStr(Logs*Exp)='xp this session!')

Writeln('We chopped'+IntToStr(Logs)+'logs this session!')

Writeln('We are currently waiting'+IntToStr(Timer)+' Before we continue')

No semi colons on those.. They need them.

tom99

2011-11-05 18:05:27

Semicolon just tells simba this is the end of the function what comes after is something else. you don't always need that since simba can ignore it in some circumstances but its still a good practice so just use it.

Blue90

2011-11-05 18:05:54

Weird, so I cant declare logs as a extended? lets just say the logs were listed as 420.50 what would I do?

i luffs yeww

2011-11-05 18:06:28

No, it can be an extended. If you want to get the str, just to ToStr(Logs).

tom99

2011-11-05 18:07:30

Then you would use the function FloatToStr but logs can never get digits and in such cases you should use integer.

Blue90

2011-11-05 18:07:38

oh alright, thank you guys so much. Glad ive got such a good community for my back-up :)

tom99

2011-11-05 18:21:41

You're welcome :)

Blue90

2011-11-05 18:53:07

Sorry guys to bother any of you again, experiencing another problem, Mismatch at line 19…god :(
program puttingtogetherbasics;
var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;
const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut2='Yews';
procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5
Timer:=200.75

Writeln('We are waiting'+IntToStr(Timer)+'Seconds to continue')
Writeln('We currently have'+IntToStr(Logs)+'chopped')
Wait(500);
Writeln('We would like to obtain +IntToStr(Number_Of_Logs)+' before we are done')
Writeln('We are chopping'+IntToStr(Tree_To_Cut)+ ' trees!)
Writeln('When we are done, we will chop'+ IntToStr (Tree_to_Cut_Logs2) +'trees')
Weireln('We have gained'+(FloatToStr)(Logs*Exp)+ ' cutting Magics')
Writeln('We have gained'+(FloatToStr)(Logs2*Exp)+' cutting Yews')
end;
function WeAreBored:String;
var
s:String;
begin
results:='What are we going to do now?';
String:='We are bored, we are going to chop now';
wait(500);
writeln(s);
writeln('We are bored, we are going to chop now'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;
Cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.
(—–Writeln('We currently have'+IntToStr(Logs)+'chopped')—–)

Rick

2011-11-05 19:12:36

You are missing semicolons after each Writeln.

Also, Line 18 you use IntToStr for the variable 'Timer', which is an Extended, not an Integer. You should use FloatToStr.

Awkwardsaw

2011-11-05 19:12:50

You forgot to add semicolons,


program puttingtogetherbasics;
var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;
const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut2='Yews';
procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5
Timer:=200.75

Writeln('We are waiting'+FloatToStr(Timer)+'Seconds to continue');
Writeln('We currently have' + IntToStr(Logs) + 'chopped');
Wait(500);
Writeln('We would like to obtain' +IntToStr(Number_Of_Logs)+' before we are done');
Writeln('We are chopping'+ Tree_To_Cut + ' trees!');
Writeln('When we are done, we will chop'+ Tree_to_Cut2 +'trees');
Writeln('We have gained'+ FloatToStr(Logs*Exp)+ ' cutting Magics');
Writeln('We have gained'+FloatToStr(Logs2*Exp)+' cutting Yews');
end;
function WeAreBored:String;
var
s:String;
begin
result:='What are we going to do now?';
S:='We are bored, we are going to chop now';
wait(500);
writeln(s);
writeln('We are bored, we are going to chop now'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;

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

is the fixed version, compare the changed version to yours so you know exactly how to fix it :)

Blue90

2011-11-05 19:14:48

Sure i'll test it, get away from this a little…
Actually the fixed version is different, im trying to implement couple more logs… and a Timer

I actually added the semicolons after all the precedures, still nothing?
:(


program puttingtogetherbasics;
var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;
const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut2='Yews';
procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5;
Timer:=200.75;

Writeln('We are waiting'+IntToStr(Timer)+'Seconds to continue');
Writeln('We currently have'+IntToStr(Logs)+'chopped');
Wait(500);
Writeln('We would like to obtain +IntToStr(Number_Of_Logs)+' before we are done');
Writeln('We are chopping'+IntToStr(Tree_To_Cut)+ ' trees!);
Writeln('When we are done, we will chop'+ IntToStr (Tree_to_Cut_Logs) +'trees');
Weireln('We have gained'+(FloatToStr)(Logs*Exp)+ ' cutting Magics');
Writeln('We have gained'+(FloatToStr)(Logs2*Exp)+' cutting Yews');
end;
function WeAreBored:String;
var
s:String;
begin
results:='What are we going to do now?';
String:='We are bored, we are going to chop now';
wait(500);
writeln(s);
writeln('We are bored, we are going to chop now'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;
Cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.

Harry

2011-11-05 19:19:08

If you don't use semicolons, it won't work. This isn't Python ;)

Blue90

2011-11-05 19:22:31

lol I dont even know where im missing the semi-colons :(

Harry

2011-11-05 19:27:54

You put a semicolon after almost every line. Unless it's a statement that requires it open (such as a begin), you would probably want to use one.

Blue90

2011-11-05 19:28:58

Nevermind, I got it FloatToStr for the extender :P

Harry

2011-11-05 19:31:33

"ToStr" should work for all types into string.

noidea

2011-11-05 19:32:15

Dont forget your standards :) Just like java use a tab or 2 spaces after begin etc :)

Blue90

2011-11-05 19:41:52

I am stuck at another problem now, on line 23 :(


program puttingtogetherbasics;
var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;
const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut2='Yews';
procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5;
Timer:=200.75;

Writeln('We are waiting'+FloatToStr(Timer)+'Seconds to continue');
Writeln('We currently have'+IntToStr(Logs)+'chopped');
Wait(500);
Writeln('We would like to obtain'+IntToStr(Number_Of_Logs)+' before we are done');
Writeln('We are chopping'+IntToStr(Tree_To_Cut)+'trees!');
Writeln('When we are done, we are going to chop'+IntToStr(Tree_To_Cut2)+'trees');
Weireln('We have gained'+(FloatToStr)(Logs * Exp)+ ' cutting Magics');
Writeln('We have gained'+(FloatToStr)(Logs2 * Exp)+' cutting Yews');
end;
function WeAreBored:String;
var
s:String;
begin
results:='What are we going to do now?';
String:='We are bored, we are going to chop now';
wait(500);
writeln(s);
writeln('We are bored, we are going to chop now'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;
Cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.

Writeln('We are chopping'+IntToStr(Tree_To_Cut)+'trees!'); <—–issues :(

Omg, why did I even add the IntToStr, they werent integers, sorry for bugging you guys with the dumb question here - :( I feel like a idiot now, I was looking at that not seeing that Tree_To_Cut,2, :( all were CONST lol

Rick

2011-11-05 19:43:20

Tree_to_Cut_Logs is a String, you shouldn't use IntToStr when it's already a string.

Edit: Tree_to_Cut_Logs actually isn't defined.

masterBB

2011-11-05 19:57:24

From: Blue90
Sure i'll test it, get away from this a little…
Actually the fixed version is different, im trying to implement couple more logs… and a Timer

I actually added the semicolons after all the precedures, still nothing?
:(
YouCode



fixed:

program puttingtogetherbasics;

var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;

const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut2='Yews';

procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5;
Timer:=200.75;

Writeln('We are waiting'+FloatToStr(Timer)+'Seconds to continue'); //bart: Float to string, cause Timer is an extended. If you're not sure use ToStr(x)
Writeln('We currently have'+IntToStr(Logs)+'chopped');
Wait(500);
Writeln('We would like to obtain '+IntToStr(Number_Of_Logs)+' before we are done'); //Bart: fixed a ' symbol
Writeln('We are chopping' + Tree_To_Cut + ' trees!'); //Bart: fixed a ' symbol, and Tree_To_Cut is already a string, no need for conversion
// Writeln('When we are done, we will chop'+ IntToStr (Tree_to_Cut_Logs) +'trees'); Bart: No idea what you wanted here.
Writeln('We have gained'+ FloatToStr(Logs*Exp)+ ' cutting Magics'); //Bart: Removed a ( and )
Writeln('We have gained'+ FloatToStr(Logs2*Exp)+' cutting Yews'); //Bart: Removed a ( and )
end;

function WeAreBored:String;
var
s:String;
begin
result := 'What are we going to do now?'; //Bart: results doesn't exist, it is result
s:='We are bored, we are going to chop now'; //Bart: You said String := this should be s :=
wait(500);
writeln(s);
writeln('We are bored, we are going to chop now'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;

begin //Bart: added begin
Cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.

Blue90

2011-11-05 20:14:05

I will be using the standards for now on, tabs seem to organize the project alot more. BTW FINISHED!
program puttingtogetherbasics;
var
Logs:Integer;
Logs2:Integer;
Exp:Extended;
Timer:Extended;
const
Number_Of_Logs=500;
Tree_To_Cut='Magic';
Tree_To_Cut_2='Yew';
procedure HowManyLogs;
begin
Logs:=250;
Logs2:=194;
Exp:=195.5;
Timer:=200.00;

Writeln('We are waiting '+FloatToStr(Timer/100)+' Seconds to continue');
Writeln('We currently have '+IntToStr(Logs)+' chopped');
Wait(500);
Writeln('We would like to obtain '+IntToStr(Number_Of_Logs)+' before we are done');
Writeln('We are chopping '+(Tree_To_Cut)+' trees!');
Writeln('When we are done chopping magics, we are going to chop '+(Tree_To_Cut_2)+' trees!');
Writeln('We have gained ' + FloatToStr(Logs*Exp) + ' cutting magics!');
Writeln('We have gained ' +FloatToStr(Logs2*Exp)+' cutting Yews!');
end;
function WeAreBored:String;
var
s:String;
begin
result:='Done chopping yews';
s:='We are bored, we are going to chop now';
wait(500);
writeln(s);
writeln('Chopping yews...'); ///Without a string this would be implemented this way. Example of string implemenation is on line 34.
end;
begin
Cleardebug;
HowManyLogs;
Writeln(WeAreBored);
end.

Harry

2011-11-05 20:22:02

Don't use tabs, they don't come out good. I suggest reading http://www.kaitnieks.com/scar/scriptingsta/ .. it's a bit outdated but all the basic stuff still applies. Much easier to read.