PDA

View Full Version : Need help with this, if you can please



Blue90
11-05-2011, 09:40 PM
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
11-05-2011, 09:42 PM
I also tried to switch the logs to a extended format, it didnt work. As it I tried 250.00..

Harry
11-05-2011, 09:49 PM
Semicolons you're missing after your WriteLns. Make sure you don't forget those. Welcome.

Blue90
11-05-2011, 09:50 PM
Awesome, i'll try that.

tom99
11-05-2011, 09:50 PM
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
11-05-2011, 09:51 PM
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
11-05-2011, 10:00 PM
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
11-05-2011, 10:04 PM
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
11-05-2011, 10:05 PM
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
11-05-2011, 10:05 PM
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
11-05-2011, 10:06 PM
No, it can be an extended. If you want to get the str, just to ToStr(Logs).

tom99
11-05-2011, 10:07 PM
Then you would use the function FloatToStr but logs can never get digits and in such cases you should use integer.

Blue90
11-05-2011, 10:07 PM
oh alright, thank you guys so much. Glad ive got such a good community for my back-up :)

tom99
11-05-2011, 10:21 PM
You're welcome :)

Blue90
11-05-2011, 10:53 PM
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
11-05-2011, 11:12 PM
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
11-05-2011, 11:12 PM
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
11-05-2011, 11:14 PM
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
11-05-2011, 11:19 PM
If you don't use semicolons, it won't work. This isn't Python ;)

Blue90
11-05-2011, 11:22 PM
lol I dont even know where im missing the semi-colons :(

Harry
11-05-2011, 11:27 PM
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
11-05-2011, 11:28 PM
Nevermind, I got it FloatToStr for the extender :P

Harry
11-05-2011, 11:31 PM
"ToStr" should work for all types into string.

noidea
11-05-2011, 11:32 PM
Dont forget your standards :) Just like java use a tab or 2 spaces after begin etc :)

Blue90
11-05-2011, 11:41 PM
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
11-05-2011, 11:43 PM
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
11-05-2011, 11:57 PM
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
11-06-2011, 12:14 AM
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
11-06-2011, 12:22 AM
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.