Author Topic: Quick response help needed!  (Read 4039 times)

0 Members and 1 Guest are viewing this topic.

Offline razeialTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 1
  • razeial has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Quick response help needed!
« on: August 20, 2012, 10:40:34 PM »
0
Hey all. I'm trying to write a script that will buy a particular item from a player vendor but only if it meets a few requirements such as price or charges left. I can't seem to figure out how to make those last two work. I tried maybe using the information in #property but it wont work.

Right now I'm testing this with a barbed kit and this is the code i've come up with

Code: [Select]
mainloop:
finditem %Rkit c_ , %bag
if #findkind = -1
   {
    goto mainloop
   }

if #findcnt => 1
{
 event Property #findid
 if #findcol = 2129
     if Barbed_Runic_Sewing_Kit in #property
         if Uses_Remaining: , #spc , >= 15 in #property
             if Price:_ , #spc , >= %price in #property
                {
                 msg Vendor buy$
                 target 2s
                 set #ltargetid #findid
                 event macro 22 0
                 wait 5
                 click 239 336
                 wait 5
                }
RETURN

Im stuck. Can anyone lend a hand!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Quick response help needed!
« Reply #1 on: August 21, 2012, 05:27:00 AM »
0
you need more {}.. for every if   (Repeat until better than goto) you can combine those ifs to a single if

Code: [Select]
repeat
  finditem %Rkit c_ , %bag
until #findkind <> -1

if #findcnt => 1
{
 event Property #findid
 if #findcol = 2129  &&  Barbed_Runic_Sewing_Kit in #property && Uses_Remaining: , #spc , >= 15 in #property
     {
       ;;      if Price:_ , #spc , >= %price in #property ;this will not work
                {
                 msg Vendor buy$
                 target 2s
                 set #ltargetid #findid
                 event macro 22 0
                 wait 5
                 click 239 336
                 wait 5
                }
       }
RETURN

BELOW Line will not work
 if Price:_ , #spc , >= %price in #property

What you must do is CUT the price out of the property string into its own varaible and then  perform the >=

Thiers some string subs here that might help you cut the price out or not... http://www.easyuo.com/psl.php?cat=157



So I take it from the inital loop .. that your going to sit at a given spot checking this vendor over and over for runics...  you may wish to ignore the tools that fail to meet your criteria or you will be checking the same one over and over.
« Last Edit: August 21, 2012, 05:29:16 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline razeialTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 1
  • razeial has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: Quick response help needed!
« Reply #2 on: August 21, 2012, 11:05:50 AM »
0
Pretty much. Im unfamiliar with STR commands and how they work.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Quick response help needed!
« Reply #3 on: August 21, 2012, 11:55:46 AM »
0
Pretty much. Im unfamiliar with STR commands and how they work.

sounds like time to give it a bash....
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13304
  • Activity:
    0.6%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Quick response help needed!
« Reply #4 on: August 21, 2012, 12:10:06 PM »
0
sounds like time to give it a bash....

Yes, they are a bit wonky, but once you get used to them they can be your friend.

http://wiki.easyuo.com/index.php?title=Str_%28command%29

Just remember that any result from a "str" command is put in the #strRes system variable.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline MeWonUo

  • Hero Member
  • *
  • Posts: 913
  • Activity:
    0%
  • Reputation Power: 11
  • MeWonUo barely matters.MeWonUo barely matters.
  • Gender: Male
  • Respect: +85
  • Referrals: 1
    • View Profile
Re: Quick response help needed!
« Reply #5 on: August 21, 2012, 12:33:33 PM »
0
I've been trying to wrap my head around strings the past couple days as well.

These 2 pages over at easy have helped me get a little bit of a grasp on how they work.

http://www.easyuo.com/forum/viewtopic.php?f=9&t=11517
http://www.easyuo.com/forum/viewtopic.php?f=9&t=11698

Hope it can be of some use to you as well.

Offline freddy

  • Sr. Member
  • *
  • Posts: 271
  • Activity:
    0%
  • Reputation Power: 4
  • freddy has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 1
    • View Profile
Re: Quick response help needed!
« Reply #6 on: August 21, 2012, 02:58:08 PM »
0
string manipulation in EUO is not fun. I know i helped you over icq, but imma post the code so other's can see how to do it.

Code: [Select]
gosub parse_price %item_to_scan price: 6
display #result
gosub parse_price %item_to_scan remaining: 10
display #result
pause
;-------------------------------------------------------------
;-------------------------------------------------------------
sub parse_price
set %item %1
set %scan %2
set %spaces %3
set %lpc #lpc
set #lpc 1000
set %comma ,
set %combined_price
finditem %item *
event property #findid
set %string_to_parse #property
str len %string_to_parse
set %string_length #strres
str pos %string_to_parse %scan
set %del_pos #strres + %spaces
str del %string_to_parse 1 %del_pos
set %string_to_parse #strres
str pos %string_to_parse $
set %new_delete_pos #strres - 1
str left %string_to_parse %new_delete_pos
set %price #strres , %comma
gosub separate_string %price ,
for %i 1 %t_num
set %combined_price %combined_price , %return . %i
set #lpc %lpc
return %combined_price
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------

Offline dxrom

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +100
  • Referrals: 1
    • View Profile
Re: Quick response help needed!
« Reply #7 on: August 21, 2012, 11:39:33 PM »
0
string manipulation in EUO is not fun.
Spoiler: show
I know i helped you over icq, but imma post the code so other's can see how to do it.

[code]
gosub parse_price %item_to_scan price: 6
display #result
gosub parse_price %item_to_scan remaining: 10
display #result
pause
;-------------------------------------------------------------
;-------------------------------------------------------------
sub parse_price
set %item %1
set %scan %2
set %spaces %3
set %lpc #lpc
set #lpc 1000
set %comma ,
set %combined_price
finditem %item *
event property #findid
set %string_to_parse #property
str len %string_to_parse
set %string_length #strres
str pos %string_to_parse %scan
set %del_pos #strres + %spaces
str del %string_to_parse 1 %del_pos
set %string_to_parse #strres
str pos %string_to_parse $
set %new_delete_pos #strres - 1
str left %string_to_parse %new_delete_pos
set %price #strres , %comma
gosub separate_string %price ,
for %i 1 %t_num
set %combined_price %combined_price , %return . %i
set #lpc %lpc
return %combined_price
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string
  set %t_num 0
  str Count %1 %2
  for %i 1 #strres
  {
    set %var %2
    str len %1
    set %length #strres
    str pos %1 %var
    set %del #strres - 1
    str left %1 %del %length
    set %return . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %t_num %t_num + 1
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------
[/code]


^ This, is exactly why I never ventured into EUO's string logic, and stay away from anything GUI/Gump related. Sure it can do some cool stuff when you get it down, but honestly I'd rather just painstakingly decrypt hashes by hand all day if given the choice.



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Tags: