SRL Archive - OSR Help

help with my truly first script


killhack95

2010-05-11 13:52:01

Hey all!

I've decided to forget about c++ for some time and am going to write a script called Wizards Delight. First i am going to make a simple autoalcher function, then i am going to some banking and maybe make an autosuperheater.
I haven't done anything yet (besides learning declareplayers) that is worth posting.I want to create this thread so if i have any questions i want to ask i may ask them here.

I know how to open a game tab, for example gametab(8); would open the magic spellbook. Now using gametab(2) how do i get the magic level to an integer?
And also, how can i click a specific slot, or item on the inventory tab? Does srl have a function for it or do you have to write your own?

I am going to use dtms, and if i run into more troubles i will post here.
Thanks for help in advance!

Coh3n

2010-05-11 13:55:53

You'll want to use the gameTab constants rather than hard coded values.

gameTab(tab_Skills);
And I'm assuming you're also asking how to get the magic level, in which case you would just do

getSkillLevel(skill_Magic);

killhack95

2010-05-11 14:00:16

so i could basically just do
var
magiclvl : integer;
begin
magiclvl := getSkillLevel(skill_Magic);

right???

Coh3n

2010-05-11 14:02:05

Yes, exactly.

Baked0420

2010-05-11 14:02:39

if you mean that you don't need to call the magic gametab then you're correct, getSkillLevel already opens the skills tab for you.

EDIT: First time being ninja'd? :O

killhack95

2010-05-11 14:09:18

procedure setup;
var
magiclvl : integer;
begin
magiclvl := getSkillLevel(skill_Magic);
end;




begin
setupsrl;
{$IfDef SMART}
Smart_Server := Smart_World;
Smart_Signed := Signed_SMART;
Smart_Members := Members_World;
{$EndIf}
setup;
print(magiclvl);
end.


Failed when compiling
Line 214: [Error] (22650:27): Unknown identifier 'skill_Magic' in script


Cohen, owned!

Coh3n

2010-05-11 14:10:56

Hmm, I must have the constant wrong. Try

getSkillLevel('magic');
Also, post your code in SCAR tags, please.

killhack95

2010-05-11 14:11:28

From: Coh3n
Hmm, I must have the constant wrong. Try

getSkillLevel('magic');
Also, post your code in SCAR tags, please.


Thanks and ok.

Dgby714

2010-05-11 14:16:51

From: killhack95
Cohen, owned!


Skill_Mage =)

- SRL/core/Players.scar
{ const Skills consts
Description: To be used with Players.Level[] array
Players woodcutting level: Players[i].Level[Skill_WoodCutting]
}
const
Skill_Attack = 1;
Skill_Strength = 2;
Skill_Defense = 3;
Skill_Range = 4;
Skill_Prayer = 5;
Skill_Mage = 6;
Skill_RuneCrafting = 7;
Skill_HP = 8;
Skill_Agility = 9;
Skill_Herblore = 10;
Skill_Thieving = 11;
Skill_Crafting = 12;
Skill_Fletching = 13;
Skill_Slayer = 14;
Skill_Mining = 15;
Skill_Smithing = 16;
Skill_Fishing = 17;
Skill_Cooking = 18;
Skill_FireMaking = 19;
Skill_WoodCutting = 20;
Skill_Farming = 21;
Skill_Construction = 22;
Skill_Hunter = 23;
Skill_Summoning = 24;
Skill_Dungenoeering = 25;

killhack95

2010-05-11 14:25:33

it works with simply 'magic'
so how do you click a specific slot on the inventory?

Coh3n

2010-05-11 14:35:15

InvBox(5) for inventory box 5, I think. Take a look in Inventory.scar. Most of the questions you have can be answered by simply looking through the include. :)

killhack95

2010-05-12 03:20:33

Edit 3:

Nevermind, restarted my pc and redid the dtm's, works fine now :D
The problem is with smart, becouse without smart it works fine :D

killhack95

2010-05-12 05:34:21

FINISHED THE SCRIPT AND ITS WORKING!!!

Ima go post it in the first script section now!