View Full Version : How to make variable equel letters?
I tried making a status for my fighting script but i get an error.. the code looks like:
status1 := ('Attacking ');
WriteLn('' + IntToStr(status1) + IntToStr(monsterkill) + '!');
I get the error:
[Error] C:\Users\*\Desktop\simba\Combat\Soulsplit autofighter.simba(108:29): Type mismatch at line 107
I declared status1 in main variable section
Le Jingle
12-11-2012, 09:06 PM
program test;
{$i srl/srl.simba}
var
// how to declare a variable that stores a string var
message: string;
MonsterKill: integer;
begin
setupsrl;
// how to use the string var
message := 'Attacking';
// don't need to convert the message as it is already a string type
writeln('' + message + IntToStr(MonsterKill) + '!');
end.
hope that helps clear it up. Note you should have declared the Monsterkill variable as an integer prior to use.
Wardancer
12-11-2012, 09:06 PM
IntToStr stands for "Integer To String". It is a way to transform an integer into a string as writeln only writes down variables that can be string (let's keep it simple and ignore other variables for now). There is no need to transform status1 as it's already a string. With the line, you're trying to use it as a integer, therefore getting a type mismatch.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.