View previous topic :: View next topic |
Author |
Message |
Fenrir-Lunaris WUT

Joined: 03 Feb 2003 Posts: 1747
|
Posted: Fri Aug 06, 2004 11:57 am Post subject: Script to check for very large sums of money |
|
|
Another stumbling block... basically I need to know if Check money (I think it's in the 3rd party hsi) can check sums of 100,000 or more. If not, I'll need help to figure out a workaround. Any ideas? |
|
Back to top |
|
 |
Shadowiii It's been real.

Joined: 14 Feb 2003 Posts: 2460
|
Posted: Fri Aug 06, 2004 12:22 pm Post subject: |
|
|
I don't think it does (I think it hits that QBasic max of 30 thousand something).
An idea might be to have check money run everytime you earn money. When it hits (or passes) 30,000, transfer the money to a global instead. Sadly, to readh 100,000, you'll need the money plus at least three more globals. To see your money, press a key (like..."M"). Then display all the globals (maybe with a pause after). That way you could get the general idea of how much money you have.
Another way is to have a safe (I'm gussing this is for B.L.B.). You can deposit money here (up to 30,000), saying that you won't carry over 32,000 on you. Once three safes + one with 10,000 are filled up, you win. That might be more...realistic then just splitting up the money into globals, plus you get to have fun checking your bank account to see if you get more money. This also works because of the premise of BLB.
YET ANOTHER WAY could be to (spoiler here? sorry) SEND the money to...the person who you owe it to. In 30,000 quantities. Same idea as the safe, basically. Besides, once you have 30,000, you should have a pretty good...uh...finantial "base" to rest upon.
Thats the only way I could think of doing it.
OR it does result in numbers >> 100,000. I don't really know (I'll see if I can check though, but I'm guessing it doesnt) _________________ But enough talk, have at you! |
|
Back to top |
|
 |
jabbercat Composer

Joined: 04 Sep 2003 Posts: 823 Location: Oxford
|
Posted: Fri Aug 06, 2004 12:35 pm Post subject: |
|
|
Actually QBasic can go to around 2.400000 if I am correct but James used tons of short ints (32767) to conserve space. As for the check money script, It probably can not, but I have a question, can HSpeak actually support long math i.e: 32767 + 32762 as long as it does not get stored? _________________ Moogle no longer owes prizes. |
|
Back to top |
|
 |
Fenrir-Lunaris WUT

Joined: 03 Feb 2003 Posts: 1747
|
Posted: Fri Aug 06, 2004 12:48 pm Post subject: |
|
|
An excellent Idea, Shadowiii. I'll try that and see how it goes.
Heh, I could imagine the check for 30000 getting lost in the mail :flamedevil: |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Aug 06, 2004 2:18 pm Post subject: no long math |
|
|
jabbercat wrote: | Actually QBasic can go to around 2.400000 if I am correct but James used tons of short ints (32767) to conserve space. As for the check money script, It probably can not, but I have a question, can HSpeak actually support long math i.e: 32767 + 32762 as long as it does not get stored? |
HSpeak does NOT support long math.
Code: | show value (32767 + 1) |
will cause an error |
|
Back to top |
|
 |
RPGCreations E Pluribus Unum

Joined: 18 May 2003 Posts: 345
|
Posted: Fri Aug 06, 2004 3:46 pm Post subject: |
|
|
The best option is to create a money cap, either via plotscripting (run a loop that kills any money after a certian amount) or hopefully James will allow such a feature via CUSTOM *winkwinknudgenudge* _________________
 |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Fri Aug 06, 2004 5:47 pm Post subject: |
|
|
You can emulate long math with 2 or more variables though.
And you can retrieve the exact amount of money and store it in 2 globals using a slow loop like this:
Code: |
define script (1, retrieve money, 0)
global variable (
1, high money #total / 16384
2, low money #total, mod, 16384
)
script, retrieve money, begin
variable (try amount, try inc, ctr)
high money := 0
while (pay money (16384)) do (increment (high money))
try amount := 8192
try inc := 4096
while (try inc) do (
if (pay money (try amount)) then (
#if we've hit the exact amount, stop
if (pay money (1)) then (give money (1)) else (try inc := 0)
give money (try amount)
increment (try amount, try inc)
) else (
decrement (try amount, try inc)
)
try inc := try inc / 2
)
low money := try amount
for (i, 1, high money) do (pay money (16384)) #give back money
end
|
This script will return the amount of money in the globals high money and low money. The total amount of money can be worked out like so:
Total = high money * 16384 + low money
This script can handle an amount of money up to about 55 million. Notice that I have not tested, debugged or optimised it, but it should work in principle. You may use it freely in your games. _________________ "It is so great it is insanely great."
Last edited by TMC on Fri Aug 06, 2004 5:56 pm; edited 1 time in total |
|
Back to top |
|
 |
Shadowiii It's been real.

Joined: 14 Feb 2003 Posts: 2460
|
Posted: Fri Aug 06, 2004 5:50 pm Post subject: |
|
|
Quote: | Code:
show value (32767 + 1)
will cause an error |
Actually, for me it just restarts at the other end of the "number line" (ie it displays -32767). I had this problem in OHR-Date when people got their points around 30,000 (required to win), because the points would go negative. _________________ But enough talk, have at you! |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Fri Aug 06, 2004 6:01 pm Post subject: |
|
|
Yeah, that was really annoying SIII.
Quote: | Actually QBasic can go to around 2.400000 if I am correct |
Signed long ints have a range of 2,147,483,647 to -2,147,483,648, so thats how much money you can have  _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
junahu Custom Title: 45 character limit

Joined: 13 Jan 2004 Posts: 369 Location: Hull, England
|
Posted: Sat Aug 07, 2004 12:22 pm Post subject: Re: no long math |
|
|
James Paige wrote: | jabbercat wrote: | Actually QBasic can go to around 2.400000 if I am correct but James used tons of short ints (32767) to conserve space. As for the check money script, It probably can not, but I have a question, can HSpeak actually support long math i.e: 32767 + 32762 as long as it does not get stored? |
HSpeak does NOT support long math.
Code: | show value (32767 + 1) |
will cause an error |
That can get really annoying sometimes.
question; Why can't you multiply a number by the power of 0? We all know that it always equals 1, so why does it cause an error still? _________________
 |
|
Back to top |
|
 |
Fenrir-Lunaris WUT

Joined: 03 Feb 2003 Posts: 1747
|
Posted: Sat Aug 07, 2004 12:47 pm Post subject: |
|
|
Multiplication by 0 always equals 0. But division by 0 doesn't work period. Think of it like this....
10 cookies divided by 2 people is 5 cookies apeice. 10 cookies divide by one person means that person gets all 10 cookies. 10 cookies given to no people whatsoever is pointless - there could be an infinate number of cookies or even a deficiet of cookies and you'd get the same result no matter what, so for all intents and purposes the number being divided by zero is irrelevant, and the result impossible to calculate. |
|
Back to top |
|
 |
junahu Custom Title: 45 character limit

Joined: 13 Jan 2004 Posts: 369 Location: Hull, England
|
Posted: Sat Aug 07, 2004 12:55 pm Post subject: |
|
|
I SAID MULTIPLY BY THE POWER OF ZERO! I'M TALKING INDICES, NOT DIVISION! IF YOU MULTIPLY TO THE POWER OF ZERO, YOU ALWAYS GET ONE. I WAS ASKING WHY THE POWER OF ZERO CAUSES AN ERROR WITH THE OHRRPGCE
[Edit by Aeth: Reduced the size. Don't do this again.] _________________
 |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sat Aug 07, 2004 1:43 pm Post subject: |
|
|
This would still be irrelevant. If you know it'll turn out to be one, why not just use 1 instead? |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Aug 07, 2004 11:23 pm Post subject: |
|
|
I've never heard the expression 'multiply to the power of'. Don't start shouting.
FL, do you think that that script would be useful to you? _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Shadowiii It's been real.

Joined: 14 Feb 2003 Posts: 2460
|
Posted: Sun Aug 08, 2004 8:47 am Post subject: |
|
|
"to the zeroeth power" or "raised to a zero" would be the correct term (ie x^0). But I'm sure everyone's got it now.  _________________ But enough talk, have at you! |
|
Back to top |
|
 |
|