caspa Posted October 31, 2012 Group: Members Topic Count: 194 Topics Per Day: 0.04 Content Count: 499 Reputation: 3 Joined: 03/11/12 Last Seen: September 18, 2023 Share Posted October 31, 2012 Is This The Correct Way of Writing This Type of Code? coz whenever the red team wins it keeps announcing the blue team wins..... Announce "Battleground has Ended, Team [ "+( ( .winside == 1 )?"Blue":"Red" )+" ] is the Winner.",bc_all; Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted October 31, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted October 31, 2012 if a battleground script that is using .winside variable, there's high chance that's my script OnRedDown: callsub L_EmpDown, 2; OnBlueDown: callsub L_EmpDown, 1; L_EmpDown: .empkiller$ = strcharinfo(0); .winside = getarg(0); awake strnpcinfo(3); if you can read these lines, it means if a blue side crystal is down, the .winside is set to 1, where the getarg(0) is called from OnBlueDown means ... when .winside == 1, red side wins when .winside == 2, blue side wins so you have to switch your position of "Blue":"Red" into "Red":"Blue" btw ... didn't I already did this ? if ( .winside ) { mapannounce "bat_a01", ( ( .winside == 1 )?"Red":"Blue" )+" side wins !", 0; Quote Link to comment Share on other sites More sharing options...
Emistry Posted October 31, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted October 31, 2012 depend on your script.... if your script set .winside to 1 when Blue Team win....then it will announce Blue Team ...else it will announce Red Team... check your script on set .winside,xxxxxx; Edit : LOL....annie is faster ...>.< Quote Link to comment Share on other sites More sharing options...
Ryokem Posted October 31, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted October 31, 2012 (edited) Annie just said everything you need to correct your code. http://rathena.org/b...pt/#entry151361 Anyway, just to add the general case to help you on this kind of structure.. Is This The Correct Way of Writing This Type of Code? ( <condition> ) ? <note 1> : <note 2> Means: if <condition> is met, solve <note 1>; solve <note 2> otherwise. <note 1> and <note 2> actually must be of the same type (2 string or 2 integers about rA) Example with integers: set .@a, ( ( .@b == 2 ) ? 1 : 2 ); // IF .@b == 2, .@a -> 1 else .@a -> 2 Example with strings: mes " + ( ( .@b == 2 ) ? ".@b is equal to 2" : ".@b is NOT equal to 2" ); Edited October 31, 2012 by Ryokem Quote Link to comment Share on other sites More sharing options...
caspa Posted November 4, 2012 Group: Members Topic Count: 194 Topics Per Day: 0.04 Content Count: 499 Reputation: 3 Joined: 03/11/12 Last Seen: September 18, 2023 Author Share Posted November 4, 2012 alright thank you guyz Quote Link to comment Share on other sites More sharing options...
Question
caspa
Is This The Correct Way of Writing This Type of Code? coz whenever the red team wins it keeps announcing the blue team wins.....
Link to comment
Share on other sites
4 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.