Author Topic: Filling Book from Scrolls in Backpack  (Read 8283 times)

0 Members and 1 Guest are viewing this topic.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Filling Book from Scrolls in Backpack
« on: April 07, 2015, 08:40:19 PM »
0
I am having difficulty filling a spellbook from scrolls in my backpack. I am crafting a circle at a time and then want to drop them into the spellbook but it is getting hung up after making them.

Code: [Select]
    Finditem %Mage_Book C_ , #backpackid
    set %Mage_Book #ltargetID

   for %N 1 %N_Spells ; 1 to the # of spells in the book
    {
     gosub DragToSpellbook #backpackid %Mage_Book %scroll . %N ; %Scroll . %N = %Scroll(whatever value N Has)
    }

I have the %Mage_Book set at the beginning of the script
Code: [Select]
set %Mage_Book MPF
I know it is something simple that I am overlooking in the script id'ing the book and setting it as the target

Code: [Select]
sub DragToSpellbook
  ;set %1 %ScrollSecure
  ;set %2 %spellbook
  ;set %3 %scroll . %N

  finditem %1 G_2
  if #FINDKIND = -1
    return N/A
    finditem %3 C_ , %1
    if #FINDKIND <> -1
    {
      exevent drag #FINDID 1
      wait 10
      exevent dropc %2
      wait 10
    }
return

Do I need to do something different with the backpack since I am treating it like a secure?

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +245
  • Referrals: 0
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #1 on: April 08, 2015, 07:14:12 AM »
0
Not that I'm a pro   but  I'm sure you need to use ID of the book not type. 

Try to set the book first.

 
Code: [Select]
Display Target Your Spell Book to fill
set #targcurs 1
While #Targcurs = 1
Wait 1
set %2 #Ltargetid


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: Filling Book from Scrolls in Backpack
« Reply #2 on: April 08, 2015, 07:59:36 AM »
0
As ghost said above.... your error is what you set mage_book to0. I would recommend you don't use the same var for both type and id

error code
Code: [Select]
Finditem %Mage_Book C_ , #backpackid
    set %Mage_Book #ltargetID

Surely you should be setting a different var with for magebookid  and also using the foundid not the last target. ie

Code: [Select]
  Finditem %Mage_Book C_ , #backpackid
    set %Mage_Book_ID #findID    ; changes

   for %N 1 %N_Spells ; 1 to the # of spells in the book
    {
     gosub DragToSpellbook #backpackid %Mage_Book_ID %scroll . %N ; changed mage_book to mage_book_Id
    }
« Last Edit: April 08, 2015, 08:01:37 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 CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #3 on: April 08, 2015, 12:39:43 PM »
0
Not that I'm a pro   but  I'm sure you need to use ID of the book not type. 

Try to set the book first.

 
Code: [Select]
Display Target Your Spell Book to fill
set #targcurs 1
While #Targcurs = 1
Wait 1
set %2 #Ltargetid



I am working on having my spellbook filler craft a book, craft a circle of spells, drop them onto spellbook, craft another circle etc. Right now this is separate but I hope to integrate it into my filler script. That way it can fill from scrolls in secure or craft and fill. I want it to find it automatically instead of user targeting.

Eventually when I am better, I will play with OCR so it will fill from secure and then craft and fill missing scrolls and complete spellbook. That will probably be a long time from now though lol. I am still working on scripting my way out of a wet paper bag, lol.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #4 on: April 08, 2015, 12:40:50 PM »
0
As ghost said above.... your error is what you set mage_book to0. I would recommend you don't use the same var for both type and id

error code
Code: [Select]
Finditem %Mage_Book C_ , #backpackid
    set %Mage_Book #ltargetID

Surely you should be setting a different var with for magebookid  and also using the foundid not the last target. ie

Code: [Select]
  Finditem %Mage_Book C_ , #backpackid
    set %Mage_Book_ID #findID    ; changes

   for %N 1 %N_Spells ; 1 to the # of spells in the book
    {
     gosub DragToSpellbook #backpackid %Mage_Book_ID %scroll . %N ; changed mage_book to mage_book_Id
    }

I will look at this and give it a try after making the changes to my spellbook filler.  ;D

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #5 on: April 09, 2015, 04:38:54 PM »
0
The other didn't work, after looking at the target spellbook snippet

Code: [Select]
Display Choose the spellbook that you want to fill...
    set #targcurs 1
    while #targcurs = 1
    wait 5
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
    wait 10

I decided to try and modify it to autotarget a spellbook in the pack instead of a user having to manually target it

Code: [Select]
    Finditem %Mage_Book C_ , #backpackid
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
    wait 10

I put it into this sub here,

Code: [Select]
sub craftandfill

    ;craftspells not included here because it is working just fine to craft the scrolls, now i need it to fill the book

    findItem * C_ , #backpackid
    set %ScrollSecure ;not sure if I need this since it sets it on the next line but leaving it in here for now
    set %ScrollSecure #ltargetid
    set #lobjectid %ScrollSecure
    wait 10

    Finditem %Mage_Book C_ , #backpackid
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
   
 gosub SetSpells
 
for %N 1 %N_Spells ; 1 to the # of spells in the book
{
gosub newstatus lime black 10 Filling Scroll %n :  %N_Spells
gosub DragToSpellbook %ScrollSecure %spellbook %scroll . %N ; %Scroll . %N = %Scroll(whatever value N Has)
}

Thanks to the menu status EN suggested, I added it here as well and I can see that it is trying to drop the spells in my bag onto the book, they just aren't going. Well I guess I should say I see the status going through the different scrolls but nothing is being dropped and I am not hearing anything being moved. I did not add the sub for setspells nor the crafting sub that crafts the scrolls before it tries to fill the spellbook on here but it is in the script.

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: Filling Book from Scrolls in Backpack
« Reply #6 on: April 09, 2015, 04:46:44 PM »
0
Another interesting (and faster) method is to context click the scroll.  This brings up a 1 entry context menu that lets you target the spellbook to drop the spell into.  It's actually faster than clicking/dragging the spells.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #7 on: April 09, 2015, 05:07:26 PM »
0
Another interesting (and faster) method is to context click the scroll.  This brings up a 1 entry context menu that lets you target the spellbook to drop the spell into.  It's actually faster than clicking/dragging the spells.

I am not sure what you mean, on OSI anyways, when I single click on a scroll nothing happens. I am confused but I am always up for a new way that is better.

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: Filling Book from Scrolls in Backpack
« Reply #8 on: April 09, 2015, 06:09:36 PM »
0
I am not sure what you mean, on OSI anyways, when I single click on a scroll nothing happens. I am confused but I am always up for a new way that is better.

Right click?  I kinda remember now that might have only been a RunUO thing..
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #9 on: April 09, 2015, 06:20:40 PM »
0
I think so, when I right click it, my backpack closes.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #10 on: April 09, 2015, 08:17:10 PM »
0
The other didn't work, after looking at the target spellbook snippet

Code: [Select]
Display Choose the spellbook that you want to fill...
    set #targcurs 1
    while #targcurs = 1
    wait 5
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
    wait 10

I decided to try and modify it to autotarget a spellbook in the pack instead of a user having to manually target it

Code: [Select]
    Finditem %Mage_Book C_ , #backpackid
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
    wait 10

I put it into this sub here,

Code: [Select]
sub craftandfill

    ;craftspells not included here because it is working just fine to craft the scrolls, now i need it to fill the book

    findItem * C_ , #backpackid
    set %ScrollSecure ;not sure if I need this since it sets it on the next line but leaving it in here for now
    set %ScrollSecure #ltargetid
    set #lobjectid %ScrollSecure
    wait 10

    Finditem %Mage_Book C_ , #backpackid
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
   
 gosub SetSpells
 
for %N 1 %N_Spells ; 1 to the # of spells in the book
{
gosub newstatus lime black 10 Filling Scroll %n :  %N_Spells
gosub DragToSpellbook %ScrollSecure %spellbook %scroll . %N ; %Scroll . %N = %Scroll(whatever value N Has)
}

Thanks to the menu status EN suggested, I added it here as well and I can see that it is trying to drop the spells in my bag onto the book, they just aren't going. Well I guess I should say I see the status going through the different scrolls but nothing is being dropped and I am not hearing anything being moved. I did not add the sub for setspells nor the crafting sub that crafts the scrolls before it tries to fill the spellbook on here but it is in the script.

This is driving me nuts, could it be because I haven't actually targeted the spellbook? I tried to target it using event macro 8 5 but that ended up opening the spellbook on my paperdoll :(

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: Filling Book from Scrolls in Backpack
« Reply #11 on: April 09, 2015, 08:56:07 PM »
0
I posted a filler script at RebirthUO in this thread that might give you some ideas:

http://rebirthuo.com/Community/index.php?threads/need-help-with-script.1167/
Please read the ScriptUO site RULES
Come play RIFT with me!

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: Filling Book from Scrolls in Backpack
« Reply #12 on: April 10, 2015, 05:17:22 AM »
0
Ok 2 errors in this code

Code: [Select]
  Finditem %Mage_Book C_ , #backpackid
    set %spellbook #ltargetID
    Finditem %spellbook
    set %booktype #findtype
    wait 10

Firstly If you want to set %spellbook to a found book you must set it to #findid  not #Ltargetid (LAST TARGET)  Remember when scripting its the same as doing things manually.  When you find something you are not TARGETing it therefor LASTTARGET is not set.

General overview of when you do a finditem it creates and array of items that match the search criteria.  This array of item is  0... #findcnt  (findcount)   For every item found it sets a whole bunch of #find???  vars   EUO WIKI OF FINDITEM  Scroll down to related commands to see list of vars set.    

Right after you do a finditem the var  #findindex is set to 1  if one or more items are found.  If you want to look at the 5th spellbook found you set #findindex 5     ... 2nd set #findindex 2  etc.   This way you can loop through all the found items eg for #findindex 1 #findcount


Now back to your code...   you do a finditem  then set the %spellbook to lasttarget (not anything that was found but what ever you happened to target prior to running the script or while running script)...   then you find the lasttarget and set booktype to its type.  As you can see you will be getting nonesense values .. lets fix it

Code: [Select]
  Finditem %Mage_Book C_ , #backpackid
    If #findcnt >0
      {
      set %spellbook #findid
      set %booktype #findtype
      wait 10
      }
    else
       {
      display ok error no spellbook found  fix that and start again
      halt
      }

(A) set %spellbook to #findid   (first item found)
(b) No need to find it again we just did that .. so set %booktype to #findtype  without doing another search.
(c) added an if condition incase no spellbooks found
« Last Edit: April 10, 2015, 05:19:35 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 CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3016
  • Activity:
    3.6%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Filling Book from Scrolls in Backpack
« Reply #13 on: April 10, 2015, 03:27:22 PM »
0
ok, that doesn't seem to be working either so it may be something else that I over looked as well. I was trying to hold off putting up what I had because it is in the very beginning stages and I was going to add it to my filler once I had the kinks worked out. Mwinc told me I could use his crafting subs so I put them to use in this. At this time, it is supposed to craft a magery spellbook, craft all of the first circle spells and then drop them into the spellbook that was just crafted.

I have the %Resource_Container hardcoded at the top for now so you will need to add yours there because the script won't ask for it.

If it is finding the spellbook fine, did I make an error trying to use the backpack to pull scrolls from to drop in the book?


There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Crisis Spellbook Craft and Fill Beta.txt

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: Filling Book from Scrolls in Backpack
« Reply #14 on: April 11, 2015, 09:17:47 AM »
0
Tell us how it is failing....

does it craft book
does it craft scrolls

Give us a clue so we don't have to run it to help debug...

..
..
..

LOL  is it by chance not placing the scrolls in the book ??

IF so your error is the same code that you removed from your other script...  in the dragtospellbook sub you still have it do nothing if the spell is not on the floor...

remove all this code    "finditem %1 G_2     if #FINDKIND = -1   return N/A"


Just to confirm something .. you do understand that when you are in a sub and the code reaches a return line it exits the sub and returns to the line right after the gosub command.  It does not continue reading any more code in the sub even if their are 100 more lines in the sub.  eg

Code: [Select]
gosub test
display ok here i am i exited early  nothing was displayed
gosub test somethingofother
display ok sub printed bunch of nonsesne cool
halt

sub test
  if %0 = 0
     return    ; no vars passed
  ; all code below here is never executed if %0=0
  set %p 6
  set %p %p x 2
  display wow more code im in a sub
  display that is one cool sub
return
« Last Edit: April 11, 2015, 09:23:14 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."

Tags: