Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Script to check for very large sums of money
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Fri Aug 06, 2004 11:57 am    Post subject: Script to check for very large sums of money Reply with quote

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
View user's profile Send private message
Shadowiii
It's been real.




Joined: 14 Feb 2003
Posts: 2460

PostPosted: Fri Aug 06, 2004 12:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jabbercat
Composer




Joined: 04 Sep 2003
Posts: 823
Location: Oxford

PostPosted: Fri Aug 06, 2004 12:35 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Fri Aug 06, 2004 12:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Fri Aug 06, 2004 2:18 pm    Post subject: no long math Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
RPGCreations
E Pluribus Unum




Joined: 18 May 2003
Posts: 345

PostPosted: Fri Aug 06, 2004 3:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Aug 06, 2004 5:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Shadowiii
It's been real.




Joined: 14 Feb 2003
Posts: 2460

PostPosted: Fri Aug 06, 2004 5:50 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Aug 06, 2004 6:01 pm    Post subject: Reply with quote

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 Raspberry!
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
junahu
Custom Title: 45 character limit




Joined: 13 Jan 2004
Posts: 369
Location: Hull, England

PostPosted: Sat Aug 07, 2004 12:22 pm    Post subject: Re: no long math Reply with quote

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
View user's profile Send private message Send e-mail
Fenrir-Lunaris
WUT




Joined: 03 Feb 2003
Posts: 1747

PostPosted: Sat Aug 07, 2004 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
junahu
Custom Title: 45 character limit




Joined: 13 Jan 2004
Posts: 369
Location: Hull, England

PostPosted: Sat Aug 07, 2004 12:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Sat Aug 07, 2004 1:43 pm    Post subject: Reply with quote

This would still be irrelevant. If you know it'll turn out to be one, why not just use 1 instead?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Aug 07, 2004 11:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Shadowiii
It's been real.




Joined: 14 Feb 2003
Posts: 2460

PostPosted: Sun Aug 08, 2004 8:47 am    Post subject: Reply with quote

"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. Oookay...
_________________
But enough talk, have at you!
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group