Jump to content
  • 0

Check Script


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

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;

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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;

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Annie just said everything you need to correct your code.

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 by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

alright thank you guyz

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...