[Question]Script Check Please..Need a Prof.To Check This Script!

02/09/2014 21:53 khaledlollol#1
Hello guys..
I want some of you to check this script and tell me if it works..or if there is any thing has to be modified or so...
It's a log procedure..that should Excute a query when a char lvls up.
PHP Code:
USE [Log_DB]
GO
/****** Object:  StoredProcedure [dbo].[_AddLogChar]    Script Date: 02/09/2014 22:43:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


ALTER   procedure 
[dbo].[_AddLogChar
@
CharID        int,
@
EventID        tinyint,
@
Data1        int,
@
Data2        int,
@
strPos        varchar(64),
@
Desc        varchar(128)
as
    declare @
len_pos     int
    
declare @len_desc    int
    set 
@len_pos len(@strPos)
    
set @len_desc len(@Desc)
    if (@
len_pos and @len_desc 0)
    
begin    
        insert _LogEventChar values
(@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)    
    
end
    
else if (@len_pos and @len_desc 0)
    
begin     
        insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2EventPosvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos)
    
end
    
else if (@len_pos and @len_desc 0)
    
begin     
        insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2strDescvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @Desc)
    
end
    
else
    
begin
        insert _LogEventChar 
(CharIDEventTimeEventIDData1Data2values(@CharIDGetDate(), @EventID, @Data1, @Data2)
    
end




IF @EventID 22 -- Character level up
BEGIN
        
DECLARE @CharNameEQ VARCHAR(64) = (SELECT CharName16 from [SRO_VT_SHARD_INIT].[dbo].[_CharWHERE CharID = @CharID)

        
BEGIN
            EXEC 
[SRO_VT_SHARD_INIT].[dbo].[W/E] @CharNameEQ7
        END
        
    END 
02/09/2014 22:49 A new hope#2
should work.
02/09/2014 22:52 magicanoo#3
Yea, it should be working properly. However, Pay attention to the parameters required in the last procedure.

PHP Code:
EXEC [SRO_VT_SHARD_INIT].[dbo].[W/E] @CharNameEQ
02/09/2014 23:09 khaledlollol#4
when i execute it manually the shit works but this script has something wrong that it doesnt execute that query when a char lvls up so weird... check it again or try it with a different query change the query below and try it..
02/10/2014 07:16 Timlock#5
whats the ", 7" for?

first... you should not input the character name... its a bad habbit... you should pass the character id, rather then executing that search EVERY time the log procedure is run... its bad.

Code:
IF @EventID = 22 -- Character level up 
BEGIN 
        BEGIN 
            EXEC [SRO_VT_SHARD_INIT].[dbo].[W/E] @CharID, @Data1, @Data2
        END 
END
If a character levels up from 19 > 20... Data1 would be 19, Data2 would be 20... Pick one, or both like i did...

But try to avoid adding sql queries to log procedures like i said...

Finally... I dont see what the point of this new table is...

SELECT * FROM [SRO_VT_SHARD_INIT].[dbo].[W/E]

will be exactly the same as

SELECT * FROM [SRO_VT_LOG].[dbo].[_LogEventChar] WHERE [EventID] = 22

so.... yea...
02/11/2014 09:32 khaledlollol#6
This is a query to run an Auto Equipment System...
And this 7 is the+ of the Item and CharID cant be added there cuz the whole system works with char name.
That Table works but this Query at LogChar doesnt seem to work if i try to executee this

EXEC [SRO_T_SHARD_INIT].[dbo].[W/E] @CharName , 7
i get my gear..
but when i level up it should run the query but it doesnt..
02/11/2014 12:52 KingDollar#7
ummm


you are using srzor GS ?