Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Showing the SkillValue with UoSay

Ask for help
Post Reply
canabisman
Neophyte
Neophyte
Posts: 22
Joined: 04.09.2008 5:38

Showing the SkillValue with UoSay

Post by canabisman »

Hello friends im back!

So, im having a little problem how can i show the value from an specific skill, i was trying like this:

Code: Select all

program showskill;

{$Include 'all.inc'} 

var
tempskill : integer;


Begin 
 UoSay('Show Magery Skill Test');
 tempskill := GetSkillValue('Magery');
 UoSay('Magery: '+IntToStr(tempskill');
end.
But it doesnt work, could someone show the correct way, thank you.. :DD
canabisman
Neophyte
Neophyte
Posts: 22
Joined: 04.09.2008 5:38

Post by canabisman »

Im getting this error:

Compiling
Compiler: [Error] (Show Skill Value Test.sc at 11:38): Type mismatch
Compiling failed
Script Show Skill Value Test.sc stopped successfuly
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Post by Vizit0r »

Code: Select all

function GetSkillValue(SkillName: String): Double;
Double - float type, but integer - not

Code: Select all

tempskill := Round(GetSkillValue('Magery'));
or

Code: Select all

tempskill : double; 


Begin 
 UoSay('Show Magery Skill Test'); 
 tempskill := GetSkillValue('Magery'); 
 UoSay('Magery: '+FloatToStr(tempskill');
you may need functions like RoundTo or something like this
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
canabisman
Neophyte
Neophyte
Posts: 22
Joined: 04.09.2008 5:38

Post by canabisman »

It worked successfully thanks..

the only problem is that it shows like this

Magery: 50.0000000000

not

Magery: 50.0

it shows a lot of 0

but thats ok
WladL
Apprentice
Apprentice
Posts: 240
Joined: 27.07.2009 17:21
Location: DRW
Contact:

Post by WladL »

Code: Select all

function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string; 
http://delphi.about.com/library/rtl/blr ... ToStrF.htm
"Как хочешь ты трудись;
Но приобресть не льстись
Ни благодарности, ни славы,
Коль нет в твоих трудах ни пользы, ни забавы. (с) С.Крылов."
canabisman
Neophyte
Neophyte
Posts: 22
Joined: 04.09.2008 5:38

Re: Showing the SkillValue with UoSay

Post by canabisman »

thanks!
elemeNt X
Posts: 8
Joined: 04.05.2011 16:55

Re: Showing the SkillValue with UoSay

Post by elemeNt X »

You forget one ) in the last line :D

UoSay('Magery: '+IntToStr(tempskill'));
Post Reply