ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: The Ghost on October 05, 2011, 06:58:47 PM

Title: Monger Quest, Small Create property reading
Post by: The Ghost on October 05, 2011, 06:58:47 PM
No sure if you guy are able to help me.  I'm working on a script to be able to read the small create form the Monger quest and can't figure out.  Can anyone point me  in the right direction, because it not easy to do it by hand, lot of info to remember. 
Title: Re: Monger Quest, Small Create property reading
Post by: Khameleon on October 06, 2011, 05:56:23 PM
I would look into TM's Split String SUB I've used it on this particular script myself works great....

www.scriptuo.com/index.php?topic=1101.0;highlight=tm_splitstring
Title: Re: Monger Quest, Small Create property reading
Post by: NObama on October 06, 2011, 07:26:15 PM
If you just want to know what's required by a particular crate, event property is what you'll need.  http://wiki.easyuo.com/index.php?title=Event_Property

If you want to parse the crate information for use in a helper-type script...It is initially complex, until you understand how to use #property and str commands.  I learned how to use them on this very problem.  Recommend you spend some time on the documentation over at EUO:  http://wiki.easyuo.com/index.php?title=Str_%28command%29

There is a fabulous tutorial that explains how to do the math.

There are a couple of steps you need to do to accomplish what you seek:

1) Strip out all string information until you're left with just the fish type and quantity.  Here's a bit to get you started.  It won't make sense until you've read the tutorial over at EUO I linked above.

Code: [Select]
set %string #property
str Pos %string $
str del %string 1 #strres
set %string #strres
str Pos %string $
str del %string 1 #strres
set %string #strres
str Pos %string Deliver
set #strres #strres - 1
str Left %string #strres
set %string #strres
set %stringkey %string

2) Once you've done that, you'll then need to load all the fish types and numbers for a particular crate into memory.  I recommend TM's Array handling functions.

3) Presumably, you'll also want to read the property string to determine where to deliver it.

4) At some point, you'll run afoul of blank spaces.  Familiarize yourself with TM's Add Underscore routine to overcome the problem.

Fair warning:  It's a couple hundred lines of code to create something that will understand how many crates you have, which and how many fish belong in each and where to deliver them.


Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 06, 2011, 10:06:58 PM
Thx for the input,  I have use the Event #property  and  find out that can only read on create at the time.   The string of lie are long so far, 54 fish/crab ID and sub routine and the quantity as well.  It will get better when I have all 20 Qty.    I will keep writing few lines of code every day until I'm done. 
Title: Re: Monger Quest, Small Create property reading
Post by: Crome969 on October 06, 2011, 11:35:19 PM
Thx for the input,  I have use the Event #property  and  find out that can only read on create at the time.   The string of lie are long so far, 54 fish/crab ID and sub routine and the quantity as well.  It will get better when I have all 20 Qty.    I will keep writing few lines of code every day until I'm done. 
Each Line of Property is splitted with $ in the Property. When the Crate always only have the same amount of lines  you could do a Static count of $ then switch to the number of it. After that Scan from there some tiles before

Example:
Quote
A Bag of Sending $ Weight: 1 Stone $ Charges: 9$
I calculate the Lenght and know if Lenght = 48 then its a number with 1 Digit, if 49 then with 2, if 50 then with 3
then i using
Quote
str len #property
set %length #strres
set %jumper %length - 1
str pos #property 47 %jumper
display #strres
Untested but should work;) He goes then from 47 to 47 and return 1 Digit. with 2 Digites he take 47-48, at 3 Digits 47-49, if Osi would support even more you could add it up to infinite
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 16, 2011, 11:01:39 PM
 After long hour I figure out how to get the Property of the crate and grab the list.  Where I have small problem is the Deepsea fish have 3  fish with Red.  Red Grouper, Red Drum, Red Snook.

 I have try to use  
Quote
if Red in #property && Grouper in #property
and
                          
Quote
if Red in #property || Grouper in #property

both type grab all three fish type. Any suggestion on how to only grab the right one.  

THx
Title: Re: Monger Quest, Small Create property reading
Post by: Crome969 on October 17, 2011, 02:18:47 AM
After long hour I figure out how to get the Property of the crate and grab the list.  Where I have small problem is the Deepsea fish have 3  fish with Red.  Red Grouper, Red Drum, Red Snook.

 I have try to use  
Quote
if Red in #property && Grouper in #property
and
                          
Quote
if Red in #property || Grouper in #property

both type grab all three fish type. Any suggestion on how to only grab the right one.  

THx

You are using an "or" Statement in second part of your "Example Code".
Following will happen:
Test Property(its a fake!)
Quote
A Red Grouper $ Weight: 1 Stone $
Quote
Your statement 1:
if ( Red in  #property) => Returns True
&& (and)
(Grouper #in Property) => Returns True.

If Both is in your Current Property do your Code

Second Statement:
Quote
if ( Red in  #property) => Returns True
|| (or)
(Grouper #in Property) => Returns True.

When one of these Statements Returns true then do your Code.
Result:
Unless you dont Filter more he will find with both methods any Items wich Contains
Quote
Red
and
Quote
Grouper
. When only Contains one of these the he will find it only with the Second Statement.


Crome
Title: Re: Monger Quest, Small Create property reading
Post by: camotbik on October 17, 2011, 03:35:00 AM
After long hour I figure out how to get the Property of the crate and grab the list.  Where I have small problem is the Deepsea fish have 3  fish with Red.  Red Grouper, Red Drum, Red Snook.

 I have try to use  
Quote
if Red in #property && Grouper in #property
and
                          
Quote
if Red in #property || Grouper in #property

both type grab all three fish type. Any suggestion on how to only grab the right one.  

THx

Code: [Select]
 if Red in #property && Grouper notin #property ; if only red in property
  ...
  if Grouper in #property && Red notin #property ; if only Grouper in property
  ...
  if Red , #spc , Grouper in #property ; if Red Grouper in property
And few other examples
Code: [Select]
if Pike in #property && Dungeon notin #property && Tormented notin #property
 ....
if Lobster in #property && Blood notin #property && Crusty notin #property && Dread notin #property && Fred notin #property && Hummer notin #property && Rock notin #property && Shovel-Nose notin #property && Spiney notin #property && Void notin #property
....
if Crab in #property && Apple notin #property && Blue notin #property && Dungeness notin #property && King notin #property && Rock notin #property && Snow notin #property && Tunnel notin #property && Void notin #property
....
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 17, 2011, 01:58:46 PM
Thx camotbik,  nice info,    Now that I have all the ID and fish list, if pick up all the same group ( shore/sea/dungeon or Crab) if anyone is present.  

Here my #property:  
Quote
Small Crate$Weight: 1 Stone$Rock Lobster: 0/20$Shovel-Nose Lobster: 0/20$Mahi-Mahi: 0/20$Bluefish: 0/20$Red Drum: 0/20$Deliver To Britain$NO-TRADE$Contents: 0/125 Items, 0/1200 Stones$
.  

so using this code it should pick the one that are listed in my #property but it drags all the deep sea  fish, ignore the shore and Dungeon fish.   All my fishand crab are in the same chest. Not sure what I did wrong here.  
finditem is the ID of my stack.  
  
Code: [Select]
if Amberjack in #property                ; Amberjack
set %chest %container1
finditem IWKZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
if Black , #spc , Seabass in #property          ; Black_Seabass
set %chest %container1
finditem PZJZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
if Blue , #spc , Grouper in #property              ; Blue_Grouper
set %chest %container1
finditem PMWYOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
if Red , #spc , Drum in #property      ; Red Drum
set %chest %container1
finditem HQLZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
if Red , #spc , Grouper in #property    ; Red Grouper
set %chest %container1
finditem BNRZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
if Red , #spc , Snook in #property     ; Red Snook
set %chest %container1
finditem MIFZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime

Edit
ok I find a way to make it work but  I'm sure it not the best way.   Make the script long and slow.
Code: [Select]
if Amberjack notin #property
goto DS1
if Amberjack in #property                ; Amberjack
set %chest %container1
finditem IWKZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
DS1:
if Black , #spc , Seabass notin #property
goto DS2
if Black , #spc , Seabass in #property     ; Black_Seabass
set %chest %container1
finditem PZJZOPD C_ , %chest
exevent drag #findid 20
exevent dropc %packie
wait %waittime
Title: Re: Monger Quest, Small Create property reading
Post by: camotbik on October 18, 2011, 01:27:03 AM
well for the first of all, you are missing brackets!!! That is why you are executing all the lines i.e. taking all the items.

In this example you can see, how lines are only executed if statement is checked.

Code: [Select]
if greeen , #spc , stinky , #spc , brass in #property
{   ; open statment if green stinky brass in property
  finditem %greenstinkybrass C_ , %fish_container
  if #findcnt > 0
  { ; open statment if green stinky brass found
    exevent drag #findid %ammount
    exevent dropc #backpackid
    wait 20
  } ; close statment if green stinky brass found
  else ; open statement if green stinky brass not found
  {
    display Green stinky brass not found!
    stop
  } ; close statement if green stinky brass not found
} ; close statment if green stinky brass in property

so the slight changes, should help you with your problem.
Code: [Select]
if Amberjack in #property                ; Amberjack
{
  set %chest %container1
  finditem IWKZOPD C_ , %chest
  exevent drag #findid 20
  exevent dropc %packie
  wait %waittime
}
if Black , #spc , Seabass in #property          ; Black_Seabass
{
  set %chest %container1
  finditem PZJZOPD C_ , %chest
  exevent drag #findid 20
  exevent dropc %packie
  wait %waittime
}
if Blue , #spc , Grouper in #property              ; Blue_Grouper
{
  set %chest %container1
  finditem PMWYOPD C_ , %chest
  exevent drag #findid 20
  exevent dropc %packie
  wait %waittime
}
if Red , #spc , Drum in #property      ; Red Drum
{
  set %chest %container1
  finditem HQLZOPD C_ , %chest
  exevent drag #findid 20
  exevent dropc %packie
  wait %waittime
}
if Red , #spc , Grouper in #property    ; Red Grouper
{
  set %chest %container1
  finditem BNRZOPD C_ , %chest
  exevent drag #findid 20
  exevent dropc %packie
  wait %waittime
}
if Red , #spc , Snook in #property     ; Red Snook
{
  set %chest %container1
  finditem MIFZOPD C_ , %chest
  exevent drag #findid 20
  exevent dropc %packie
  wait %waittime
}
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 18, 2011, 10:11:39 AM
I made the changes you said and it work, thx lot,  that remove a few line of codes.  Really appreciate they  input you give me.

Edit:   silly me, my packhorse dead and forget to change his ID.
Title: Re: Monger Quest, Small Create property reading
Post by: camotbik on October 18, 2011, 10:28:15 AM
I made the changes you said and it work, thx lot,  that remove a few line of codes.  Really appreciate they  input you give me.

Make sure you read this tutorial - http://www.scriptuo.com/index.php?topic=8759.0
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 18, 2011, 04:19:05 PM
After running quest for 4 hrs.  I took a break,  return to do quest and now I can't drag any fish  that are in my $ property list.  This is weird,  happen yesterday too.  I sore  that EA changing detail that make my script not functioning properly.
Title: Re: Monger Quest, Small Create property reading
Post by: Endless Night on October 18, 2011, 04:25:14 PM
After running quest for 4 hrs.  I took a break,  return to do quest and now I can't drag any fish  that are in my $ property list.  This is weird,  happen yesterday too.  I sore  that EA changing detail that make my script not functioning properly.

That i very much doubt...  you probably have not covered every scenario.
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 18, 2011, 05:35:22 PM
it scan all the property,  I run it with F7 to ensure that it look at all the right line and it find,  the ID still all correct,  not sure what change in the last 4hrs that I run it.  

Edit

Find the problem,  My pet die and forget to reset his ID.   Operator Error :) 
Title: Re: Monger Quest, Small Create property reading
Post by: Endless Night on October 18, 2011, 05:43:19 PM
it scan all the property,  I run it with F7 to ensure that it look at all the right line and it find,  the ID still all correct,  not sure what change in the last 4hrs that I run it. 

when that sort of thing happens... i always quit the client and euo and reboot and start again. and if that doesnt fix it then its your code and you need to debug.
Title: Re: Monger Quest, Small Create property reading
Post by: camotbik on October 18, 2011, 11:50:20 PM
Sorry but why are you using Fish ID, not type? If you drag one fish/mark it/finish the quest, you have to rewrite the particular fishes id.. Why not just use types and property to determine the right fish?
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 19, 2011, 10:23:33 AM
I have try to use the type ( RMZ,NMZ, etc) but to many fish have the same one, so I ID the stack, this way it  grab the right one every time.     I need just to ensure that my stack never get empty so the ID wont change.  If you know of an easy way to grab the right fish, I'm all ears.  I'm still learning all this.   
Title: Re: Monger Quest, Small Create property reading
Post by: camotbik on October 19, 2011, 02:09:01 PM
Just use something like this
Code: [Select]
Sub TypeNameContainer
  finditem %1 C_ , %3
  for #findindex 1 #findcnt
  {
    event property #findid
    if %2 in #property
    {
      exevent drag #findid
      exevent dropc #backpackid
      wait 20
    }
  }
return

Gosub TypeNameContainer RMZ Stinky , #spc , brass %container
Title: Re: Monger Quest, Small Create property reading
Post by: The Ghost on October 19, 2011, 04:06:30 PM
WOW  now you just lost me,  What did you associated those % 1,%2,%3  to.  
; %1 = This is the fish type you want to find  Example: ZYZ_MZ_DQZ_WYZ
; %2 = The name of the fish you are looking for.  You have to use proper formatting such as:     Black , #spc , Seabass
; %3 = This is what you want to search which for you I believe is %container1

In that example, I notice you didn't enter any amount to drags, is that mean Property will pick the right amount on his own.  
Title: Re: Monger Quest, Small Create property reading
Post by: Crome969 on October 19, 2011, 11:50:20 PM
WOW  now you just lost me,  What did you associated those % 1,%2,%3  to.  
; %1 = This is the fish type you want to find  Example: ZYZ_MZ_DQZ_WYZ
; %2 = The name of the fish you are looking for.  You have to use proper formatting such as:     Black , #spc , Seabass
; %3 = This is what you want to search which for you I believe is %container1

In that example, I notice you didn't enter any amount to drags, is that mean Property will pick the right amount on his own.  
They are Parameters for the Subfunction.
Code: [Select]
Gosub TypeNameContainer %Type %Wanted Property %Container would be to use the Sub.
ofc all the % in the Line can be changed by you. It would pick the full amount he get via #findstack
Title: Re: Monger Quest, Small Create property reading
Post by: camotbik on October 20, 2011, 01:33:48 AM
WOW  now you just lost me,  What did you associated those % 1,%2,%3  to.  
; %1 = This is the fish type you want to find  Example: ZYZ_MZ_DQZ_WYZ
; %2 = The name of the fish you are looking for.  You have to use proper formatting such as:     Black , #spc , Seabass
; %3 = This is what you want to search which for you I believe is %container1

In that example, I notice you didn't enter any amount to drags, is that mean Property will pick the right amount on his own.  


1) type
2) name
3) the container in which should we search for the stinky brass

Yeah it was nearly 4 o'clock in the morning, so I've missed the ammount. Anyway, it was just an example, if you want you can add %4 parameter as ammount( exevent drag #findid %4 ), and you should be set.