Author |
Message |
|
sirisaackickass
Newbie
Joined: 02 Jun 2003 Posts: 1
|
Posted: 02 Jun 2003 08:46:21 pm Post subject: |
|
|
[FONT=Arial SIZE=1 COLOR=blue]i wannah make a game putting the drugwars and beer hunt together anyone wannah help then email me using the email below in my signature.
[FONT=Times SIZE=14 COLOR=red]Lata.Sir Isaac Kick a
Last edited by Guest on 02 Jun 2003 08:47:44 pm; edited 1 time in total |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 03 Jun 2003 02:16:51 am Post subject: |
|
|
Well, first you'll want to take a look at the source code of both programs,
Though I don't know about the beer hunt one I take it they are both based on menu's:
Code: 0->C
0->H
10->M
Lbl MM //main menu
0->J //not jail
If C:Goto H
Menu("Main","Buy Beer",BB,"Buy Drugs",BD,"Run!",QG
Lbl BB //buy beer
M-1->M //costs 1 money
H-1->H //makes you more hungry
Disp "You have bought a beer."
goto MM
Lbl BD //buy drugs
M-1->M //costs 1 mnoey
H-2->H //makes you hungry
Disp "You have bought drugs, though you where found by the police and must now rot in jail, ha!"
goto JM
Lbl JM
1->J //jail
Goto H
Menu("Jail","Escape",JE,"Beat someone up",JB,"Eat",JF
Lbl JE //escape from prison
H-2->H //makes you hungry
Disp "You escape from prison"
Pause
Goto MM
Lbl JB //beat someone up in jail
H-1->H //makes you hungry
Disp "You can't find anybody in your cell"
Pause
Goto JM
Lbl JF //eat at jail
0->H //makes you less hungry
Disp "You eat, mmm"
Pause
Goto JM
Lbl H //hungry
If not(fPart(H/10:Then //if H is a multiple of 10
Disp "You are Hungry"
Pause
End
If H=50:Then
Disp "You have died from lack of food"
Pause
End
If H=50:Goto QG
If J:Goto JM
Goto MM
Lbl QG
ClrHome
You can mess with that as you like, if there's any problem you run into don't hesitate to ask and I'm sure any of us can help you out. |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 03 Jun 2003 04:11:31 am Post subject: |
|
|
Well, use output to display stuff because you can put up to 8 lines of text.
e.g.
ITEM 123445
TOW 232
I recommend that you left align the numbers to the right side of the screen.
How to right align:
You know that he screen consists of 8 rows and 16 colums.
To output to the uper right corner, OutPut(1,1,"X
To output to the lower left corner, OutPut(8,16,"X
Okay, to right align, we must place a number like 23 (2 digits) at place 15 because it will fill 15 and 16!
So, OutPut(1,15,"23 would display 23 to the right.
If you had 123, you would use
OutPut(1,14,"123 to right align.
Now, you need a routine to do the work for you!
Well, the log of 23 is 1.3617...
The log of 123 is 2.0899...
As you can see, the number before the decimal is 1 when there are 2 digits (23), and two when there are three digits (123).
The pattern will hold true for as long as the calculator can keep track with percision!
Now, we wil use this knowledge to our advantage.
log of 23 is 1.361727836
Taking the iPart will return 1!
iPart(log(23))
The result is 1
iPart can be found by pressing math and then the right arrow to move to NUM. It will be option 3.
Now, sience the result was 1, and above we used OutPut(1,15,"23
We can take 16-1 to make 15
So, OutPut(1,16-iPart(log23)),"23 would yield the same result of aligning the 23 to the right.
Now, you are going to use real variables!
The resulting code to use:
Put any positive real integer in A
12342->A
OutPut(1,16-ipart(log(A)),A
The value in A will be put on row 1 and aligned to the right.
I would also replace the number 1 with a variable, so you can set a variable to the row you wish to use.
Now, you can left and right align things to the right and left of the screen!
BTW, if you wish to display a string, use Length(Str to get the length.
So it would be
OutPut(1,17-Length(Str1),Str1
To right align Str1, and the string cannot be bigger than the screen.
I know, you are thinking why the 17?
The answer is if if Str1 is of lenth one, we want it to display at colum 16, and to get the 16, we use 17-length
Last edited by Guest on 03 Jun 2003 04:16:40 am; edited 1 time in total |
|
Back to top |
|
|
Smasher I'm a llama!
Newbie
Joined: 25 May 2003 Posts: 15
|
Posted: 07 Jun 2003 07:09:05 pm Post subject: |
|
|
I think the point is to take the best aspects of both games and put them together, so you don't have to pick and choose. Also, given how shoddily drugwars is programmed (Beerhunt is better, but it can be optimized too), you might be able to get the new program to be smaller than either of the two original programs! |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 08 Jun 2003 02:16:12 am Post subject: |
|
|
The reason I made such a long post is becasue I want the game to have up to 8 items displayed where the item name is left aligned and the price is right aligned.
Think how nice that would look! |
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 09 Jun 2003 12:58:21 pm Post subject: |
|
|
jbirk, i know this is a little off-topic, but how do you gt the # of zeros in a #?
Ex.
7475000 would return 3 |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 09 Jun 2003 01:36:16 pm Post subject: |
|
|
Put it in a string and use instring ? |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 09 Jun 2003 03:42:30 pm Post subject: |
|
|
Xcrazyandroid wrote: jbirk, i know this is a little off-topic, but how do you gt the # of zeros in a #?
Ex.
7475000 would return 3
I have never done that before, but here is how I would do it (untested):
Code: 7475000->B
0->A
While not(fPart(B
.1B->B
A+1->A
End
BEA->B ;Fix B by putting the 0's back
I have not tested it, but I think A may be one off. You may need to A-1->A
Good Luck, and BTW, 740075000 would still result in the same number of 0's as 7475000 using this method.
Last edited by Guest on 09 Jun 2003 03:43:24 pm; edited 1 time in total |
|
Back to top |
|
|
Xan
Newbie
Joined: 30 May 2003 Posts: 19
|
Posted: 09 Jun 2003 04:43:48 pm Post subject: |
|
|
This works:
Code: Input A
0->B
While A
If not(fPart(.1A
B+1->B
iPart(.1A->A
End
Disp B
|
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Jun 2003 03:07:54 am Post subject: |
|
|
Would any of you like a routine to count the total # of 0's?
3203402023000
6 in the above number. |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Jun 2003 03:13:19 am Post subject: |
|
|
I cannot contain myself, so here it goes:
Code: Input "> ",A
0->B
While iPart(A
.1A->A
If fPart(A
Then
iPart(A->A
Else
B+1->B
End
End
Disp B
The above routine is untested, but here are the results I project:
80010230
result would be 4
Please note that leeding 0's will not be counted!
e.g. 080 only contains one zero |
|
Back to top |
|
|
Xan
Newbie
Joined: 30 May 2003 Posts: 19
|
Posted: 11 Jun 2003 08:31:30 am Post subject: |
|
|
I think you didn't noticed, that I already posted the code to do this. It is tested, works and is smaller than yours |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 11 Jun 2003 12:48:55 pm Post subject: |
|
|
well, Jbirk, of course 080 wouldnt work , even if u did 080->A it would still be 80 in A... |
|
Back to top |
|
|
62 52 53 53 Formerly known as 62 52 53 53
Active Member
Joined: 30 May 2003 Posts: 607
|
Posted: 11 Jun 2003 01:53:33 pm Post subject: |
|
|
if you store the number as a string:
input str1
instring(str1,0)->A
Disp A
str1 is the number, and A is the number of 0s |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Jun 2003 02:19:17 pm Post subject: |
|
|
62_52_53_53 wrote: if you store the number as a string:
input str1
instring(str1,0)->A
Disp A
str1 is the number, and A is the number of 0s
Sorry, but that will not work becaue inString works by finding the loction of a character not the # of characters.
However, this will work
Code: input Str1
0->B
For(A,1,Length(Str1
if expr(Sub(Str1,A,1=0
B+1->B
End
|
|
Back to top |
|
|
Xan
Newbie
Joined: 30 May 2003 Posts: 19
|
Posted: 12 Jun 2003 10:10:41 am Post subject: |
|
|
I think this will work faster as Jbirk's code with very long numbers/stings:
Code: Input Str1
1->A
-1->B
While A
instring(Str1,"0",A+1->A
B+1->B
End
Disp B
|
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 12 Jun 2003 10:27:19 am Post subject: |
|
|
thnkx! i know there is a way to do it with log( but this works just fine! (hint: ya'll r spose to try 2 find the log( version bcuz its smaller) |
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 12 Jun 2003 10:32:23 am Post subject: |
|
|
note that this:
Code: Input B
DelVar A
While not(fPart(.1B
.1B->B
A+1->A
End
Disp A
A->C
While C
10B->B \\restore B to its original #
End
does work |
|
Back to top |
|
|
|