ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Crafting => Topic started by: Crisis on June 23, 2014, 08:35:58 PM

Title: Crisis Quick and Painless Spellbook Filler 2.3 *UPDATED 04-08-2015*
Post by: Crisis on June 23, 2014, 08:35:58 PM
Code: [Select]
;===================================================================
;===================================================================
; Script Name: Crisis Quick and Painless Spellbook Filler 2.3
; Author: Crisis
; Version: 2.3
; Client Tested with: 7.0.45.0
; EUO version tested with: 1.5 (version 285)
; Shard OSI / FS: OSI
; Release Date: 06/24/2014
; Revision Date: 04/07/2015
; Purpose:
;     .Fill spellbooks with stored spell scrolls Magery, Necromancy, and Mysticism.
;
; Revisions:
;     1.1 fixed typo in mysticism scrolls
;     2.0 Added support for magery scrolls kept in secures by circle
;     2.1 Added ability to hardcode the 8 spell circle containers
;         Adjusted Dragtospellbooksub to take one scroll instead of the whole stack
;         Adjusted a wait 1 to sub Idle to save on system resources
;         Added a return statement at the end of "sub StartMultiSpellbookFiller" and "sub StartSpellbookFiller"
;     2.2 Cleaned up code for better efficiency
;     2.3 Added Script Status
;         Removed code for picking scrolls up from floor
;
; Requirements:
;     . You need to have blank spellbooks and a secure with loose spell scrolls within reach.
;
; Future Updates:
;     . Add a ability to pick up empty books from a secure and drop off full books.
;
; Special Thanks:
;     . Manwinc for helping me learn about parsing and arrays and answering my MANY questions while working on this.
;     . Endless Night for helping me fix mistakes and clean up the code for better efficiency
;
; Copyright: 2014-2015 Crisis
;===================================================================
;===================================================================

Revisions:
1.1 fixed typo in mysticism scrolls
2.0 Added support for magery scrolls kept in secures by circle
2.1 Added ability to hardcode the 8 spell circle containers
      Adjusted Dragtospellbooksub to take one scroll instead of the whole stack
      Adjusted a wait 1 to sub Idle to save on system resources
      Added a return statement at the end of "sub StartMultiSpellbookFiller" and "sub StartSpellbookFiller"
2.2 Cleaned up code for better efficiency
2.3 Added Script Status
      Removed code for picking scrolls up from floor

This will take spell scrolls stored in a secure and fill a spellbook with it. It will work with magery, necromancy, and msyticism scrolls/books.
There is a start/pause button for quick and painless filling of numerous empty or partially filled spellbooks.

It will fill a magery spellbook from 8 different secures if you store them by circle. You can hardcode the secures in or just choose them through the setup.

I used this as a learning tool and to save time and clicks filling spellbooks with all of the loose scrolls that I collect fishing and treasure hunting.

Enjoy and let me know how it works for you!

A special thanks to Manwinc for all his help and patience while I was learning about parsing and arrays and Endless Night for helping me fix mistakes and clean up the code for better efficiency!
Title: Re: Crisis Quick and Painless Spellbook Filler 1.0
Post by: Crisis on June 23, 2014, 10:05:54 PM
Current Version 2.3

Please post how it worked for ya!
Title: Re: Crisis Quick and Painless Spellbook Filler 1.0
Post by: gimlet on June 24, 2014, 04:46:49 AM
Thanks - it was me! I thought I'd test it this weekend!
Just a suggestion:
I like it when people post an update to change the version number ie 1.1 or 1.01 - if large change 2.0 etc
Title: Re: Crisis Quick and Painless Spellbook Filler 1.0
Post by: Crisis on April 06, 2015, 05:36:07 PM
Updated to fix typo in mysticism
Title: Re: Crisis Quick and Painless Spellbook Filler 1.0
Post by: Kandie on April 06, 2015, 06:51:17 PM
yup works good,( just I have my spells in 8 different bags each bag for a circle so I have to remove them and pile them all in one container), If you could make it so I could keep them separated  that would be better, but still it beats filling by hand :) thx ;)
Title: Re: Crisis Quick and Painless Spellbook Filler 1.0
Post by: Crisis on April 06, 2015, 06:54:50 PM
yup works good,( just I have my spells in 8 different bags each bag for a circle so I have to remove them and pile them all in one container), If you could make it so I could keep them separated  that would be better, but still it beats filling by hand :) thx ;)

I am in the middle of that now, I have them separated by circle as well. I will hopefully have it ready tomorrow. :)
Title: Re: Crisis Quick and Painless Spellbook Filler 2.0 *UPDATED 04-07-2015*
Post by: Crisis on April 06, 2015, 08:16:32 PM
I added version 2.0

Revisions:
1.1 fixed typo in mysticism scrolls
2.0 Added support for magery scrolls kept in secures by spell circle

Let me know how it works!
Title: Re: Crisis Quick and Painless Spellbook Filler 2.0 *UPDATED 04-07-2015*
Post by: Kandie on April 06, 2015, 08:57:46 PM
ok I'll try it out tomorrow, right now am making spell scrolls, cuz I ran out....
Title: Re: Crisis Quick and Painless Spellbook Filler 2.0 *UPDATED 04-07-2015*
Post by: Endless Night on April 07, 2015, 09:18:21 AM
Looks like this script is coming along nicely....  I read though your code and noticed a couple of logical errors you might want to look into

(a) in your Dragtospellbook sub.   you have "exevent drag #FINDID #FINDSTACK".  Maybe instead of dropping a whole stack of the same spell on a spellbook, you should just drop ONE ie "exevent drag #FINDID 1"    That way you eliminate dropping the rest of the stack on the ground.

(b) Sub Idle  should contain  a  "wait 1"  to actually make the script idle otherwise you are burning tonns of cpu processes looping nothing at a high rate.

(c) You don't have a return statement at the end of  "sub StartMultiSpellbookFiller" or "sub StartSpellbookFiller"  

Title: Re: Crisis Quick and Painless Spellbook Filler 2.1 *UPDATED 04-07-2015*
Post by: Crisis on April 07, 2015, 03:55:02 PM
Thank you EN, I fixed those in version 2.1 which was just uploaded.

Also added in the ability to hardcode the 8 different secures if you store your magery scrolls by spell circle.

I ran this 5 times with secures hardcoded and 5 times setting secures through the setup at the beginning of the script.
Title: Re: Crisis Quick and Painless Spellbook Filler 2.1 *UPDATED 04-07-2015*
Post by: Endless Night on April 07, 2015, 04:24:53 PM
Before moving this into the script library I would like to suggest 2 additional improvements.

(a) This is Not necessary for function but would make easier to read and manage...  instead of having 2 copies for the Margery spell settings  you could place all the Margery definitions in its own sub and call it from the 2 places its needed.   Any time you have big blocks of duplicate code its nice to turn it into its own sub.

(b)  StartMultiSpellbookFiller  --  Currently you attempt to pull the scroll from all 8 boxes even tho it should only really be in  one box.  This must slow your script down quiet a bit.    I would recommend one of 2 solutions
     (i)  simple if statment .. if  %n > 0  && %n < 9     (cirlce 1 ) then do the drag from box 1
                                       if  %n > 9  && %n < ??    cirlce 2  then do the drag from box 2 etc
     (ii)  change your dragtospellbook  to have an option to pull from any open bag   ie change "finditem %3 C_ , %1"   to "finditem %3 C"... or if that is too open make it so if queries first   " if %1=anybag  finditem %3 C else finditem %3 C_ , %1"   then in calling code change the 8 dragtospells to 1 gosub with anybag as bagid.

I hope that all makes sense lol

Title: Re: Crisis Quick and Painless Spellbook Filler 2.1 *UPDATED 04-07-2015*
Post by: Crisis on April 07, 2015, 05:11:32 PM
Thanks EN, it made a lot of sense and runs more quickly on the multiple containers. I hope that I understood the changes and made them correctly with the IF statements.

Uploaded to version 2.2

Try it out and let me know how it works SUO!
Title: Re: Crisis Quick and Painless Spellbook Filler 2.2 *UPDATED 04-07-2015*
Post by: Endless Night on April 08, 2015, 09:50:07 AM
Ok I want to get this script approved so I actually tested it instead of just reading the code  and found an issue and a couple of suggestions:

Testing environment .. single secure with only 5 stacks of spells and 1 empty spellbook

(a) Sort single secure ...... set book set secure... nothing happened.   Problem code in dragtospellbook  
Code: [Select]
 finditem %1 G_2
  if #FINDKIND = -1
    return N/A

This code means if i DO NOT have spells on floor exit.  I never keep my spells on the floor .. you are pulling from secures you should remove this entirely.. you probably had it due to the prior error of pulling the entire stack instead of a single spell resulting in stacks of spells falling to the floor.

Once I removed this code the script functioned perfectly.


(b) You have lots of code in the script that deal with pausing... you dont have a pause button currently are you planning of adding one .. if not remove that code.


(c) Finally I would like to see a status .. ie  Adding spell  %n of  %N_Spells  on the menu even if you just updated the menu title inside the spell %n to %n_spell FOR loops..  "menu Window title %n :  %N_Spells"

eg:
Code: [Select]
for %N 1 %N_Spells ; 1 to the # of spells in the book
{
menu Window title %n :  %N_Spells      ; lets you know whats going on
gosub DragToSpellbook %ScrollSecure %spellbook %scroll . %N ; %Scroll . %N = %Scroll(whatever value N Has)
}


Great work so far....


Title: Re: Crisis Quick and Painless Spellbook Filler 2.2 *UPDATED 04-07-2015*
Post by: Crisis on April 08, 2015, 01:58:15 PM
Ok I want to get this script approved so I actually tested it instead of just reading the code  and found an issue and a couple of suggestions:

Code: [Select]
[b](b)[/b] You have lots of code in the script that deal with pausing... you dont have a pause button currently are you planning of adding one .. if not remove that code.

The pauses is really just a way to reset it so that it can be used again without pressing stop/start on the EUO client. I can name them something else but I named them pause because basically the script completes the task, and waits for the user to press either single sort or multi sort. I did it so the script could be used over and over until the user was done

I am not sure how else to do that without those. I can name them something different in the code such as reset so it doesn't confuse people. I can be very literal in my thinking and I saw it as a pause but I can see how it could be confused for a pause button on a menu.

Is there a better way of doing it or naming it?
Title: Re: Crisis Quick and Painless Spellbook Filler 2.2 *UPDATED 04-07-2015*
Post by: Endless Night on April 08, 2015, 02:26:53 PM
Ok I want to get this script approved so I actually tested it instead of just reading the code  and found an issue and a couple of suggestions:

Code: [Select]
[b](b)[/b] You have lots of code in the script that deal with pausing... you dont have a pause button currently are you planning of adding one .. if not remove that code.

The pauses is really just a way to reset it so that it can be used again without pressing stop/start on the EUO client. I can name them something else but I named them pause because basically the script completes the task, and waits for the user to press either single sort or multi sort. I did it so the script could be used over and over until the user was done

I am not sure how else to do that without those. I can name them something different in the code such as reset so it doesn't confuse people. I can be very literal in my thinking and I saw it as a pause but I can see how it could be confused for a pause button on a menu.

Is there a better way of doing it or naming it?

Thier are a million ways to skin a cat they say... but  Crisis  only change what you wish to change.. please dont feel pressured to change anything.   The only real requirement to get moved into finished script section is function not how its coded.    I sometimes go over board on my suggestions in an effort to push people forward  but they are suggestions only...

That said.. ver 2.2 breaks if you don't have spells on floor, can you fix that and i will move into approved section.   ;D
Title: Re: Crisis Quick and Painless Spellbook Filler 2.3 *UPDATED 04-08-2015*
Post by: Crisis on April 08, 2015, 06:53:09 PM
Uploaded the newest update, version 2.3

Ok I fixed this:
Code: [Select]
finditem %1 G_2
  if #FINDKIND = -1
    return N/A

Added Script Status to the Menu :)

Test it out please  ;D
Title: Re: Crisis Quick and Painless Spellbook Filler 2.3 *UPDATED 04-08-2015*
Post by: Endless Night on April 08, 2015, 07:21:18 PM
Nice menu improvements...

Congratulations your Script has been moved to the script library
(if you dont think the section is appropriate please pm me)
Thank you for your submission
Title: Re: Crisis Quick and Painless Spellbook Filler 2.3 *UPDATED 04-08-2015*
Post by: Hrafn on April 04, 2018, 10:17:13 AM
I just happend across this script and tried it out: What an awesome script! Worked flawlessly from eight containers and even if a spell was missing in the container or a spell already was in the book, it just continued without a hickup and filled the books. Thank you so much for this pearl!!