| | Author | Message |
---|
Marc1
Posts : 43 Join date : 2013-08-03
| Subject: What did I do wrong? Mon Apr 28, 2014 8:56 pm | |
| I get and error at line 13. Expected near ‘end ‘ (13)Discard your entire hand (1 minimum); roll a six sided die and draw card(s) from your deck equal to the die roll. - Code:
-
--Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.activate) c:RegisterEffect(e1) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1,6 and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 end (Line13) Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp, end function c1039000000.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local dice=Duel.TossDice(tp,1) if dice==1 then Duel.Draw(tp,1,REASON_EFFECT) Duel.BreakEffect() elseif dice==2 then Duel.Draw(tp,2,REASON_EFFECT) Duel.BreakEffect() elseif dice==3 then Duel.Draw(tp,3,REASON_EFFECT) Duel.BreakEffect() elseif dice==4 then Duel.Draw(tp,4,REASON_EFFECT) Duel.BreakEffect() elseif dice==5 then Duel.Draw(tp,5,REASON_EFFECT) Duel.BreakEffect() elseif dice==6 then Duel.Draw(tp,6,REASON_EFFECT) Duel.BreakEffect() end |
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Mon Apr 28, 2014 9:36 pm | |
| Soooo... You are, like, 100% sure you don't want it like this?
function c1039000000.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c1039000000.cost) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.activate) c:RegisterEffect(e1) function c1039000000.cfilter(c) return c:IsDiscardable() and c:IsAbleToGraveAsCost() end function c1039000000.cost(e,tp,eg,ep,ev,re,r,rp,chk) local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0) hg:RemoveCard(e:GetHandler()) if chk==0 then return hg:GetCount()>0 and hg:FilterCount(c1039000000.cfilter,nil)==hg:GetCount() end Duel.SendtoGrave(hg,REASON_COST) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local d=Duel.TossDice(tp,1) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(d) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,d) end function c1039000000.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Because of the "SetCost"-line?
EDIT: Oops, sry, didn't read correctly, thought you wanted it scripted. Dumb me XD
However, I think I found an error: At one line you didn't close the brackets (English ain't my mother language, sry^^°). There it says: Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp, end |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Mon Apr 28, 2014 10:53 pm | |
| Ok, I fixed that line but I’m still getting the same error at line 13. - Code:
-
--Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.activate) c:RegisterEffect(e1) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1,6 and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function c1039000000.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local dice=Duel.TossDice(tp,1) if dice==1 then Duel.Draw(tp,1,REASON_EFFECT) Duel.BreakEffect() elseif dice==2 then Duel.Draw(tp,2,REASON_EFFECT) Duel.BreakEffect() elseif dice==3 then Duel.Draw(tp,3,REASON_EFFECT) Duel.BreakEffect() elseif dice==4 then Duel.Draw(tp,4,REASON_EFFECT) Duel.BreakEffect() elseif dice==5 then Duel.Draw(tp,5,REASON_EFFECT) Duel.BreakEffect() elseif dice==6 then Duel.Draw(tp,6,REASON_EFFECT) Duel.BreakEffect() end
|
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Mon Apr 28, 2014 10:59 pm | |
| Again, there is that missing bracket:
Duel.IsPlayerCanDraw(tp,1,6
In Addition, I don't know if (tp,LOCATION_HAND,0)>0 is correct... I know that there are scripts with (tp,LOCATION_HAND,0) and some with (tp,LOCATION_HAND)>0, but both?
I'm not sure though.... |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Tue Apr 29, 2014 7:11 pm | |
| That solved one problem but when I test it I get this error: “9: Parameter 2 should be function” - Code:
-
--Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.activate) c:RegisterEffect(e1) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1,6)and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function c1039000000.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local dice=Duel.TossDice(tp,1) if dice==1 then Duel.Draw(tp,1,REASON_EFFECT) Duel.BreakEffect() elseif dice==2 then Duel.Draw(tp,2,REASON_EFFECT) Duel.BreakEffect() elseif dice==3 then Duel.Draw(tp,3,REASON_EFFECT) Duel.BreakEffect() elseif dice==4 then Duel.Draw(tp,4,REASON_EFFECT) Duel.BreakEffect() elseif dice==5 then Duel.Draw(tp,5,REASON_EFFECT) Duel.BreakEffect() elseif dice==6 then Duel.Draw(tp,6,REASON_EFFECT) Duel.BreakEffect() end end
|
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Tue Apr 29, 2014 8:48 pm | |
| Well, like I said, I wasn't sure about the tp, Location_Hand thingy. Did you try it with all three possibilities (Your original one and the two I gave you)? |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 1:27 am | |
| I'm not sure I understand. I see two options my original (tp,LOCATION_HAND,0)>0 one which did not work and the one you suggested (tp,LOCATION_HAND,0)which solved one issue but created another.
“9: Parameter 2 should be function” I cannot activate the spell card. (if that helps).
Not sure what the third option you are speaking of. Can you give me the scripts that you want me to try? Sorry I'm not programmer. I just copy and paste and hope for the best! |
| | | outlaw1994
Admin
Member Title : Red-Eyes Lord Posts : 797 Join date : 2013-07-09 Age : 29 Location : bundaberg qld australia
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 3:05 pm | |
| yeah your problem is your telling it to look for activate and your function is operation heres a fixed copy - Code:
-
--Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.operation) c:RegisterEffect(e1) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1,6)and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function c1039000000.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local dice=Duel.TossDice(tp,1) if dice==1 then Duel.Draw(tp,1,REASON_EFFECT) Duel.BreakEffect() elseif dice==2 then Duel.Draw(tp,2,REASON_EFFECT) Duel.BreakEffect() elseif dice==3 then Duel.Draw(tp,3,REASON_EFFECT) Duel.BreakEffect() elseif dice==4 then Duel.Draw(tp,4,REASON_EFFECT) Duel.BreakEffect() elseif dice==5 then Duel.Draw(tp,5,REASON_EFFECT) Duel.BreakEffect() elseif dice==6 then Duel.Draw(tp,6,REASON_EFFECT) Duel.BreakEffect() end end |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 5:20 pm | |
| Thanks Outlaw but it doesn't discard the hand before rolling the die.
Discard your entire hand (1 minimum); roll a six sided die and draw card(s) from your deck equal to the die roll. |
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 5:42 pm | |
| My third option was making the hand discard a cost... I'm not sure how that works with a combo you may be planning, though... |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 7:10 pm | |
| Sorry, I don't know what you want me to try. What is the third option? |
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 7:15 pm | |
| I want you to try to make the discard a cost instead of a card effect, like this:
function c1039000000.cost(e,tp,eg,ep,ev,re,r,rp,chk) local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0) hg:RemoveCard(e:GetHandler()) if chk==0 then return hg:GetCount()>0 and hg:FilterCount(c1039000000.cfilter,nil)==hg:GetCount() end Duel.SendtoGrave(hg,REASON_COST) end |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 9:14 pm | |
| Sorry VB! I tried adding that in there. it didn't work. I tried deleting stuff thing hoping that would help and only making things worse. *sigh* Please note I have no idea what i'm doing!
You will probably need to do the changes yourself (Like Outlaw did earlier) then give me the new script. Sorry.... |
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 9:17 pm | |
| --Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c1039000000.cost) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.activate) c:RegisterEffect(e1) function c1039000000.cfilter(c) return c:IsDiscardable() and c:IsAbleToGraveAsCost() end function c1039000000.cost(e,tp,eg,ep,ev,re,r,rp,chk) local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0) hg:RemoveCard(e:GetHandler()) if chk==0 then return hg:GetCount()>0 and hg:FilterCount(c1039000000.cfilter,nil)==hg:GetCount() end Duel.SendtoGrave(hg,REASON_COST) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local d=Duel.TossDice(tp,1) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(d) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,d) end function c1039000000.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Wed Apr 30, 2014 10:39 pm | |
| It gave me an error. 8: Parameter 2 should be function. |
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Thu May 01, 2014 12:59 am | |
| --Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c1039000000.cost) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.activate) c:RegisterEffect(e1) function c1039000000.cfilter(c) return c:IsDiscardable() and c:IsAbleToGraveAsCost() end function c1039000000.cost(e,tp,eg,ep,ev,re,r,rp,chk) local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0) hg:RemoveCard(e:GetHandler()) if chk==0 then return hg:GetCount()>0 and hg:FilterCount(c1039000000.cfilter,nil)==hg:GetCount() end Duel.SendtoGrave(hg,REASON_COST) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local d=Duel.TossDice(tp,1) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(d) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,d) end function c1039000000.activate(e,tp,eg,ep,ev,re,r,rp,chk) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Added a "chk" to the second "parameter" of the function in line 8... try it out and tell if the problem has been fixed... If not, try:
--Heart of the cards function c1039000000.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c1039000000.cost) e1:SetTarget(c1039000000.target) e1:SetOperation(c1039000000.operation) c:RegisterEffect(e1) end function c1039000000.cfilter(c) return c:IsDiscardable() and c:IsAbleToGraveAsCost() end function c1039000000.cost(e,tp,eg,ep,ev,re,r,rp,chk) local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0) hg:RemoveCard(e:GetHandler()) if chk==0 then return hg:GetCount()>0 and hg:FilterCount(c1039000000.cfilter,nil)==hg:GetCount() end Duel.SendtoGrave(hg,REASON_COST) end function c1039000000.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1,6)and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function c1039000000.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local dice=Duel.TossDice(tp,1) if dice==1 then Duel.Draw(tp,1,REASON_EFFECT) Duel.BreakEffect() elseif dice==2 then Duel.Draw(tp,2,REASON_EFFECT) Duel.BreakEffect() elseif dice==3 then Duel.Draw(tp,3,REASON_EFFECT) Duel.BreakEffect() elseif dice==4 then Duel.Draw(tp,4,REASON_EFFECT) Duel.BreakEffect() elseif dice==5 then Duel.Draw(tp,5,REASON_EFFECT) Duel.BreakEffect() elseif dice==6 then Duel.Draw(tp,6,REASON_EFFECT) Duel.BreakEffect() end end |
| | | Marc1
Posts : 43 Join date : 2013-08-03
| Subject: Re: What did I do wrong? Thu May 01, 2014 2:10 am | |
| The second one worked! Thank you! |
| | | VB99
Member Title : Legendary Planet Posts : 368 Join date : 2013-11-10
| Subject: Re: What did I do wrong? Thu May 01, 2014 2:10 am | |
| |
| | | Sponsored content
| Subject: Re: What did I do wrong? | |
| |
| | | |
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Who is online? | In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest None Most users ever online was 270 on Sun Apr 11, 2021 4:35 pm |
Latest topics | » Goodbye allMon Aug 08, 2016 7:53 pm by Zenas» [PLEASE READ] [VERY IMPORTANT] MACKPRO REVIVALMon Aug 08, 2016 7:47 pm by Zenas» D.D. Dragons vs KozmosSun Jul 10, 2016 11:02 pm by cane_63106» Where's everyone?!Sat May 28, 2016 2:58 am by cane_63106» Mech Archetype (crappy it be, maybe you guys would like it)Sun May 15, 2016 1:11 pm by barti02» My Assassin ArchetypeSun May 15, 2016 1:10 pm by barti02» SO I have a "NEW ARCHETYPE THE "WolfPack"Sun May 15, 2016 12:35 pm by barti02» Fusion monster doesn't appear in extra deck? Sat Apr 30, 2016 9:02 pm by Marc1» Mackpro update 10/6/2015Sat Apr 02, 2016 6:36 pm by Hulkty» Bionicle Cards AKA Japanese Children's Cardgames on Swedish Toy RobotsSun Mar 06, 2016 9:37 am by Utso |
|