Author Topic: Quick question  (Read 3038 times)

0 Members and 1 Guest are viewing this topic.

Offline Dude1598Topic starter

  • Jr. Member
  • **
  • Posts: 56
  • Activity:
    0%
  • Reputation Power: 0
  • Dude1598 has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Quick question
« on: June 08, 2010, 05:36:19 AM »
0
I am trying to write my first script which is to use wool from a container, make yarn and then use yarn on loom to make cloth. The problem I am having is using the wool from the container. Also I have read the tutorials here and over at Easyuo and I cant find a way to use this item on this item.


Code: [Select]

This is the code so far for the yarn onto the loom

  findItem *** C_ , #backpackID
    if #findKind = -1
      halt
  set #lobjectID #findID
  set #ltargetKind 1
  event macro 17 0
  target 3
  event macro 22 0
  wait 20
return

« Last Edit: June 08, 2010, 05:37:54 AM by Dude1598 »

Offline Masscre

  • Gran Master Jester !!
  • Scripthack
  • *
  • Posts: 4615
  • Activity:
    0%
  • Reputation Power: 55
  • Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!Masscre is leading the good life!
  • Gender: Male
  • Air Guitar Commander !!
  • Respect: +144
  • Referrals: 1
    • View Profile
Re: Quick question
« Reply #1 on: June 08, 2010, 05:45:58 AM »
0
I am assuming for this code snippet you have the Wool ID and with this you are trying to find the wool and then place it on thespinning wheel.  You will need the id of a spining wheel to actually place it on the spinning wheel this part you are missing from here.

Offline Dude1598Topic starter

  • Jr. Member
  • **
  • Posts: 56
  • Activity:
    0%
  • Reputation Power: 0
  • Dude1598 has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Quick question
« Reply #2 on: June 08, 2010, 05:57:57 AM »
0
FindItem *** C_ , #ContainerID

Will it be alright if I use this and have the container open with the wool in it ?

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: Quick question
« Reply #3 on: June 08, 2010, 06:21:19 AM »
0
FindItem *** C_ , #ContainerID

Will it be alright if I use this and have the container open with the wool in it ?
Yes, should be fine.

A couple pointers -

I would recommend "declaring" your variable values at the top of the script to make your life easier among other things. Also, you will need a loop to go through an entire stack of wool and yarn. Below is an example where I loop throught the wool then loop through the yarn. This is very basic with no error or syntax checked because I'm at work and am simply avoiding working ;) hopefully this at least gives you something to chew on.

Code: [Select]
 set %WoolTypes XXX_XX2_XX3 ;whatever the types are
  set %YarnTypes XXX_XX2_XX3 ;whatever the types are
  set %LoomTypes XXX_XX2_XX3 ;whatever the types are
  set %SpinningWheelTypes XXX_XX2_XX3 ;whatever the types are
  set %BoltTypes XXX_XX2_XX3 ;whatever the types are, you will likely want to move these back to the secure at some point in the script
  set %NoYarn #FALSE
  set %NoWool #FALSE

;MainLoop
Repeat
  gosub Wool2Yarn
  gosub Yarn2Bolt
Until %NoYarn = #TRUE && %NoWool = #TRUE

sub Wool2Yarn
  Repeat
    findItem %WoolTypes C_ , #backpackID
    if #findkind = -1
      set %NoWool #TRUE
    else
      {
      set #lobjectID #findID
      event macro 17 0
      findItem %SpinningWheelTypes G_4 ;first you have to find the Loom, change 4 to whatever you need for radius
      set #lobjectID #findID ;then prep the Last Target event by loading the Loom as last target
      set #ltargetKind 1
      event macro 22 0
      wait 20
      }
  Until %NoWool = #TRUE
return

sub Yarn2Bolt ;now do the same thing with your Yarn on Loom
  Repeat
    findItem %YarnTypes C_ , #backpackID
    if #findkind = -1
      set %NoYarn #TRUE
    else
      {
      set #lobjectID #findID
      event macro 17 0
      findItem %LoomTypes G_4
      set #lobjectID #findID
      set #ltargetKind 1
      event macro 22 0
      wait 20
      }
  Until %NoYarn = #TRUE
return

Like I said, I'm at work and typing quickly so hopefully I didn't miss anything there. Does that make sense?

X
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 Dude1598Topic starter

  • Jr. Member
  • **
  • Posts: 56
  • Activity:
    0%
  • Reputation Power: 0
  • Dude1598 has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Quick question
« Reply #4 on: June 08, 2010, 11:12:34 AM »
0
Thanks, this makes sense to me I want to start out small and understand the basics before I tackle bigger things

Offline Dude1598Topic starter

  • Jr. Member
  • **
  • Posts: 56
  • Activity:
    0%
  • Reputation Power: 0
  • Dude1598 has no influence.
  • Respect: +5
  • Referrals: 0
    • View Profile
Re: Quick question
« Reply #5 on: June 09, 2010, 12:34:24 PM »
0
Now when trying to use the loom it still has the spinning wheel as the last object. Can I use this to make sure it uses the loom ?
Code: [Select]
FindItem %LoomType

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: Quick question
« Reply #6 on: June 09, 2010, 02:21:33 PM »
0
Yes, absolutely.

Tags: