Jump to content
  • 0

Compare (<,>,=) function in question...


Peopleperson49

Question


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I'm not completely sure if this would fall under script or sourse support. When using a '>' or '<' sign any number greater than 9 only registers the first number. I have tested this over and over and over again with the same results. For example:

  if(.@X1numtotal$>.@X2numtotal$) { mes "[" + getarg(0) + "]"; mes "My " + .@X1numtotal$ + " beats your " + .@X2numtotal$ + "!"; goto XStart; close; }
if(.@X1numtotal$<.@X2numtotal$) { mes "[" + getarg(0) + "]"; mes "Your " + .@X2numtotal$ + " beats my " + .@X1numtotal$ + "!"; set zeny,zeny+20000; goto XStart; close; }
if(.@X1numtotal$==.@X2numtotal$) { mes "[" + getarg(0) + "]"; mes "Draw, let's play again!"; set zeny,zeny+10000; set #trustfund,#trustfund-100; goto XStart; close; }

My number is the .@X2numtotal$.

The opponent number is .@X1numtotal$.

If I get a 7 and he gets a 2 then I win.

If I get a 3 and he gets a 4 then he wins.

If I get a 8 and he gets a 12 then I still win since 12 starts with a '1' it reads it as lower.

Peopleperson49

Edited by peopleperson49
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

My number is the .@X2numtotal$

The opponent number is .@X1numtotal$

It's because you are comparing string variables.

Since you're storing numbers, you should store them in int variables (just remove the $ from the end of the variable name).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Your right, It didn't event hit me!

Peopleperson49

Edited by peopleperson49
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...