a place for all your custom card needs you can post scripts pics and request for card to be made also please donate to the funding for a new server made for custom card duels
 
HomePortalCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | .
 

 What did I do wrong?

View previous topic View next topic Go down 
AuthorMessage
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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....
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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)?

_________________
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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!
Back to top Go down
View user profile
outlaw1994

avatar
Admin
Admin

Member Title : Red-Eyes Lord
Posts : 797
Join date : 2013-07-09
Age : 23
Location : bundaberg qld australia

PostSubject: 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
Back to top Go down
View user profile http://mackpro.userboard.net
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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.
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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...

_________________
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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?
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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

_________________
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: 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....
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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

_________________
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: Re: What did I do wrong?   Wed Apr 30, 2014 10:39 pm

It gave me an error. 8: Parameter 2 should be function.
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: 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
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Marc1




Posts : 43
Join date : 2013-08-03

PostSubject: Re: What did I do wrong?   Thu May 01, 2014 2:10 am

The second one worked! Thank you!
Back to top Go down
View user profile
VB99

avatar


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

PostSubject: Re: What did I do wrong?   Thu May 01, 2014 2:10 am

No problem^^

_________________
Back to top Go down
View user profile http://www.fanfiktion.de/u/VB99
Sponsored content





PostSubject: Re: What did I do wrong?   

Back to top Go down
 

What did I do wrong?

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» Nolan & Synder: Lets count the number of things wrong with Superman Returns
» What the freakingheck is wrong with some people?
» Exam Questions gone Wrong
» What is wrong with this Trident Maple
» Black Ops 2 wrong disc and LLOTR demo mix-up

Permissions in this forum:You cannot reply to topics in this forum
Mackpro :: MackPro :: Custom cards - Single cards-