SRL Archive - OSR Help

Pottery Crafting Script


VastlySuperior

2012-07-09 11:25:24

Hey Guys

I need some help with this script. I decided to open a new thread that will be global for the pottery Script I`m Working on. I might place some Request for help here from time to time, rather than creating a lot of different threads.

This is the Code I`m currently having a problem with:

WithdrawItem(DTM_SoftClay,'dtm',28,['ft cl'],[]);   // WithDraw item From Bank

It was Assigned this value:
DTM_SoftClay := DTMFromString('mggAAAHicY2NgYEhjZmCIBuJEIM4G4iIgjgfifCYGhmIgrgDiciDOBuI0IA534AXjBDc+hgBrbgZzDQ4wZgOahQ0z4sAQAAADdgiv');

Declared Like This:
DTM_SoftClay, DTM_Clay, DTM_PickAxe,DTM_SoftPot,DTM_FiredPot: Integer;

My problem is that I keep Getting a type mismatch error, and I just can`t see where or how

Here is the debug:
[Error] (139:55): Type mismatch at line 138
Compiling failed.

So the code right at the top is line 138

I know it must be some stupid mistake, but for the life of me I just cant see it.

Here is the complete code for that procedure:
// WithDraw Items and Equipment as needed from bank
// Select Case To Use To withdraw Item.
// If No Item Then Do Auto Switch Activity
procedure WithDrawItems;
var
Temp:Integer;
Begin
DTM_SoftClay := DTMFromString('mggAAAHicY2NgYEhjZmCIBuJEIM4G4iIgjgfifCYGhmIgrgDiciDOBuI0IA534AXjBDc+hgBrbgZzDQ4wZgOahQ0z4sAQAAADdgiv');
DTM_Clay := DTMFromString('mggAAAHicY2NgYEhjZmCIBuJEIM4G4iIgjgfifCYGhmIgrgDiciDOBuI0IA534AXjBDc+hgBrbgZzDQ4wZgOahQ0z4sAQAAADdgiv');
Temp := 0
Temp := CountInvItems('dtm', DTM_SoftClay, []);
// First do A Search For the Item That is to be Withdrawn
// SearchBank('oft clay');
// If Item Found WithDraw Item, If Not Found, Switch Activity To Do
// Rather Use DTM ?
If (Temp > 1) then
Begin
WithdrawItem(DTM_SoftClay,'dtm',28,['ft cl'],[]); // WithDraw item From Bank
Wait(500 + random(400));
CloseBank;
FreeDTM(DTM_SoftClay);
Exit;
End;
If (Temp = 0) then
Begin
Temp := 0;
Temp := CountInvItems('dtm', DTM_Clay, []);
If (Temp > 27) then
Begin
ChooseActivity := 8;
End;
ChooseActivity := 0;
End;
FreeDTM(DTM_SoftClay);
FreeDTM(DTM_Clay);
End;


I still need to make a dtm for the clay.

I need some advice here, all input will be appreciated. Yes the code is not streamlined I know, but this will only be a beta script. Once I understand all the procedures I need to create a successful Crafting Script for pottery. I will create a More Valuable script that is much more easier to follow and organized. Still learning the ropes and pascal as well.

Thanks for the help and advice.

NKN

2012-07-09 11:32:37


WithdrawItem(DTM_SoftClay,'dtm',28,['ft cl'],[])
Turn that to:

WithdrawItem(DTM_SoftClay,'dtm',28,['ft cl'],[1])

Try that

VastlySuperior

2012-07-09 12:12:13

It gives the same error. Have nothing to do with tolerance.

Kasi

2012-07-09 12:32:22

From: NKN


WithdrawItem(DTM_SoftClay,'dtm',28,['ft cl'],[1])
Try that


DTM's dont have tolerance, as they are tolerated when being made.

There is actually a small error in the include, the function is not supposed to handle TStringArrays, it should be


WithdrawItem(DTM_SoftClay,'dtm',28,'ft cl',[]);

VastlySuperior

2012-07-09 13:01:59

@ pur3b100d That is how it looks in the original first post and is why I`m getting a type mismatch. What am I doing wrong?

I looked at the function and it looks correct to me according to the sample they gave how to use it.

The only thought I have is that maybe I`m using the function in the incorrect way. Is that possible?

That you cant use this function to withdraw an item per se? But even if used wrong, it should still not give a type mismatch?

Kasi

2012-07-09 13:13:14

From: VastlySuperior
@ pur3b100d That is how it looks in the original first post and is why I`m getting a type mismatch. What am I doing wrong?

I looked at the function and it looks correct to me according to the sample they gave how to use it.

The only thought I have is that maybe I`m using the function in the incorrect way. Is that possible?

That you cant use this function to withdraw an item per se? But even if used wrong, it should still not give a type mismatch?


nope it doesn't look the same, it looks similar but not the same, look more closely ;)

// old code

WithdrawItem(DTM_SoftClay,'dtm',28,['ft cl'],[]);
// new code

WithdrawItem(DTM_SoftClay,'dtm',28,'ft cl',[]);

Runaway

2012-07-09 13:15:24

From: VastlySuperior
@ pur3b100d That is how it looks in the original first post and is why I`m getting a type mismatch. What am I doing wrong?

I looked at the function and it looks correct to me according to the sample they gave how to use it.

The only thought I have is that maybe I`m using the function in the incorrect way. Is that possible?

That you cant use this function to withdraw an item per se? But even if used wrong, it should still not give a type mismatch?


I don't know if you've edited the original post or you didn't notice what pur3v100d changed, but something is wrong here :P

You should be using 'ft cl' instead of ['ft cl'] since the WithdrawItem function is looking for a string.

Edit: JK, he told you himself :p

VastlySuperior

2012-07-09 15:13:52

I`m so blind. Did not see what was changed. Just to let you know it is fine now. Just one question, why does it show the example then in that manner?

Thanks Runaway and pur3b100d. Just blinders on my eyes I guess.

Runaway

2012-07-09 15:16:20

From: VastlySuperior
I`m so blind. Did not see what was changed. Just to let you know it is fine now. Just one question, why does it show the example then in that manner?

Thanks Runaway and pur3b100d. Just blinders on my eyes I guess.


I think nava2 is just trollin' :garfield:

Kasi

2012-07-10 08:30:21

From: VastlySuperior
I`m so blind. Did not see what was changed. Just to let you know it is fine now. Just one question, why does it show the example then in that manner?

Thanks Runaway and pur3b100d. Just blinders on my eyes I guess.



As i said in my first post…There is actually a small error in the include. The best thing to do would be to also look at the include and understand datatypes. there's always help aslong as you search the forums first..