Author Topic: set #lobjectid #findid  (Read 5894 times)

0 Members and 1 Guest are viewing this topic.

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +117
  • Referrals: 1
    • View Profile
set #lobjectid #findid
« on: November 24, 2009, 02:34:37 AM »
0
Got a question about this here.  With using waitforgump sub from masses relic machine if it takes too long, to halts the script.  I want to make this a better sub, let me show you a small example.

Okay this calls to make an item, as you can see it will pause the script if the gump dont open....
Code: [Select]
Sub MakeItem
    finditem %Tongs C_ , #BackPackid
    set #lobjectid #findid
    event macro 17
          gosub waitforgump %cwin
          if ! #result
          {
          display ok Problems with crafting menu.  Dble Click tongs and click play  ;<-----------HERE
          pause
          }
    click %makelastx %makelasty
          gosub waitforgump %cwin
          if ! #result
          {
          display ok Problems with crafting menu.  Dble Click tongs and click play    ;<-----------HERE
          pause
          }
    click %exitx %exity
    finditem %boom C_ , #BackPackID
             {
             if #findcnt > 0
             set %Madeboom #findid
             gosub Smelt
             }
Return

Now my idea here is this, can I change it to this....

Code: [Select]
Sub MakeItem
    craftloop:                                       ;<---------CHANGE
    finditem %Tongs C_ , #BackPackid
    set #lobjectid %CurrentTool              ;<---------CHANGE
    event macro 17
          gosub waitforgump %cwin
          if ! #result
          {
          goto craftloop                            ;<-----------CHANGE
          }
    click %makelastx %makelasty
          gosub waitforgump %cwin
          if ! #result
          {
          goto craftloop                            ;<-----------CHANGE
          }
    click %exitx %exity
    finditem %boom C_ , #BackPackID
             {
             if #findcnt > 0
             set %Madeboom #findid
             gosub Smelt
             }
Return

In essence changing

Code: [Select]
    finditem %Tongs C_ , #BackPackid
    set #lobjectid #findid

To

Code: [Select]
    finditem %Tongs C_ , #BackPackid
    set #lobjectid %CurrentTool

Instead of it being #findid it being current tool.  So if the gump dont come up, it will return and try again.
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Offline CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +117
  • Referrals: 1
    • View Profile
Re: set #lobjectid #findid
« Reply #1 on: November 24, 2009, 03:39:29 AM »
0
Nevermind I got it myself lol.
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

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: +861
  • Referrals: 11
    • View Profile
Re: set #lobjectid #findid
« Reply #2 on: November 24, 2009, 05:08:48 AM »
0
Hmm... I see a problem. What if %tongs aren't found?

Code: [Select]
    finditem %Tongs C_ , #BackPackid
    set #lobjectid %CurrentTool              ;<---------CHANGE
    event macro 17

You don't have a bailout if %tongs aren't found, you just continue the script regardless.
Code: [Select]
finditem %Tongs C_ , #backpackID
if #findCnt < 1
  gosub MakeTongs
set %CurrentTool #lobjectID ; you have this backwards, you set the first to the second
event macro 17

Then have a sub to make tongs if you didn't find one, it'll return to this spot and continue. Be sure to set the tongs to last object in the creation sub by doing a findID and setting it.
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 CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +117
  • Referrals: 1
    • View Profile
Re: set #lobjectid #findid
« Reply #3 on: November 24, 2009, 05:11:00 AM »
0
Thanks man
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

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: +861
  • Referrals: 11
    • View Profile
Re: set #lobjectid #findid
« Reply #4 on: November 24, 2009, 05:14:05 AM »
0
Of course, it's a pleasure to help someone who is really interested in learning.

You understand the logic there? Almost always you have to consider a bunch of "what ifs" when you script. What if your tool breaks after making something, what if your out of ingots, what if you can pathfind to whatever, what if.... the list goes on. Just handle them one at a time and you'll do fine.

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 CoraginTopic starter

  • Wacko in Pajama's
  • Elite
  • *
  • *
  • Posts: 1641
  • Activity:
    0%
  • Reputation Power: 23
  • Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...Coragin might someday be someone...
  • Gender: Male
  • It Is What It Is.
  • Respect: +117
  • Referrals: 1
    • View Profile
Re: set #lobjectid #findid
« Reply #5 on: November 24, 2009, 05:25:08 AM »
0
I understand what if's to me, that is easy.  As I said, many times over EUO is way similar to MQ2 for everquest www.macroquest2.com look at the scrips (called macros there).  You will see they are almost identical.  I was very adept at making those, learning the skill checks, and different calls on EUO is the hard part.  And MQ2 has "plugins" that made it even more powerful, I mean WAY powerful.  There was a plugin that let you swing any weapon at any delay you wanted regardless of the delay on the weapon.  so a script for that would look like...

Sub Main
:loop
/attack (This is the command to make you swing your weapon)
/delay 1s (if you even wanted a delay, I usually set mine to /delay 1 or /delay 9)
/goto :loop
Return

So no matter if the weapon had a 1s delay or 9s delay it would swing as fast as you put the command in.  In my case, depending on the creature 100ms or 900ms sometimes /delay 0 which was the shortest possible.  Then you just find the highest dmg weapon and could take down Gods in like 10 seconds.

Anyways, Im rambling lol, but yes I understand the what if's and now understand the brackets too { }.  Soon I am going to get into

for %i

ect and other things.  I WANT to learn, I WANT to contribute, I WANT to help.  Yes a lot of wants there, but they are all good wants.  ;)
Coragin

My Facebook
And now I'm better at doing what ever it is Wolverine does!

Scrripty

  • Guest
Re: set #lobjectid #findid
« Reply #6 on: November 24, 2009, 09:00:18 AM »
0
I've started to really like timeouts as fail safes for a lot of stuff. :)  It's like a backup for a backup. hehe

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: +786
  • Referrals: 1
    • View Profile
Re: set #lobjectid #findid
« Reply #7 on: November 25, 2009, 01:12:43 PM »
0
I've started to really like timeouts as fail safes for a lot of stuff. :)  It's like a backup for a backup. hehe

Now your talking .. everything i write these days is wrapped in at least two exit criteria...
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."

Scrripty

  • Guest
Re: set #lobjectid #findid
« Reply #8 on: November 25, 2009, 01:49:06 PM »
0
I've started to really like timeouts as fail safes for a lot of stuff. :)  It's like a backup for a backup. hehe

Now your talking .. everything i write these days is wrapped in at least two exit criteria...

I also really like repeat/untils... you showed me those.  Repeat loops are a lot of fun, makes doing some things really easy.  I have a LOT of stuff going on in between some things I do, but I want the timing to be exact.  So I set the time right after I do the action, then I have all sorts of things going on, then before I do another action, I make sure that timer is up with a repeat until loop(timer up), and it makes the timing nearly right on.  I love that.  It accounts for the time the script spent doing other things then makes it wait for whatever is left of the time you wanted to wait.  So instead of doing like a wait 40, you set a timer, do some stuff, then do a repeat until(time is up) and it waits whatever is left on the timer if anything to do the next action.  Fun stuff. :)  It allows you to utilize that wait 40 instead of just pausing the script for 40. (2 seconds)  I've ALWAYS hated waits... I want to use that damn time. :)

Edit:  One other interesting note about doing waits this way:  You can put and EXEVENT SYSMSG or something in there and have it display the time it's waiting after your action, and say its waiting one second every time, you can do more stuff to eat some of that up... :)  Lets you really optimize your timings and what you can do in between actions.
« Last Edit: November 25, 2009, 01:54:56 PM by Scripty »

Tags: