Jump to content
  • 0

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


Question

Posted (edited)

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

2 answers to this question

Recommended Posts

Posted

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...