Page 1 of 1

a little help :)

Posted: Fri Sep 07, 2007 8:47 am
by Yerome
I have just a little problem during compilation:
I want use this script:

Code: Select all

use uo;
use os;

program hulka(who);
var hp;
var dmg;
var none;
var malohp;
hp := getvital(who,"life");
dmg := RandomFloat(20);
none := (hp-1);
if (none>=dmg);
ApplyRawDamage(who,dmg);
elseif (none<dmg);
malohp := (hp-none);
ApplyRawDamage(who,malohp);
else
(hp=1);
continue
endif
endprogram

but ecompiler cant compile that becouse:

C:\pol\scripts>ecompile hulka.src
EScript Compiler v1.08
Copyright (C) 1994-2007 Eric N. Swanson

Compiling: C:\pol\scripts\hulka.src
Token '(' cannot follow token 'getvital'
Function getvital() is not defined.
Error compiling statement at C:\pol\scripts\hulka.src, Line 8
Error detected in program body.
Error occurred at C:\pol\scripts\hulka.src, Line 8
Execution aborted due to: Error compiling file


What iam doing wrong? Can anyone help me?

Posted: Fri Sep 07, 2007 9:54 am
by AxelDominatoR
Perhaps... try making it CamelCased.

Code: Select all

hp := GetVital(who,"life");
instead of

Code: Select all

hp := getvital(who,"life"); 

Posted: Fri Sep 07, 2007 10:15 am
by coltain
if it`s pol097

use vitals; <- this is missing

Posted: Fri Sep 07, 2007 10:17 am
by ncrsn
If you are using POL 097, you need to use module vitals. GetVital() and some other functions were moved onto that.

Code: Select all

use vitals;
Also notice that '=' is deprecated novadays, you must use ':=' or '=='.

Posted: Fri Sep 07, 2007 11:17 am
by Yerome
thanks... iam just compile that but i have another problem... apply dmg on a player. its dont work...

I just trying to make a magic wand.. which give you a random dmg but never kill you, you must have at least 1hp...

Posted: Sat Sep 08, 2007 3:13 am
by coltain
something like this?

Code: Select all

use uo;
use vitals;

program wand(who)
 
    var dmg := Randomint(20);
    var Hp:=Cint(GetVital(who, "Life")/ 100);

    if(Hp-dmg<=0)
         dmg := Hp -1;
    endif

    ApplyRawDamage(who,dmg); 

endprogram


Posted: Sun Sep 09, 2007 12:06 pm
by Yerome
coltain wrote:something like this?

Code: Select all

use uo;
use vitals;

program wand(who)
 
    var dmg := Randomint(20);
    var Hp:=Cint(GetVital(who, "Life")/ 100);

    if(Hp-dmg<=0)
         dmg := Hp -1;
    endif

    ApplyRawDamage(who,dmg); 

endprogram

Yes, something like that :)
THX you.