Author Topic: Usefull subs  (Read 3407 times)

0 Members and 1 Guest are viewing this topic.

Offline NadoedaloTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 0
  • Nadoedalo has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Usefull subs
« on: November 03, 2011, 06:21:53 AM »
0
Hi 2 all!
I need some subs in order to start working on my BOD gatherer/filler/sorter system
Last two major parts has lots of examples, so I will need only to modify and loop em(but it will be nice if you will shove me best(fast&stable&with good code) script for those two.
And about gatherer - there are lots of em too, but none of them can recall, drop bod in secure and move in order to safe logout in a house.
The system will be like this :
1) Matherial gatherers will work with that house too. So resources(ingots mostly) will be dropped into one chest
2) Log in -> recall to BS&Tailor -> take bods-> recall home -> drop BOD -> move to a safe tile -> logout
3) Just gathered bods(tailor&bs in separate) will be dropped in the chest
4) Then they will be tooked from this chest and filled, then moved to the other chest
5) From filled chest it will be sorted to bod books(until there will be 500 in a book), or I don't know - maybe big bods may be filled too, etc.

So I need :
1) Login system that can accept login name(password will be default for all accounts) and position of the character in the list. Needs to be TOTALLY STABLE.
2) Small rail engine that can move to a specific location. Needs to be stable.
3) Recall sub? Saw some realisations of this.
4) Follow the bod giver&accept bod
5) Pre filter(I don't need large bod for weapons or bone) - if no need in this -> drop into a trash can in a house.

The main part is login system, other are much more easier.

PS also need a script that will launch clients and log in all characters and keep em logged and start all of this scripts.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +578
  • Referrals: 11
    • View Profile
Re: Usefull subs
« Reply #1 on: November 03, 2011, 06:38:26 AM »
0
I have something I'm writing and I also could use some subs to help. Here's what I want to do:

1 - log in
2 - do stuff
3 - do more stuff
4 - log out

All I need is some subs that will:

1 - log in
2 - do stuff
3 - do more stuff
4 - log out

Anyone help me out here?
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +260
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Usefull subs
« Reply #2 on: November 03, 2011, 06:56:08 AM »
0
I have something I'm writing and I also could use some subs to help. Here's what I want to do:

1 - log in
2 - do stuff
3 - do more stuff
4 - log out

All I need is some subs that will:

1 - log in
2 - do stuff
3 - do more stuff
4 - log out

Anyone help me out here?
Cerv is a bad Boy :P

@Author:
I dunno if people here just share their Code and then you can easy combine it and work with it. If you want to use you should check existing scripts and use the Code.
Else you mustr Code by yourself. I will try to give you the hint how to Code;)
1) Login:
You have 3 Screens to do:
     -Account Login : You will need to do 1 Click to Accountname, use a loop to delete old Data and insert your Accountdata from a Variable. Second Click you need to Click on Password, when old **** are in , a secure way would be all the time autodelete via Loop to clean the Field, then enter Password. Last Click will be the Green Arrow to Login.
-Choose Shard Login : IF Selected Account want to Connect to Freeshard, select World 1, else Have a Variable or something to prefer your liked select world. Then you should have an Algoratmh to Calculate the World to be selected. Select World Click on Green Arrow.
-Char Choosing: Have an Algorythm for Freeshards and OSI how to select the right char Press Green Arrow to Login.
Login is Done.

@@Hints: -You could use Msg %Accountname for Save entering the Account name and Password, but dont forget some waitdelays else you never will be able to enter the right info
- Test your 3 Screens seperate to get a perfect Sub each part and Combine each other to 1 Minor Sub for Login.

Okay think this should help you to get a Login. Feel free to post your Version and we may help you to perfectionate it. When that Task is done, we could analyze next...



Crome


Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13306
  • 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: +2180
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Usefull subs
« Reply #3 on: November 03, 2011, 06:58:59 AM »
0
hunt around the site and EUO as well.  I'm sure there are all the necessary subs available if you do a little looking.  You'll have to write a bunch yourself though to glue it all together.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline freddy

  • Sr. Member
  • *
  • Posts: 271
  • Activity:
    0%
  • Reputation Power: 4
  • freddy has no influence.
  • Gender: Male
  • Respect: +56
  • Referrals: 1
    • View Profile
Re: Usefull subs
« Reply #4 on: November 03, 2011, 07:23:52 AM »
0
I have something I'm writing and I also could use some subs to help. Here's what I want to do:

1 - log in
2 - do stuff
3 - do more stuff
4 - log out

All I need is some subs that will:

1 - log in
2 - do stuff
3 - do more stuff
4 - log out

Anyone help me out here?


Code: [Select]
;==================================
; Script Name: Freddy's Login/out subs
; Author: Freddy
; Version: 1.0
; Client Tested with: 5. Something
; EUO version tested with: 1.5 (Build 0064)
; Shard: ALL
; Revision Date: 10-09-2011
; Purpose: Logs in or out of a shard of your choice
;==================================
;----------------------------------------------------------------------
;----------------------------------------------------------------------
set %acc_name account_ ;your account name - must end with an under score
set %acc_pass password_ ;your password - must end with an under score
set %acc_shard Atlantic_ ; atlantic ;your shard name
set %char_slot  3
;-----------------------Don't Edit Below-------------------------------
;----------------------------------------------------------------------
set %del_space 16 ; amount of spaces to delete
set %shardloop 0
set %login 0
set #lpc 1000
gosub separate_string_shard %acc_shard _
gosub separate_string_acc %acc_name _
gosub separate_string_pass %acc_pass _
set #lpc 20
set %acc_current %areturn1
set %pass_current %preturn1
set %acc_num

mainloop:
for %o 1 %s_num
{
  set %shardloop %shardloop + 1
  if %shardloop > %s_num
    set %shardloop 1
  set  %c_shard %sreturn . %shardloop
  gosub acc_login %acc_current %pass_current 1 %c_shard  %char_slot
  if #result = #false
    goto mainloop

;your code goes here

  
wait 5s
  gosub logout
  set %login 1
  set %cycle %cycle + 1  ;this counts how many times you have logged in
}
goto mainloop
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub acc_login
  namespace push
  namespace local acc_login
  set !acc %1
  set !pwd %2
  set !slot %3
  set !shard %4
  gosub set_shard !shard
  gosub enter_details
  if #result = #false
    return #false
  gosub choose_shard
  gosub pick_char %5
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub pick_char
  namespace push
  namespace local set_charslot
  loop_c:
  set !slot %1
  set %gump #contname
  set !slot_form ( 127 + ( !slot - 1 ) * 40 )
   click 350 !slot_form d
   wait 1
   click 350 !slot_form d
  if #contname = %gump
  goto loop_c
  namespace clear
  namespace pop
return
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub enter_details
  if #contname = MainMenu_gump
  {
    if %login = 0
    {
      gosub del_space 525_360
      msg !acc
      wait 10
    }
    gosub del_space 525_400
    msg !pwd
    key enter
    wait 10
    gosub wait_gump3 normal_gump 640_480 45
    if #result = dead
    {
      set %acc_num %acc_num + 1
      if %acc_num > %a_num
      {
        Display There are problems with all accounts!
        halt
      }
      set %acc_current %areturn . %acc_num
      set %pass_current %preturn . %acc_num
      gosub click_button 200_255
      set %login 0
      return #false
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub choose_shard
  if #contname = normal_gump
  {
    key enter
    wait 20
    gosub wait_gump2 Login_gump 640_480 45
    if #result = create
    {
      gosub create_character
      return
    }
  }
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub create_character
  namespace push
  namespace local creat_character
  gosub click_button 255_400
  gosub wait_gump CharCreation_gump 640_480 10
  gosub click_button 350_80
  msg %char_name
  key enter
  gosub wait_gump normal_gump 640_480 10
  gosub click_button 290_185
  gosub wait_gump map_gump 640_480 10
  gosub click_button 111_135
  wait 8
  gosub click_button 617_447
  wait 10
  namespace clear
  namespace pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub set_shard
  namespace push
  namespace local set_shard
  gosub find_shard %1
  set #lshard #result
  namespace clear
  namespace pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub find_shard
  namespace push
  namespace local lshard_setup
  namespace pop
  nameSpace Copy ret* From Local acc_login
  set !shard %1
  if !shard = atlantic
    return 0
  if !shard = LakeSuperior
    return 1
  if !shard = Pacific
    return 2
  if !shard = greatlakes
    return 3
  if !shard = baja
    return 5
  if !shard = chesapeake
    return 6
  if !shard = napavalley
    return 7
  if !shard = catskills
    return 8
  if !shard = sonoma
    return 9
  if !shard = lakeaustin
    return 10
  if !shard = siegeperilous
    return 12
  if !shard = legends
    return 14
  if !shard = sakura
    return 16
  if !shard = mugen
    return 18
  if !shard = oceania
    return 19
  if !shard = yamato
    return 20
  if !shard = asuka
    return 21
  if !shard = wakoku
    return 22
  if !shard = hokuto
    return 23
  if %1 = europa
    return 24
  if !shard = drachenfels
    return 25
  if !shard = formosa
    return 26
  if !shard = Izumo
    return 27
  if !shard = Arirang
    return 28
  if !shard = balhae
    return 29
  if !shard = minuho
    return 31
  if !shard = origin
    return 45
  namespace clear
  namespace pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub del_space
  namespace push
  namespace local delete_box
  gosub click_button %1
  for !i 1 %del_space
    key back
  namespace clear
  namespace pop
return
;----------------------------------------------------------------------
;----------------------------------------------------------------------
sub click_button
  set !parsestring %1 , _
  gosub separate_string !parsestring _
  set !clickx #contposx + %return1
  set !clicky #contposy + %return2
  click !clickx !clicky
return
;-------------------------------------------------------------
;-------------------------------------------------------------
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
;-------------------------------------------------------------
;-------------------------------------------------------------
sub logout
  wait 1s
try_again:
  event macro 31 0
  wait 15
  event macro 8 1
  gosub wait_gump paperdoll_gump 262_324 10
  if #result <> #true
  {
    set %tloop %tloop + 1
    if %tloop >= 5
    {
      display Can't open your paperdoll to log off. Something is wrong.
      halt
    }
    goto try_again
  }
  wait 15
  gosub click_button 220_110
  event macro 31 0
  wait 15
try_again2:
  gosub wait_gump YesNo_gump 178_108 10
  set %clickx #contposx + 120
  set %clicky #contposy + 85
  click %clickx %clicky
  gosub wait_gump MainMenu_gump 640_480 10
  if #result = #false
    goto try_again2
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub wait_gump
  set %timer #scnt + %3
  repeat
    if #contsize = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
  until #scnt >= %timer
  set %4 n/a
return #false
;-------------------------------------------------------------
;-------------------------------------------------------------
sub wait_gump2
  set %timer #scnt + %3
  repeat
    if #contsize = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
    if #contname = CharCreation_gump
      return create
  until #scnt >= %timer
  set %4 n/a
return #false
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string_shard
  set %s_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 %sreturn . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %s_num %s_num + 1
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string_acc
  set %a_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 %areturn . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %a_num %a_num + 1
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub separate_string_pass
  set %p_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 %preturn . %i #strres
    set %del1 %del + 1
    str del %1 1 %del1
    set %1 #strres
    set %p_num %p_num + 1
  }
return
;-------------------------------------------------------------
;-------------------------------------------------------------
sub wait_gump3
  wait 1s
  set %timer #scnt + %3
  repeat
    if #contsize = %2 && #contname = %1
    {
      set %4 n/a
      return #true
    }
    if #contsize = 408_288 && #contname = waiting_gump
      return dead
  until #scnt >= %timer
  set %4 n/a
return #false
;-------------------------------------------------------------
;-------------------------------------------------------------


This works with multiple accounts.
« Last Edit: November 03, 2011, 07:28:47 AM by freddy »

Offline NadoedaloTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 0
  • Nadoedalo has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Usefull subs
« Reply #5 on: November 03, 2011, 09:36:30 AM »
0
2 Cerveza exactly  ;D
2 Crome9698 that is basic. But what about checks(sometimes it is just stuck) and starting new client?
Quote
If you want to use you should check existing scripts and use the Code.
I looked through scriptuo and easyuo boards and haven't found snippets that will fit for me perfectly(as always)
The best example is Raziel's Bod Gathering Script, but it is too complex to modify. Actually I need to do this, so maybe this will be the starting point.
Basicly I need just a snippet that will accept only name of account and place of character in account and will return 0 or 1, no multyshards or anything else.
Simplicity is a key to perfect application =)

2 freddy thx for subs. Will try to understand how it is working.
PS no comments and looks a lot like raziels script.

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: +571
  • Referrals: 1
    • View Profile
Re: Usefull subs
« Reply #6 on: November 03, 2011, 09:39:55 AM »
0
In its most basic form a login script in pseudo code is

Click  in password filed
msg passwordscript $
key <enter>
wiat for shardseletion screen
key <enter>   load last shard
wait for charselection screen
click on x y of char postion
wait for charname = charname and #clilogged <> 0


Just turn that into real code and your done. simple simple.. almost a line for line substitution... almost
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 NadoedaloTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 0
  • Nadoedalo has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Usefull subs
« Reply #7 on: November 03, 2011, 12:20:30 PM »
0
the thing is that
Code: [Select]
wait for shardseletion screen and
Code: [Select]
wait for charselection screen isn't so simple =) There are no methods of cheking on this, and just smth like "wait 2s" can't be stable.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +578
  • Referrals: 11
    • View Profile
Re: Usefull subs
« Reply #8 on: November 03, 2011, 12:24:31 PM »
0
Are they not gumps? Do they not have gump names and sizes??

;)
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

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: +571
  • Referrals: 1
    • View Profile
Re: Usefull subs
« Reply #9 on: November 03, 2011, 12:26:17 PM »
0
the thing is that
Code: [Select]
wait for shardseletion screen and
Code: [Select]
wait for charselection screen isn't so simple =) There are no methods of cheking on this, and just smth like "wait 2s" can't be stable.

Dont be silly. what you mean is you dont know an easy way of checking but believe me this has been addressed a million times and is extremely simple, all you have to do is ask, or better yet review others scripts to see how its done... like freddys snippet above .... below will work with editing for all wait for cont stuff.

Code: [Select]
; edit blabla for correct values.
set %timeout #scnt + 20  ; waits a max of 20 seconds for the screen to appear.
while #contname <> blabla && #contsize <> blabla2 && #scnt < %timeout
   wait 1

Now its all up to you .. get cracking....  not writting this thing for you, I don't mind helping you when your stuck but you have to do the work. You will find that most in fact feel this way.  What you want is not a 5 min thing all the code you need is freely available if you know where to look but you have to assemble it.

So you should have everything you need now for the first part of your script.. the login... get that done than we can help you move on to the next part.



« Last Edit: November 03, 2011, 12:37:04 PM 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 NadoedaloTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 0
  • Nadoedalo has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Usefull subs
« Reply #10 on: November 03, 2011, 02:51:21 PM »
0
I actually don't know lots of basic examples, like working with gumps. So I just need examples.
Thanx to Endless Night, will work on it.
PS now I'm too busy with SOAP, so will up this thread later.

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: +571
  • Referrals: 1
    • View Profile
Re: Usefull subs
« Reply #11 on: November 03, 2011, 03:31:28 PM »
0
no worries when your ready... just post back here when your ready to continue.
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."

Tags: