Author Topic: What am I missing here?  (Read 6290 times)

0 Members and 1 Guest are viewing this topic.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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
What am I missing here?
« on: June 21, 2014, 11:48:34 AM »
0
I am sure that it is something small but I cannot find my mistake. I am trying to take a container filled with mage spell scrolls and drop the stacks on a rune book one by one and then stop. I have not decided what to do if a scroll type is missing but I just wanted to see if it would start trying to drop scrolls and it does nothing after choosing the spellbook and scroll secure. What did I miss?

Code: [Select]

,----------------------------------------------------

    Display Choose the spellbook that you want to fill...
    set #targcurs 1
    while #targcurs = 1
      wait 5
    set %spellbook #ltargetID
    set #lobjectid %spellbook
    wait 10
   
    display Ok Select your Scroll Secure Container...
    set #targcurs 1
    while #targcurs = 1
      wait 5
    set %ScrollSecure #ltargetid
    set #lobjectid %ScrollSecure
    event macro 17 0
    wait 20
   
    gosub DragToSpellbook %ScrollSecure %spellbook QXL ;Clumsy
    gosub DragToSpellbook %ScrollSecure %spellbook PXL ;Create_Food
    gosub DragToSpellbook %ScrollSecure %spellbook AYL ;Feeblemind
    gosub DragToSpellbook %ScrollSecure %spellbook ZXL ;Heal
    gosub DragToSpellbook %ScrollSecure %spellbook CYL ;Arrow
    gosub DragToSpellbook %ScrollSecure %spellbook NXL ;Reactive_Armor
    gosub DragToSpellbook %ScrollSecure %spellbook BYL ;Night_Sight
    gosub DragToSpellbook %ScrollSecure %spellbook WXL ;Weaken
    gosub DragToSpellbook %ScrollSecure %spellbook VXL ;Agility
    gosub DragToSpellbook %ScrollSecure %spellbook YXL ;Cunning
    gosub DragToSpellbook %ScrollSecure %spellbook XXL ;Cure
    gosub DragToSpellbook %ScrollSecure %spellbook IYL ;Harm
    gosub DragToSpellbook %ScrollSecure %spellbook HYL ;Magic_Trap
    gosub DragToSpellbook %ScrollSecure %spellbook KYL ;Magic_Untrap
    gosub DragToSpellbook %ScrollSecure %spellbook JYL ;Protection
    gosub DragToSpellbook %ScrollSecure %spellbook EYL ;Strength
    gosub DragToSpellbook %ScrollSecure %spellbook DYL ;Bless
    gosub DragToSpellbook %ScrollSecure %spellbook GYL ;Fireball
    gosub DragToSpellbook %ScrollSecure %spellbook FYL ;Magic_Lock
    gosub DragToSpellbook %ScrollSecure %spellbook STL ;Poison
    gosub DragToSpellbook %ScrollSecure %spellbook RTL ;Telekinesis
    gosub DragToSpellbook %ScrollSecure %spellbook UTL ;Teleport
    gosub DragToSpellbook %ScrollSecure %spellbook TTL ;Unlock
    gosub DragToSpellbook %ScrollSecure %spellbook OTL ;Wall_of_Stone
    gosub DragToSpellbook %ScrollSecure %spellbook NTL ;Arch_Cure
    gosub DragToSpellbook %ScrollSecure %spellbook QTL ;Arch_Protection
    gosub DragToSpellbook %ScrollSecure %spellbook PTL ;Curse
    gosub DragToSpellbook %ScrollSecure %spellbook AUL ;Fire_Field
    gosub DragToSpellbook %ScrollSecure %spellbook ZTL ;Greater_Heal
    gosub DragToSpellbook %ScrollSecure %spellbook CUL ;Lightning
    gosub DragToSpellbook %ScrollSecure %spellbook BUL ;Mana_Drain
    gosub DragToSpellbook %ScrollSecure %spellbook WTL ;Recall
    gosub DragToSpellbook %ScrollSecure %spellbook VTL ;Blade_Spirits
    gosub DragToSpellbook %ScrollSecure %spellbook YTL ;Dispel_Field
    gosub DragToSpellbook %ScrollSecure %spellbook XTL ;Incognito
    gosub DragToSpellbook %ScrollSecure %spellbook IUL ;Magic_Reflection
    gosub DragToSpellbook %ScrollSecure %spellbook HUL ;Mind_Blast
    gosub DragToSpellbook %ScrollSecure %spellbook KUL ;Paralyze
    gosub DragToSpellbook %ScrollSecure %spellbook JUL ;Poison_Field
    gosub DragToSpellbook %ScrollSecure %spellbook EUL ;Summon_Creature
    gosub DragToSpellbook %ScrollSecure %spellbook DUL ;Dispel
    gosub DragToSpellbook %ScrollSecure %spellbook GUL ;Energy_Bolt
    gosub DragToSpellbook %ScrollSecure %spellbook FUL ;Explosion
    gosub DragToSpellbook %ScrollSecure %spellbook QUL ;Invisibility
    gosub DragToSpellbook %ScrollSecure %spellbook PUL ;Mark
    gosub DragToSpellbook %ScrollSecure %spellbook SUL ;Mass_Curse
    gosub DragToSpellbook %ScrollSecure %spellbook RUL ;Paralyze Field
    gosub DragToSpellbook %ScrollSecure %spellbook MUL ;Reveal
    gosub DragToSpellbook %ScrollSecure %spellbook LUL ;Chain_Lightning
    gosub DragToSpellbook %ScrollSecure %spellbook OUL ;Energy_Field
    gosub DragToSpellbook %ScrollSecure %spellbook NUL ;Flamestrike
    gosub DragToSpellbook %ScrollSecure %spellbook YUL ;Gate_Travel
    gosub DragToSpellbook %ScrollSecure %spellbook XUL ;Mana_Vampire
    gosub DragToSpellbook %ScrollSecure %spellbook AVL ;Mass_Dispel
    gosub DragToSpellbook %ScrollSecure %spellbook UUL ;Polymorph
    gosub DragToSpellbook %ScrollSecure %spellbook ZUL ;Meteor_Swarm
    gosub DragToSpellbook %ScrollSecure %spellbook TUL ;Earthquake
    gosub DragToSpellbook %ScrollSecure %spellbook WUL ;Energy_Vortex
    gosub DragToSpellbook %ScrollSecure %spellbook VUL ;Resurrection
    gosub DragToSpellbook %ScrollSecure %spellbook GVL ;Air_Elemental
    gosub DragToSpellbook %ScrollSecure %spellbook FVL ;Summon_Daemon
    gosub DragToSpellbook %ScrollSecure %spellbook IVL ;Earth_Elemental
    gosub DragToSpellbook %ScrollSecure %spellbook HVL ;Fire_Elemental
    gosub DragToSpellbook %ScrollSecure %spellbook CVL ;Water_Elemental

,----------------------------------------------------
 
 sub DragToSpellbook
  set %ScrollSecure %1
  set %spellbook %2
  set %scrolls %3

  finditem %SpellSecure G_2
  if #FINDKIND = -1
    return N/A
  DragToSpellbook_loop1:
    finditem %scrolls C_ , %ScrollSecure
    if #FINDKIND <> -1
    {
      exevent drag #FINDID #FINDSTACK
      wait 10
      exevent dropc %spellbook
      wait 10
      goto DragToSpellbook_loop1
    }
return

,----------------------------------------------------

;-------------------------------------------------
; %1 = GumpWait
; %2 = Gumpname 1
; %3 = Gumpname 2
sub GumpWait
  wait 10
  set %timedelay #SCNT
  loopwait1:
    if #CONTNAME = %1 || #CONTNAME = %2
      return
    if #SCNT > %timedelay + 7
      return
    goto loopwait1
return

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • 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: What am I missing here?
« Reply #1 on: June 21, 2014, 04:36:54 PM »
0
Didn't I read somewhere that dropc doesn't work on things like the paperdoll and spellbooks anymore?
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #2 on: June 21, 2014, 04:50:25 PM »
0
Okay I am a doofus and I found the mistake that I knew had to be there. I originally was going with %SpellSecure and then decided to change it to %ScrollSecure. I missed the part with it in there.

 
Code: [Select]
finditem %SpellSecure G_2
  if #FINDKIND = -1
    return N/A
  DragToSpellbook_loop1:
    finditem %scrolls C_ , %ScrollSecure
    if #FINDKIND <> -1
    {
      exevent drag #FINDID #FINDSTACK
      wait 10
      exevent dropc %spellbook
      wait 10

It will now drop a couple of scrolls into a book and then it gets stuck and keeps trying to pick up and drop the same spell over and over. I thought by listing each spell seperately, it would only try each one once. I know I will need to put some kind of stop in there after the final scroll but I am working on one problem at a time lol.
« Last Edit: June 21, 2014, 05:38:58 PM by Crisis »

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: What am I missing here?
« Reply #3 on: June 21, 2014, 05:32:24 PM »
0
Exevent Droppd Works for papredolls on humans and Elves, but not Gargoyles. looking over the code now.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: What am I missing here?
« Reply #4 on: June 21, 2014, 05:38:33 PM »
0
Try using

if #Findcnt > 0 instead of if #Findkind <> -1 don't think that will fix it, just less confusing.

You also Have a Redundancy and an Infinite Loop

 sub DragToSpellbook
  set %ScrollSecure %1 ; <- %ScrollSecure is already %ScrollSecure Just Remove this part and use %1 as your Secure
  set %spellbook %2  ;<- %SpellBook is already %SpellBook Just remove this part and use %2 as your Spellbook
  set %scrolls %3

  finditem %SpellSecure G_2
  if #FINDKIND = -1
    return N/A
  DragToSpellbook_loop1:
    finditem %scrolls C_ , %ScrollSecure
    if #FINDKIND <> -1
    {
      exevent drag #FINDID #FINDSTACK
      wait 10
      exevent dropc %spellbook
      wait 10
      goto DragToSpellbook_loop1 ;<- Infinite Loop so long as the scrolls are found in the bag.
    }
return
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #5 on: June 21, 2014, 05:44:18 PM »
0
I edited my 2nd post without making sure that no one had replied. If you go up you will see the mistake that I made so it is working to an extent but now it is looping in the same spell over and over. It will drop 2 different spells in and then sticks on the 3rd one.

I know the loop is there but I wanted to make sure that it would try each scroll before stopping. I wanted to test it before removing the loop. I appreciate you taking the time to look at it.

Do I need to name the scrolls differently at the beginning so that the %3 step will work better?
« Last Edit: June 21, 2014, 05:46:18 PM by Crisis »

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #6 on: June 21, 2014, 05:54:20 PM »
0
I changed the %ScrollSecure %1 to just %1 and the %Spellbook %2 to just %2 and it seems to flowing smoothly now. I also removed the loop and added a halt after the last spell. I have plans to use this in another script but this works perfect for me right now to fill spellbooks from all of my stacks of extra spells. Thanks!!

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: What am I missing here?
« Reply #7 on: June 21, 2014, 06:50:02 PM »
0
No Problem. You could also Make this Work for Necro and Mysticism Spells. But you have to learn about parsing (sp) and Building arrays with Euo.

So, Lets say they target the Book

set %Mage_Book XXX
set %Necro_Book XXX
set %Myst_Book XXX

if %SpellBook = %Mage_Book
{
set %N_Spells 64 ;<- Defining the Size of the array
set %Scroll1 QXL
set %Scroll2 PXL
set %Scroll3 ZXL
set %Scroll4 CYL
; etc etc etc
   }
if %SpellBook = %Necro_Book
{
set %N_Spells 17
set %Scroll1
set %Scroll2
set %Scroll3
; etc etc etc
}

Then when it comes time to fill you do this

for %N 1 %N_Spell ; 1 to the # of spells in the book
{
gosub DragToSpellbook %ScrollSecure %spellbook %Scroll . %N ; %Scroll . %N = %Scroll(whatever value N Has)
}
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #8 on: June 21, 2014, 07:11:54 PM »
0
I like that, I think I will play around with it and see if I can get it to work that way as well.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #9 on: June 21, 2014, 08:44:54 PM »
0
Okay here is what I have. I must have missed something again because it is just sitting idle after choosing the book and the scroll secure. I am wondering if it has to to do with the gosub dragtospellbook and the actual sub. Is it not recognizing the scrolls?

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

    display Select your Scroll Secure Container...
    set #targcurs 1
    while #targcurs = 1
      wait 5
    set %ScrollSecure #ltargetid
    set #lobjectid %ScrollSecure
    event macro 17 0
    wait 20
    
 set %Mage_Book MPF
 set %Necro_Book XXM
 set %Myst_Book RGR_RJR
 
 if %SpellBook = %Mage_Book
{
 set %N_Spells 64 ;<- Defining the Size of the array
; 1st Circle Spells
 set %scroll1 QXL  ;Clumsy
 set %scroll2 PXL  ;Create Food
 set %scroll3 AYL  ;Feeblemind
 set %scroll4 ZXL  ;Heal
 set %scroll5 CYL  ;Magic Arrow
 set %scroll6 BYL  ;Night Sight
 set %scroll7 NXL  ;Reactive Armor
 set %scroll8 WXL  ;Weaken

; 2nd Circle Spells
 set %scroll9 VXL  ;Agility
 set %scroll10 YXL ;Cunning
 set %scroll11 XXL ;Cure
 set %scroll12 IYL ;Harm
 set %scroll13 HYL ;Magic Trap
 set %scroll14 KYL ;Magic Untrap
 set %scroll15 JYL ;Protection
 set %scroll16 EYL ;Strength

; 3rd Circle Spells
 set %scroll17 DYL ;Bless
 set %scroll18 GYL ;Fireball
 set %scroll19 FYL ;Magic Lock
 set %scroll20 STL ;Poison
 set %scroll21 RTL ;Telekinesis
 set %scroll22 UTL ;Teleport
 set %scroll23 TTL ;Unlock
 set %scroll24 OTL ;Wall of Stone

; 4th Circle Spells
 set %scroll25 NTL ;Arch Cure
 set %scroll26 QTL ;Arch Protection
 set %scroll27 PTL ;Curse
 set %scroll28 AUL ;Fire Field
 set %scroll29 ZTL ;Greater Heal
 set %scroll30 CUL ;Lightning
 set %scroll31 BUL ;Mana Drain
 set %scroll32 WTL ;Recall

; 5th Circle Spells
 set %scroll33 VTL ;Blade Spirits
 set %scroll34 YTL ;Dispel Field
 set %scroll35 XTL ;Incognito
 set %scroll36 IUL ;Magic Reflection
 set %scroll37 HUL ;Mind Blast
 set %scroll38 KUL ;Paralyze
 set %scroll39 JUL ;Poison Field
 set %scroll40 EUL ;Summon Creature


; 6th Circle Spells
 set %scroll41 DUL ;Dispel
 set %scroll42 GUL ;Energy Bolt
 set %scroll43 FUL ;Explosion
 set %scroll44 QUL ;Invisibility
 set %scroll45 PUL ;Mark
 set %scroll46 SUL ;Mass Curse
 set %scroll47 RUL ;Paralyze Field
 set %scroll48 MUL ;Reveal


; 7th Circle Spells
 set %scroll49 LUL ;Chain Lightning
 set %scroll50 OUL ;Energy Field
 set %scroll51 NUL ;Flamestrike
 set %scroll52 YUL ;Gate Travel
 set %scroll53 XUL ;Mana Vampire
 set %scroll54 AVL ;Mass Dispell
 set %scroll55 ZUL ;Meteor Swarm
 set %scroll56 UUL ;Polymorph

; 8th Circle Spells
 set %scroll57 TUL ;Earthquake
 set %scroll58 WUL ;Energy Vortex
 set %scroll59 VUL ;Resurrection
 set %scroll60 GVL ;Summon Air Elemental
 set %scroll61 FVL ;Summon Daemon
 set %scroll62 IVL ;Summon Earth Elemental
 set %scroll63 HVL ;Summon Fire Elemental
 set %scroll64 CVL ;Summon Water Elemental

}
if %SpellBook = %Necro_Book
{
 set %N_Spells 17
 set %scroll1 MYM ;Animate Dead
 set %scroll2 LYM ;Blood Oath
 set %scroll3 OYM ;Corpse Skin
 set %scroll4 NYM;Curse Weapon
 set %scroll5 IYM ;Evil Omen
 set %scroll6 HYM ;Horrific Beast
 set %scroll7 KYM ;Lich Form
 set %scroll8 JYM ;Mind Rot
 set %scroll9 UYM ;Pain Spike
 set %scroll10 TYM ;Poison Strike
 set %scroll11 WYM ;Strangle
 set %scroll12 VYM ;Summon Familiar
 set %scroll13 QYM ;Vampiric Embrace
 set %scroll14 PYM ;Vengeful Spirit
 set %scroll15 SYM ;Wither
 set %scroll16 RYM ;Wraith Form
 set %scroll17 CZM ;Exorcism
}
if %SpellBook = %Myst_Book
[
 set %N_Spells 16
 set %scroll1 AKR ;Animated Weapon
 set %scroll2 LKR ;Bombard
 set %scroll3 MKR ;Cleansing Wind
 set %scroll4 FKR ;Eagle Strike
 set %scroll5 DKR ;enchant
 set %scroll6 NKR ;Hail Storm
 set %scroll7 TJR ;Healing Stone
 set %scroll8 BKR ;Mass Sleep
 set %scroll9 UJR ;Nether Bolt
 set %scroll10 IKR ;Nether Cyclone
 set %scroll11 EKR ;Purge Magic
 set %scroll12 HKR ;Rising Colossus
 set %scroll13 GKR ;Sleep
 set %scroll14 GKR ;Spell Plague
 set %scroll15 CKR ;Spell Trigger
 set %scroll16 ZJR ;Stone Form
]

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

;===================================================================

 sub DragToSpellbook
  set %1
  set %2
  set %scroll %3

  finditem %ScrollSecure G_2
  if #FINDKIND = -1
    return N/A
    finditem %scroll C_ , %ScrollSecure
    if #FINDKIND <> -1
    {
      exevent drag #FINDID #FINDSTACK
      wait 10
      exevent dropc %spellbook
      wait 10
    }
return
« Last Edit: June 21, 2014, 08:47:13 PM by Crisis »

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: What am I missing here?
« Reply #10 on: June 22, 2014, 11:57:22 AM »
0



So, When you Use a gosub it automatically sets what you put after the sub name to the Variables.


Gosub Test 1 2 3 4 5 6 7 8 9

Sub Test
Display %1 %2 %3 %4 %5 %6 %7 %8 %9
Return

In your sub when you use
set %1
set %2

You are literally overwriting What %1 and %2 are, and replacing them with a blank.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: What am I missing here?
« Reply #11 on: June 22, 2014, 12:04:07 PM »
0
Hah, we also missed something else. My bad. We need tog et the #Findtype for the spellbook to compare to the Types for the different books.


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 ; <- Got the "Type" For the Book.


if %BookType in %Mage_book
{
}

if %BookType in %Necro_Book
{
}

if %BookType in %Myst_Book
{
}

The reason we changed from the "=" to "in" Comparison is because you put that there are multiple types of myst Books.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #12 on: June 22, 2014, 03:09:43 PM »
0



So, When you Use a gosub it automatically sets what you put after the sub name to the Variables.


Gosub Test 1 2 3 4 5 6 7 8 9

Sub Test
Display %1 %2 %3 %4 %5 %6 %7 %8 %9
Return

In your sub when you use
set %1
set %2

You are literally overwriting What %1 and %2 are, and replacing them with a blank.

I think I understand what you are saying and but not sure I am understanding how to fix it.

So instead of
Code: [Select]
sub DragToSpellbook
  set %1
  set %2
  set %scroll %3

It should be this?
Code: [Select]
sub DragToSpellbook
  set %ScrollSecure
  set %spellbook
  set %scroll


Hah, we also missed something else. My bad. We need tog et the #Findtype for the spellbook to compare to the Types for the different books.


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 ; <- Got the "Type" For the Book.


if %BookType in %Mage_book
{
}

if %BookType in %Necro_Book
{
}

if %BookType in %Myst_Book
{
}

The reason we changed from the "=" to "in" Comparison is because you put that there are multiple types of myst Books.

I understand these changes, thank you for explaining why it needs to be changed. That is extremely helpful in learning!

Here is what I did and I tried it a coupe of different ways with the %1 %2 %3 but still nothing happens after choosing spellbook and secure

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

    display Select your Scroll Secure Container...
    set #targcurs 1
    while #targcurs = 1
      wait 5
    set %ScrollSecure #ltargetid
    set #lobjectid %ScrollSecure
    event macro 17 0
    wait 20
   
 set %Mage_Book MPF
 set %Necro_Book XXM
 set %Myst_Book RGR_RJR
 
 if %SpellBook in %Mage_Book
{
 set %N_Spells 64 ;<- Defining the Size of the array
; 1st Circle Spells
 set %scroll1 QXL  ;Clumsy
 set %scroll2 PXL  ;Create Food
 set %scroll3 AYL  ;Feeblemind
 set %scroll4 ZXL  ;Heal
 set %scroll5 CYL  ;Magic Arrow
 set %scroll6 BYL  ;Night Sight
 set %scroll7 NXL  ;Reactive Armor
 set %scroll8 WXL  ;Weaken

; 2nd Circle Spells
 set %scroll9 VXL  ;Agility
 set %scroll10 YXL ;Cunning
 set %scroll11 XXL ;Cure
 set %scroll12 IYL ;Harm
 set %scroll13 HYL ;Magic Trap
 set %scroll14 KYL ;Magic Untrap
 set %scroll15 JYL ;Protection
 set %scroll16 EYL ;Strength

; 3rd Circle Spells
 set %scroll17 DYL ;Bless
 set %scroll18 GYL ;Fireball
 set %scroll19 FYL ;Magic Lock
 set %scroll20 STL ;Poison
 set %scroll21 RTL ;Telekinesis
 set %scroll22 UTL ;Teleport
 set %scroll23 TTL ;Unlock
 set %scroll24 OTL ;Wall of Stone

; 4th Circle Spells
 set %scroll25 NTL ;Arch Cure
 set %scroll26 QTL ;Arch Protection
 set %scroll27 PTL ;Curse
 set %scroll28 AUL ;Fire Field
 set %scroll29 ZTL ;Greater Heal
 set %scroll30 CUL ;Lightning
 set %scroll31 BUL ;Mana Drain
 set %scroll32 WTL ;Recall

; 5th Circle Spells
 set %scroll33 VTL ;Blade Spirits
 set %scroll34 YTL ;Dispel Field
 set %scroll35 XTL ;Incognito
 set %scroll36 IUL ;Magic Reflection
 set %scroll37 HUL ;Mind Blast
 set %scroll38 KUL ;Paralyze
 set %scroll39 JUL ;Poison Field
 set %scroll40 EUL ;Summon Creature


; 6th Circle Spells
 set %scroll41 DUL ;Dispel
 set %scroll42 GUL ;Energy Bolt
 set %scroll43 FUL ;Explosion
 set %scroll44 QUL ;Invisibility
 set %scroll45 PUL ;Mark
 set %scroll46 SUL ;Mass Curse
 set %scroll47 RUL ;Paralyze Field
 set %scroll48 MUL ;Reveal


; 7th Circle Spells
 set %scroll49 LUL ;Chain Lightning
 set %scroll50 OUL ;Energy Field
 set %scroll51 NUL ;Flamestrike
 set %scroll52 YUL ;Gate Travel
 set %scroll53 XUL ;Mana Vampire
 set %scroll54 AVL ;Mass Dispell
 set %scroll55 ZUL ;Meteor Swarm
 set %scroll56 UUL ;Polymorph

; 8th Circle Spells
 set %scroll57 TUL ;Earthquake
 set %scroll58 WUL ;Energy Vortex
 set %scroll59 VUL ;Resurrection
 set %scroll60 GVL ;Summon Air Elemental
 set %scroll61 FVL ;Summon Daemon
 set %scroll62 IVL ;Summon Earth Elemental
 set %scroll63 HVL ;Summon Fire Elemental
 set %scroll64 CVL ;Summon Water Elemental

}
if %SpellBook in %Necro_Book
{
 set %N_Spells 17
 set %scroll1 MYM ;Animate Dead
 set %scroll2 LYM ;Blood Oath
 set %scroll3 OYM ;Corpse Skin
 set %scroll4 NYM;Curse Weapon
 set %scroll5 IYM ;Evil Omen
 set %scroll6 HYM ;Horrific Beast
 set %scroll7 KYM ;Lich Form
 set %scroll8 JYM ;Mind Rot
 set %scroll9 UYM ;Pain Spike
 set %scroll10 TYM ;Poison Strike
 set %scroll11 WYM ;Strangle
 set %scroll12 VYM ;Summon Familiar
 set %scroll13 QYM ;Vampiric Embrace
 set %scroll14 PYM ;Vengeful Spirit
 set %scroll15 SYM ;Wither
 set %scroll16 RYM ;Wraith Form
 set %scroll17 CZM ;Exorcism
}
if %SpellBook in %Myst_Book
[
 set %N_Spells 16
 set %scroll1 AKR ;Animated Weapon
 set %scroll2 LKR ;Bombard
 set %scroll3 MKR ;Cleansing Wind
 set %scroll4 FKR ;Eagle Strike
 set %scroll5 DKR ;enchant
 set %scroll6 NKR ;Hail Storm
 set %scroll7 TJR ;Healing Stone
 set %scroll8 BKR ;Mass Sleep
 set %scroll9 UJR ;Nether Bolt
 set %scroll10 IKR ;Nether Cyclone
 set %scroll11 EKR ;Purge Magic
 set %scroll12 HKR ;Rising Colossus
 set %scroll13 GKR ;Sleep
 set %scroll14 GKR ;Spell Plague
 set %scroll15 CKR ;Spell Trigger
 set %scroll16 ZJR ;Stone Form
]

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

;===================================================================

 sub DragToSpellbook
  set %ScrollSecure
  set %spellbook
  set %scroll

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

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: What am I missing here?
« Reply #13 on: June 22, 2014, 05:04:46 PM »
0
So, When you use the command

gosub DragToSpellbook %ScrollSecure %spellbook %scroll . %N

It Automatically Does this on its own
set %1 %ScrollSecure
set %2 %Spellbook
set %3 %Scroll . %N


sub DragToSpellbook
  finditem %1 G_2
  if #FINDKIND = -1
    return N/A
    finditem %3 C_ , %1
    if #FINDKIND <> -1
    {
      exevent drag #FINDID #FINDSTACK
      wait 10
      exevent dropc %2
      wait 10
    }
return
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3022
  • Activity:
    3%
  • 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: What am I missing here?
« Reply #14 on: June 22, 2014, 06:05:00 PM »
0
It makes a lot of sense and I totally understand it but it isn't working and that is so frustrating lol

Could I have made any typos in setting up the scrolls or anything? Does it matter that all 3 types have %scroll1 %scroll2 etc? I am guessing not because they are defined by the book and the number of scrolls in the book, right?

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

    display Select your Scroll Secure Container...
    set #targcurs 1
    while #targcurs = 1
      wait 5
    set %ScrollSecure #ltargetid
    set #lobjectid %ScrollSecure
    event macro 17 0
    wait 20
   
 set %Mage_Book MPF
 set %Necro_Book XXM
 set %Myst_Book RGR_RJR
 
 if %spellbook in %Mage_Book
{
 set %N_Spells 64 ;<- Defining the Size of the array
; 1st Circle Spells
 set %scroll1 QXL  ;Clumsy
 set %scroll2 PXL  ;Create Food
 set %scroll3 AYL  ;Feeblemind
 set %scroll4 ZXL  ;Heal
 set %scroll5 CYL  ;Magic Arrow
 set %scroll6 BYL  ;Night Sight
 set %scroll7 NXL  ;Reactive Armor
 set %scroll8 WXL  ;Weaken

; 2nd Circle Spells
 set %scroll9 VXL  ;Agility
 set %scroll10 YXL ;Cunning
 set %scroll11 XXL ;Cure
 set %scroll12 IYL ;Harm
 set %scroll13 HYL ;Magic Trap
 set %scroll14 KYL ;Magic Untrap
 set %scroll15 JYL ;Protection
 set %scroll16 EYL ;Strength

; 3rd Circle Spells
 set %scroll17 DYL ;Bless
 set %scroll18 GYL ;Fireball
 set %scroll19 FYL ;Magic Lock
 set %scroll20 STL ;Poison
 set %scroll21 RTL ;Telekinesis
 set %scroll22 UTL ;Teleport
 set %scroll23 TTL ;Unlock
 set %scroll24 OTL ;Wall of Stone

; 4th Circle Spells
 set %scroll25 NTL ;Arch Cure
 set %scroll26 QTL ;Arch Protection
 set %scroll27 PTL ;Curse
 set %scroll28 AUL ;Fire Field
 set %scroll29 ZTL ;Greater Heal
 set %scroll30 CUL ;Lightning
 set %scroll31 BUL ;Mana Drain
 set %scroll32 WTL ;Recall

; 5th Circle Spells
 set %scroll33 VTL ;Blade Spirits
 set %scroll34 YTL ;Dispel Field
 set %scroll35 XTL ;Incognito
 set %scroll36 IUL ;Magic Reflection
 set %scroll37 HUL ;Mind Blast
 set %scroll38 KUL ;Paralyze
 set %scroll39 JUL ;Poison Field
 set %scroll40 EUL ;Summon Creature


; 6th Circle Spells
 set %scroll41 DUL ;Dispel
 set %scroll42 GUL ;Energy Bolt
 set %scroll43 FUL ;Explosion
 set %scroll44 QUL ;Invisibility
 set %scroll45 PUL ;Mark
 set %scroll46 SUL ;Mass Curse
 set %scroll47 RUL ;Paralyze Field
 set %scroll48 MUL ;Reveal


; 7th Circle Spells
 set %scroll49 LUL ;Chain Lightning
 set %scroll50 OUL ;Energy Field
 set %scroll51 NUL ;Flamestrike
 set %scroll52 YUL ;Gate Travel
 set %scroll53 XUL ;Mana Vampire
 set %scroll54 AVL ;Mass Dispell
 set %scroll55 ZUL ;Meteor Swarm
 set %scroll56 UUL ;Polymorph

; 8th Circle Spells
 set %scroll57 TUL ;Earthquake
 set %scroll58 WUL ;Energy Vortex
 set %scroll59 VUL ;Resurrection
 set %scroll60 GVL ;Summon Air Elemental
 set %scroll61 FVL ;Summon Daemon
 set %scroll62 IVL ;Summon Earth Elemental
 set %scroll63 HVL ;Summon Fire Elemental
 set %scroll64 CVL ;Summon Water Elemental

}
if %spellbook in %Necro_Book
{
 set %N_Spells 17
 set %scroll1 MYM ;Animate Dead
 set %scroll2 LYM ;Blood Oath
 set %scroll3 OYM ;Corpse Skin
 set %scroll4 NYM;Curse Weapon
 set %scroll5 IYM ;Evil Omen
 set %scroll6 HYM ;Horrific Beast
 set %scroll7 KYM ;Lich Form
 set %scroll8 JYM ;Mind Rot
 set %scroll9 UYM ;Pain Spike
 set %scroll10 TYM ;Poison Strike
 set %scroll11 WYM ;Strangle
 set %scroll12 VYM ;Summon Familiar
 set %scroll13 QYM ;Vampiric Embrace
 set %scroll14 PYM ;Vengeful Spirit
 set %scroll15 SYM ;Wither
 set %scroll16 RYM ;Wraith Form
 set %scroll17 CZM ;Exorcism
}
if %spellbook in %Myst_Book
[
 set %N_Spells 16
 set %scroll1 AKR ;Animated Weapon
 set %scroll2 LKR ;Bombard
 set %scroll3 MKR ;Cleansing Wind
 set %scroll4 FKR ;Eagle Strike
 set %scroll5 DKR ;enchant
 set %scroll6 NKR ;Hail Storm
 set %scroll7 TJR ;Healing Stone
 set %scroll8 BKR ;Mass Sleep
 set %scroll9 UJR ;Nether Bolt
 set %scroll10 IKR ;Nether Cyclone
 set %scroll11 EKR ;Purge Magic
 set %scroll12 HKR ;Rising Colossus
 set %scroll13 GKR ;Sleep
 set %scroll14 GKR ;Spell Plague
 set %scroll15 CKR ;Spell Trigger
 set %scroll16 ZJR ;Stone Form
]

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

;===================================================================

 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 #FINDSTACK
      wait 10
      exevent dropc %2
      wait 10
    }
return

Tags: