Now i need help again.
Now at the Cutting procedure i need to make a Case. In the beginning of the script the user will write what gem to cut in a const. So i need a Case that will choose which DTM it needs to search. How do i do that?
Printable View
Now i need help again.
Now at the Cutting procedure i need to make a Case. In the beginning of the script the user will write what gem to cut in a const. So i need a Case that will choose which DTM it needs to search. How do i do that?
You could make it check for a DTM of an uncut gem (When it doesn't find any, that means it's done). Like find out how long it usually takes to cut a full inventory (lets say 30 seconds). Then do something like
SCAR Code:begin
CutGems;
MarkTime(cutting);
wait(25000);
repeat
wait(2000);
until not (FindDTM(uncutgem,x,y,x1,y1,x2,y2) or (TimeFromMark > 40000)
end;
You get what I'm saying?
repeat
Wait(120);
FindNormalRandoms;
until(CountItems(CutGemDTM, 'dtm', [0])=AmountToCut);
I think that'd work.
Make a DTM named CutGemDTM, which is a DTM of the an already cut gem. lol.
Im a total newb at DTM's. I've read a few tutorials, but still don't get it.
If someone could explain to me ^_^
DTMs are basically pictures of an object. It uses specific dots around the object. If these dots are the same, then it found the DTM.
It's kind of hard to explain...
To make a dtm, get an image of what you want to make a dtm of.
Then, while having the DTM tutorial open btw because this is brief:
1. Go Tools > DTM Editor
2. Edit Load Image
3. Find a colored mainpoint preferably in the center. Click it.
4. On the right, make the tolerance about 10.
5. Click 4-6 subpoints on the image, which are the black outline.
6. Save the dtm if you want to. Else, just go File > DTM To Text
Hope I helped! :)
Hmm okay ill try to use that ^_^
Umm...
Now i need help again.
Now at the Cutting procedure i need to make a Case. In the beginning of the script the user will write what gem to cut in a const. So i need a Case that will choose which DTM it needs to search. How do i do that?
Ok another problem:
Now i need help again.
Now at the Cutting procedure i need to make a Case. In the beginning of the script the user will write what gem to cut in a const. So i need a Case that will choose which DTM it needs to search. How do i do that?
Would it be like this? (it goes at LoadDTMS procedure at the beginning)
Whatgame is a const at the beginning. You write what gem you want to cut, in it.
SCAR Code:case Whatgem of
'sapphire' : GemDTM := DTMFromString('78DA631463606010654001FC22D50C5C409A1' +
'188FF030123485E81010D302291401AA48187801A4920C14B8439' +
'3204D4C8020969026A3830FD85AE0600A4A905D0');
'emerald' : GemDTM := DTMFromString('123612387123612873126312312312312' +
'123123213213213213213213213213123123123123123123123' +
'324325234627834632874632746327846723483246');
Would that work?
SCAR Code:case LowerCase(WhatGem) of
'sapphire' : begin
GemDTM := DTMFromString('78DA631463606010654001FC22D50C5C409A1' +
'188FF030123485E81010D302291401AA48187801A4920C14B8439' +
'3204D4C8020969026A3830FD85AE0600A4A905D0');
end;
'emerald' : begin
GemDTM := DTMFromString('123612387123612873126312312312312' +
'123123213213213213213213213213123123123123123123123' +
'324325234627834632874632746327846723483246');
end;
end;
But I have a feeling that Emerald DTM isn't real..
Well i tested it :/
It worked :P
So here is the complete Procedure. Would it work then?
SCAR Code:procedure LoadDTMs;
begin
case Whatgem of
'sapphire' : GemDTM := DTMFromString('78DA631463606010654001FC22D50C5C409A1' +
'188FF030123485E81010D302291401AA48187801A4920C14B8439' +
'3204D4C8020969026A3830FD85AE0600A4A905D0');
'emerald' : GemDTM := DTMFromString('78DA631463606010604001FCA5C20C5C409A1' +
'188FF03012388C3CE8006189148202D05243808A8910512E204D4' +
'70030929026A8480840C01351C98FE42570300886B05AA');
'ruby' : GemDTM := DTMFromString('78DA6314656060106040016962BC0C5C409A1' +
'188FF0301232790C1CE8006189148202D05243809A8910112E204' +
'D470000951026A8481840C0135200F48E157030078F3059F');
'diamond' : GemDTM := DTMFromString('78DA631461606010604001B3A64E61E002D28' +
'C40FC1F0818D9810C0E0634C0884402694920C149408D14909022' +
'A08693083582404286801A364C7FA1AB0100921D06CD');
end;
end;
I mean if i would write ruby in the Whatgem const, it would only load Ruby DTM?
Almost, you just need to make it a function, not a procedure -
SCAR Code:function LoadDTMs(Whatgem: string);
begin
case Whatgem of
'sapphire' : GemDTM := DTMFromString('78DA631463606010654001FC22D50C5C409A1' +
'188FF030123485E81010D302291401AA48187801A4920C14B8439' +
'3204D4C8020969026A3830FD85AE0600A4A905D0');
'emerald' : GemDTM := DTMFromString('78DA631463606010604001FCA5C20C5C409A1' +
'188FF03012388C3CE8006189148202D05243808A8910512E204D4' +
'70030929026A8480840C01351C98FE42570300886B05AA');
'ruby' : GemDTM := DTMFromString('78DA6314656060106040016962BC0C5C409A1' +
'188FF0301232790C1CE8006189148202D05243809A8910112E204' +
'D470000951026A8481840C0135200F48E157030078F3059F');
'diamond' : GemDTM := DTMFromString('78DA631461606010604001B3A64E61E002D28' +
'C40FC1F0818D9810C0E0634C0884402694920C149408D14909022' +
'A08693083582404286801A364C7FA1AB0100921D06CD');
end;
end;
So when you want to load, lets say the ruby DTM. Just do
SCAR Code:LoadDTMs('ruby');
And don't forget to free the DTM. Do
SCAR Code:FreeDTM(GemDTM);
After you don't need it anymore.
But, actually, you could have just made one DTM, with the center point at a tolerance of 355, then it would find any uncut gem :p
Im confused...
What do i need to do with the LoadDTM? I just need to add it in the beginning of the Mainloop like this:
SCAR Code:LoadDTMs(Whatgem);
Or like this:
SCAR Code:LoadDTMs;
???
What exactly i do with it?
Cuz i have that Whatgem const in the beginning. The user writes in, what gem does he want to cut (sapphire, emerald, ruby or diamond).
So wouldnt it be correct to add LoadDTMs(Whatgem); somewhere in the beginning after DeclarePlayers in the mainloop?
SORRY FOR THIS UGLY LAYOUT + BAD GRAMMAR + CAPS(:p) + THE REST, BUT I HAD SPARE TIME ^^ THE CODE MIGHT BE NOT WORKING I TYPED EVERYTHING IN HERE ;).
SCAR Code:PROCEDURE LoadDTMs(Whatgem: string);
begin
case LOWERCASE(Whatgem) of
'sapphire' : GemDTM := DTMFromString('78DA631463606010654001FC22D50C5C409A1' +
'188FF030123485E81010D302291401AA48187801A4920C14B8439' +
'3204D4C8020969026A3830FD85AE0600A4A905D0');
'emerald' : GemDTM := DTMFromString('78DA631463606010604001FCA5C20C5C409A1' +
'188FF03012388C3CE8006189148202D05243808A8910512E204D4' +
'70030929026A8480840C01351C98FE42570300886B05AA');
'ruby' : GemDTM := DTMFromString('78DA6314656060106040016962BC0C5C409A1' +
'188FF0301232790C1CE8006189148202D05243809A8910112E204' +
'D470000951026A8481840C0135200F48E157030078F3059F');
'diamond' : GemDTM := DTMFromString('78DA631461606010604001B3A64E61E002D28' +
'C40FC1F0818D9810C0E0634C0884402694920C149408D14909022' +
'A08693083582404286801A364C7FA1AB0100921D06CD');
end;
end;
Use that like:
SCAR Code:LoadDTMS('ruby')
If finddtm(GEMDTM,etc,etc,etc)
That should work.
But u also could do in the player array.
SCAR Code:Players[0].Strings[0].'Ruby';// Fill in ur gem
Then do
SCAR Code:PROCEDURE LoadDTMs;
begin
case LOWERCASE(Players[0].Strings[0]) of
'sapphire' : GemDTM := DTMFromString('78DA631463606010654001FC22D50C5C409A1' +
'188FF030123485E81010D302291401AA48187801A4920C14B8439' +
'3204D4C8020969026A3830FD85AE0600A4A905D0');
'emerald' : GemDTM := DTMFromString('78DA631463606010604001FCA5C20C5C409A1' +
'188FF03012388C3CE8006189148202D05243808A8910512E204D4' +
'70030929026A8480840C01351C98FE42570300886B05AA');
'ruby' : GemDTM := DTMFromString('78DA6314656060106040016962BC0C5C409A1' +
'188FF0301232790C1CE8006189148202D05243809A8910112E204' +
'D470000951026A8481840C0135200F48E157030078F3059F');
'diamond' : GemDTM := DTMFromString('78DA631461606010604001B3A64E61E002D28' +
'C40FC1F0818D9810C0E0634C0884402694920C149408D14909022' +
'A08693083582404286801A364C7FA1AB0100921D06CD');
end;
end;
And u use it the same as above:
SCAR Code:LoadDTMS('ruby')
If finddtm(GEMDTM,etc,etc,etc)
Or
This is what I use,
SCAR Code:Function GetFoodDTM:Integer;
Begin
Case LowerCase(WhatToCook) Of //u can replace WHatToCook with Players[Currentplayer].string[0] u know ;)
'trout': DTMFromString('78DA633CC4C8C0F09F0105ECDFBA954104480' +
'36518FE0301E366208B9D11551103231209A441E6B01250731EC8' +
'FACE805FCD1E20EB370135BB812C0EFC760100484D0DD6');
'salmon': DTM := DTMFromString('78DA633CC4C8C0F09F01056C2FCB641001D24' +
'01986FF40C0B819C862674455C4C0884402699039AC04D49C07B2' +
'BE33E057B307C8FA4D40CD6E208B03BF5D00D8890D43');
End;
End;
This is different
SCAR Code:If finddtm(GetFoodDTM,etc,etc,etc,etc....) then
But now i don't remember how to free the dtm then... so don't use it :p
Why should i write LoadDTMs('ruby'); Then the user will only be able to craft rubies. Thats why i have the Whatgem const. It needs to be LoadDTMs(Whatgem);
AND wtf is the Lowercase thingy?
Why cant i just let the LoadDTMs procedure stay as it is. And then at the GemCutting procedure add LoadDTMs; or LoadDTMs(Whatgem); at the beginning.
They're talking crap now - no need to make it have an input string if you already have the string stored globally elsewhere for it, so it should just be LoadDTM, not LoadDTM('ruby') or anything like that. I am worried though that you should be making a multiplayer script, in which case you would want it to do "case Player[currentPlayer].Strings[0] of" and make it an option for all your players in declare players.
You will also want to add Lowercase, because Scar sees Ruby and ruby as different strings, so what lowercase will do is change all letters to lowercase, meaning that Ruby or RuBy or RUBY etc. is changed into ruby, thus allowing the case to work better - so would be "case Lowercase(Player[currentPlayer].Strings[0] of" for the start of the case for LoadDTM.
To add the multiplayer string to each you would have the following line at the bottom of the player[i] section (replacing i with all the values for the players you have):
Player[i].Strings[0] := 'Ruby';
or
Player[0].String[0] := 'None';
With the second meaning nothing will be cut as you won't have a nothing DTM :)
Wow thanks Mixster ^_^
Thats just what i wanted to know. Ok ill see what i can do... :D
if Lowercase(Players[CurrentPlayer].Strings[0])='none' then Exit;
Oh and would FreeDTM procedure look like this?
SCAR Code:procedure FreeDTMs;
begin
case Lowercase(Players[currentplayer].Strings[1]) of
'sapphire' : FreeDTM(GemDTM);
'emerald' : FreeDTM(GemDTM);
'ruby' : FreeDTM(GemDTM);
'diamond' : FreeDTM(GemDTM);
end;
end;
No, just FreeDTM(GemDTM);
No need for a case. They were all declared as GemDTM;.
Ok thanks. Now i have a problem with this case:
SCAR Code:case Whichbank of
'akb' : begin
Writeln('Opening Al Kharid bank.');
MakeCompass('e');
OpenBankFast('akb');
Writeln('Opened Al Kharid bank.');
end;
'lb' : begin
Writeln('Opening Lumbridge bank.');
MakeCompass('w');
OpenBankFast('lb');
Writeln('Opened Lumbridge bank.');
end;
'veb' : begin
Writeln('Opening Varrock East bank.');
MakeCompass('n');
OpenBankFast('veb');
Writeln('Opened Varrock East bank.');
end;
'vwb' : begin
Writeln('Opening Varrock west bank.');
MakeCompass('e');
OpenBankFast('vwb');
Writeln('Opened Varrock west bank.');
end;
'feb' : begin
Writeln('Opening Falador East bank.');
MakeCompass('n');
OpenBankFast('feb');
Writeln('Opened Falador East bank.');
end;
'fwb' : begin
Writeln('Opening Falador west bank.');
MakeCompass('n');
OpenBankFast('fwb');
Writeln('Opened Falador west bank.');
end;
'db' : begin
Writeln('Opening Draynor Village bank.');
MakeCompass('n');
OpenBankFast('db');
Writeln('Opened Draynor Village bank.');
end;
'eb' : begin
Writeln('Opening Edgeville bank.');
MakeCompass('w');
OpenBankFast('eb');
Writeln('Opened Edgeville bank.');
end;
end;
Im at VWB and when it needs to Rorate the Compass, it makes it East, but then makes it back to North. Why?
OpenBankFast('vwb'); changes it back to North.
You don't really need to change the direction from North...It's pretty much pointless..
Well it doesn't find the bank booths :/
Thats why i need to rotate the camera