WordsUp Posted December 22, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Share Posted December 22, 2011 (edited) is this code correct? - script sql -1,{ OnAgitBreak: if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) { query_sql("update `woe_record` set `id` = `id`+1 where `guild_id` = '"+getcharid(2)+"'",.@ignore); } OnAgitEnd : if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) { query_sql("update `woe_record` set `castle_id` = '"+getcastlename(2)+"' where `guild_id` = '"+getcharid(2)+"'",.@ignore); } i don't know what .@ignore use i just copy that code somewhere in my files. } Edited December 22, 2011 by WordsUp Quote Link to comment Share on other sites More sharing options...
Z3R0 Posted December 22, 2011 Group: Members Topic Count: 39 Topics Per Day: 0.01 Content Count: 618 Reputation: 201 Joined: 11/09/11 Last Seen: June 14, 2024 Share Posted December 22, 2011 * query_sql "Query"{,<array>{,<array>{,...}}}; * query_logsql "your MySQL query", <array variable> {,<array variable>, ...}; http://ea.dj-yhn.com/index.php?c=query_sql .@ignore is the returned values of the select to an array however, since he is only checking if it worked, there's no reason to worry about it... Quote Link to comment Share on other sites More sharing options...
WordsUp Posted December 22, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Author Share Posted December 22, 2011 thanks for the reply zero but can i ask if this works if i use it? or should i need to change anything for this code to work Quote Link to comment Share on other sites More sharing options...
JayPee Posted December 22, 2011 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 Share Posted December 22, 2011 (edited) I dont know if this is going to work. I assume your checking if the .@ignore has a value? - script sql -1,{ OnAgitBreak: if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) { query_sql("update `woe_record` set `id` = `id`+1 where `guild_id` = '"+getcharid(2)+"'",.@ignore); } OnAgitEnd : if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) { query_sql("update `woe_record` set `castle_id` = '"+getcastlename(2)+"' where `guild_id` = '"+getcharid(2)+"'",.@ignore); } i don't know what .@ignore use i just copy that code somewhere in my files. } If the code does not work try this. I think the update statement do not need any variables since it is only updating. script sql -1,{ OnAgitBreak: query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore); if (getarraysize(.@ignore)>0) { query_sql("update `woe_record` set `id` = `id`+1 where `guild_id` = '"+getcharid(2)+"'"); } OnAgitEnd : query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore); if (getarraysize(.@ignore)>0) { query_sql("update `woe_record` set `castle_id` = '"+getcastlename(2)+"' where `guild_id` = '"+getcharid(2)+"'"); } } Edited December 22, 2011 by JayPeeMateo Quote Link to comment Share on other sites More sharing options...
WordsUp Posted December 22, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Author Share Posted December 22, 2011 then if .@ignore is no need then i can make it like this one? if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'")) { query_sql("update `woe_record` set `id` = `id`+1 where `guild_id` = '"+getcharid(2)+"'"); } Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 22, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 22, 2011 since you are using SELECT , you need a variable to store it....so ... .@ignore is needed in SELECT case when you using UPDATE , there is not needed to use the .@ignore since nothing is used to save in that variable... correct me if i was wrong..>.< Quote Link to comment Share on other sites More sharing options...
WordsUp Posted December 22, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Author Share Posted December 22, 2011 it still not recording on my sql Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 22, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 22, 2011 i guess you are trying to update the point when the WOE End after the Guild has conquered the Castle... try this set .@i,getcastledata( "prtg_cas03",1 ); query_sql("UPDATE `woe_record` SET `id` = `id`+1 WHERE `guild_id` ="+.@i+""); in your previous case...it wont work..because it need a player to be attached in order to get the information of getcharid( ) hope this work for you ~ Quote Link to comment Share on other sites More sharing options...
WordsUp Posted December 22, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Author Share Posted December 22, 2011 getcharid(2) is use to find a guild name right? Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 22, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 22, 2011 *getcharid(<type>{,"<character name>"}) This function will return a unique ID number of the invoking character, or, if a character name is specified, of that character. Type is the kind of associated ID number required: 0 - Character ID number. 1 - Party ID number. 2 - Guild ID number. 3 - Account ID number. 4 - Battle ground ID it use to find those ID.... but it required a Player to attach to it..... Quote Link to comment Share on other sites More sharing options...
WordsUp Posted December 22, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Author Share Posted December 22, 2011 i need to attach a player also hmm i will search about that. Quote Link to comment Share on other sites More sharing options...
JayPee Posted December 22, 2011 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 Share Posted December 22, 2011 (edited) here - attachrid(<account ID>) - detachrid; Like this? script sql -1,{ OnAgitBreak: attachrid(getcharid(3),strcharinfo(0)); query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore); if (getarraysize(.@ignore)>0) { query_sql("update `woe_record` set `id` = `id`+1 where `guild_id` = '"+getcharid(2)+"'"); } OnAgitEnd : attachrid(getcharid(3),strcharinfo(0)); query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore); if (getarraysize(.@ignore)>0) { query_sql("update `woe_record` set `castle_id` = '"+getcastlename(2)+"' where `guild_id` = '"+getcharid(2)+"'"); } } Edited December 22, 2011 by JayPeeMateo Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 22, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 22, 2011 *getcharid(<type>{,"<character name>"}) This function will return a unique ID number of the invoking character, or, if a character name is specified, of that character. Type is the kind of associated ID number required: 0 - Character ID number. 1 - Party ID number. 2 - Guild ID number. 3 - Account ID number. 4 - Battle ground ID it use to find those ID.... but it required a Player to attach to it..... In order to make use of above Command....you must have provide a Players ID to be attached...or the Player it self must "CLICK" on this NPC.. you cant use any getcharid without a players is attachable..... attachrid(getcharid(3),strcharinfo(0)); even though you try to make use of attachrid...but your getcharid is unable to attach a players to get the info of getcharid(3) Quote Link to comment Share on other sites More sharing options...
JayPee Posted December 22, 2011 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 633 Reputation: 78 Joined: 11/14/11 Last Seen: September 20, 2017 Share Posted December 22, 2011 (edited) Aw I didnt notice that XD. I think he needs to know what castle has been conquered and then query first the castle holders/owners in the guild_caste db and then query them in woe_record db if they exist (update) and not exist(Insert)? Edited December 22, 2011 by JayPeeMateo Quote Link to comment Share on other sites More sharing options...
Z3R0 Posted December 22, 2011 Group: Members Topic Count: 39 Topics Per Day: 0.01 Content Count: 618 Reputation: 201 Joined: 11/09/11 Last Seen: June 14, 2024 Share Posted December 22, 2011 I thought OnAgitBreak: carried char over, from the mob death triggered event... does it not? Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 23, 2011 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 23, 2011 ....i didnt realize there is a ...OnAgitBreak Event...i just saw OnAgitEnd ... after all...the above answer / solution...is....useless.. Quote Link to comment Share on other sites More sharing options...
WordsUp Posted December 23, 2011 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 24 Reputation: 0 Joined: 12/03/11 Last Seen: August 11, 2013 Author Share Posted December 23, 2011 i see OnAgitBreak: on agit_template.txt so i need to put that in there? Quote Link to comment Share on other sites More sharing options...
Question
WordsUp
is this code correct?
- script sql -1,{
OnAgitBreak:
if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) {
query_sql("update `woe_record` set `id` = `id`+1 where `guild_id` = '"+getcharid(2)+"'",.@ignore);
}
OnAgitEnd :
if (query_sql("select `guild_id` from `woe_record` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) {
query_sql("update `woe_record` set `castle_id` = '"+getcastlename(2)+"' where `guild_id` = '"+getcharid(2)+"'",.@ignore);
}
i don't know what .@ignore use i just copy that code somewhere in my files.
}
Edited by WordsUpLink to comment
Share on other sites
16 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.