Author Topic: Sub nested without return - need new eyes  (Read 5453 times)

0 Members and 1 Guest are viewing this topic.

Offline crameepTopic starter

  • Jr. Member
  • **
  • Posts: 50
  • Activity:
    0%
  • Reputation Power: 0
  • crameep has no influence.
  • Respect: +2
  • Referrals: 1
    • View Profile
Sub nested without return - need new eyes
« on: March 28, 2009, 02:08:35 PM »
0
Hey, cant seem to find it need new eyes. Thanks in advance.

Code: [Select]
  sub findcorpse
    finditem YFM G_15
    if #findkind = -1
    {
      move %startposx %startposy 0 5s
      goto mainloop
    }
    set %body #findid
    if #findx > %startposx + 15 || #findy > %startposy + 15
    {
      goto mainloop
    }
    set wait 10 + %lags Looting
    gosub updatestatus
    move #findX #findy 0 10s
    set #lobjectid %body
    nextCPos 10 10
    wait 10 + %lag
    event macro 17 0
    wait 1s
    set %nt2 #scnt2 + 10
    set %bod #contID
_OQ:
    finditem %loot C_ . #contID
    if #findkind = -1 && %nt2 < #scnt2
      goto _OQ
    wait 13
    set %bod #contid
_findloot:
    finditem %loot C_ . %bod
    if #findkind = -1 || #findbagid = #charid || #findbagid = #backpackid
    {
      event SysMessage finished Corpse.
      ignoreitem %body
      wait 15
      move %startposx %startposy 0 5s
      goto mainloop
    }
    if #weight > #maxweight - 100
    {
      set !amount ( #maxweight - #weight ) * 50
      if !amount > #findstack
        set !amount #findstack
    }
    else
      set !amount #findstack
    exevent drag #findid !amount
    exevent dropc #charid
    wait 1s
    gosub sendgold
    goto _findloot
  return

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: Sub nested without return - need new eyes
« Reply #1 on: March 28, 2009, 02:17:00 PM »
0
Can't tell from this snippet, not enough code.  Looks fine from the syntax editor.  But do you notice that you are "goto"ing out of your subroutine?  That's bad medicine.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #2 on: March 29, 2009, 10:37:42 AM »
0
Ya, thats a big no, no.. I believe its sucks your resources also.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #3 on: March 30, 2009, 05:04:25 AM »
0
Better to handle the Goto's with Return's. I'm unclear as to what you are trying to accomplish here though with your point in the thread title, are trying to NOT use return for some reason?

XII
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline Petkiller

  • Full Member
  • ***
  • Posts: 112
  • Activity:
    0%
  • Reputation Power: 0
  • Petkiller has no influence.
  • Respect: +7
  • Referrals: 2
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #4 on: March 30, 2009, 06:09:31 AM »
0
Just a quick question what is the max number of tiles you can scan?  I see the G_15 so I guess that means 15 tiles what is the practical limit 20 25? 

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: Sub nested without return - need new eyes
« Reply #5 on: March 30, 2009, 06:39:34 AM »
0
In practice, the longest distance I've gotten to is 18.
Please read the ScriptUO site RULES
Come play RIFT with me!

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: +403
  • Referrals: 11
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #6 on: March 30, 2009, 07:38:09 AM »
0
I think I was 'cuttin bones' around 15 reliably. Maybe it was 12, don't remember.
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: +393
  • Referrals: 1
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #7 on: March 30, 2009, 08:18:17 AM »
0
Replace all
   goto mainloop
With
  RETURN


As far reliable tile scanning 18 is my vote.. but i belive the amount of tile radius loaded is a setting someplace in UO isnt it ?
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 crameepTopic starter

  • Jr. Member
  • **
  • Posts: 50
  • Activity:
    0%
  • Reputation Power: 0
  • crameep has no influence.
  • Respect: +2
  • Referrals: 1
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #8 on: March 30, 2009, 12:09:15 PM »
0
Yeah, I guess I wasn't thinking about goto & returns. No particular reason for it just .. too much time in the code I guess. Woops.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #9 on: March 30, 2009, 12:50:03 PM »
0
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • 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: Sub nested without return - need new eyes
« Reply #10 on: March 30, 2009, 12:53:38 PM »
0
Oh man, that's a hideous picture....
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline crameepTopic starter

  • Jr. Member
  • **
  • Posts: 50
  • Activity:
    0%
  • Reputation Power: 0
  • crameep has no influence.
  • Respect: +2
  • Referrals: 1
    • View Profile
Re: Sub nested without return - need new eyes
« Reply #11 on: March 31, 2009, 01:09:01 PM »
0
Yeah, i'll second that one, horrible picture.

Tags: