[CD3.55] Make custom command

smoochy boys on tour

Yolom

LOMCN Veteran
Veteran
Aug 7, 2010
325
21
45
Spain
Hello, I was trying to create a command "@pet", before I put this script:
Code:
[@Mir3G_1]
{
#IF
#SAY
@pet works!\
}
with this I have learned that the command works fine.
But then I switch to this script:
Code:
[@Mir3G_1]
{
#IF
#ACT
    FormatStr "FLD_PJ='%s'" %USERNAME
    ReadValueSql  "TBL_PET"  %A9  "FLD_PJ,FLD_PET,FLD_ENERGIA" [@sigue]


[@sigue()]
#ACT
    Mov   A4      %ARG(2)     
    Mov   D9      %ARG(3)     
    Mov   A3      %ARG(1)    
    goto @invocar




[@invocar]
#IF
Equal D9 0
#ACT
goto @invocar2
#ELSEACT
Sysmsg "Tu mascota no dispone energia, alimentala!"


[@invocar2]
#IF
Checkmonrecall
#ACT
MONRECALL %A4 3 15
SysMsg "Mascota invocada!"
goto @quitarenergia
break


[@quitarenergia]
#IF
#ACT
   Dec D9 10
   FormatStr "FLD_PJ='%s'" %USERNAME
   Mov   A8     %A9
   FormatStr "FLD_ENERGIA='%s'" %D9
   UPDATEVALUESQL "TBL_PET" %A8 %A9
break
}
and the command "@pet" stopped work...
PS: I tested the same script and an NPC works.

Anyone know why?



Regards,
 

hallmat

LOMCN Veteran
Veteran
Feb 19, 2007
555
1
125
your messing with SQL and i bet its not setup you need a table "TBL_PET" but i guess you havent done that
 
Upvote 0

twisterdmk

LOMCN Veteran
Veteran
May 13, 2009
759
28
115
USA
are you trying to open this via d-menu as I take it? Your command is not properly loading to the
[@pet]
Your scripting is all wrong with this if your pulling it via d-menu instead of the npc script. If you look closely!

[@Mir3G_1]
{
#IF
#SAY
@pet works!\
#ELSEACT
goto @testme
}

[@testme]
{
#SAY
Would you like to test me??/
<Yes/@yes1>\
<No/@exit>\

[@yes1]
#IF
#ACT
FormatStr "FLD_PJ='%s'" %USERNAME
ReadValueSql "TBL_PET" %A9 "FLD_PJ,FLD_PET,FLD_ENERGIA" [@sigue]


[@sigue()]
#ACT
Mov A4 %ARG(2)
Mov D9 %ARG(3)
Mov A3 %ARG(1)
goto @invocar




[@invocar]
#IF
Equal D9 0
#ACT
goto @invocar2
#ELSEACT
Sysmsg "Tu mascota no dispone energia, alimentala!"


[@invocar2]
#IF
Checkmonrecall Name Level
#ACT
MONRECALL %A4 3 15
SysMsg "Mascota invocada!"
goto @quitarenergia
break


[@quitarenergia]
#IF
#ACT
Dec D9 10
FormatStr "FLD_PJ='%s'" %USERNAME
Mov A8 %A9
FormatStr "FLD_ENERGIA='%s'" %D9
UPDATEVALUESQL "TBL_PET" %A8 %A9
break
}
 
Last edited:
Upvote 0

Yolom

LOMCN Veteran
Veteran
Aug 7, 2010
325
21
45
Spain
Sorry for not entering, I imagined that there would be no answers. Thanks, now I try and tell if it works.
 
Upvote 0

mapadale

Guest
All great advice from everyone one, but have you all not forgot one vital thing with regards to commands.

3.55 can have up to 4 user commands added, these have to be added into both StrRes3G.txt & CruelDragon3G.INI. I think it also has to go in the database somewhere, but without looking I couldn't tell you.
 
Upvote 0

Yolom

LOMCN Veteran
Veteran
Aug 7, 2010
325
21
45
Spain
Well guys the @pet works. But when put a SQL script, doesnt work. You may that command not support SQL script?
 
Upvote 0