The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 786 - File: showthread.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/showthread.php 786 errorHandler->error






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RAND and Functions
Author Message
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #1
RAND and Functions
Hey!

I have been messing with RAND, skills and such stuff, and I'm kinda stuck to understand something.. I'm sorry if this is dumb.

I want the first function1 to be harder to happen than the others. Function1 the hardest, function6 the easiest.

So I thought, I would start from the hardest, if it doesn't happen, we move to next one.

Code:
ON=@DClick

IF (<EVAL RAND(500)>) <= (100 + <SRC.SKILL>))
function1_happens
RETURN 1

ELSEIF (<EVAL RAND(400)>) <= (100 + <SRC.SKILL>))
function2_happens
RETURN 1

ELSEIF (<EVAL RAND(300)>) <= (100 + <SRC.SKILL>))
function3_happens
RETURN 1

ELSEIF (<EVAL RAND(250)>) <= (100 + <SRC.SKILL>))
function4_happens
RETURN 1

ELSEIF (<EVAL RAND(220)>) <= (100 + <SRC.SKILL>))
function5_happens
RETURN 1

ELSE
function6_happens
ENDIF
RETURN 1

Now, what really happens is: Always function1 or function2 runs, always! I don't know where I'm going wrong.

If I try on first function, using 50 skill, for example:

Code:
IF (<EVAL RAND(1000)>) <= (100 + <SRC.SKILL>)

So, 150 can't be higher than RAND(1000) all the single time, but it still happens non stop when I double click.

Any tips for me? Am I plain stupid?
Others and better ways to do it are welcome too!

Thanks a lot!
(This post was last modified: 02-03-2014 06:08 PM by pinku.)
02-03-2014 06:06 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
RAND and Functions - pinku - 02-03-2014 06:06 PM
RE: RAND and Functions - Mazer - 02-03-2014, 09:49 PM
RE: RAND and Functions - Alaric - 02-03-2014, 10:15 PM
RE: RAND and Functions - Coruja - 02-04-2014, 12:46 PM
RE: RAND and Functions - pinku - 02-04-2014, 04:58 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)