This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Project Ideas/Start New Projects => Your Projects
Author Message
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 20 Jun 2008 02:40:54 am    Post subject:

okay, i have worked on ZSTAT a bit, here is the updated prgm, all optimizing in my power has been done.
[attachment=2357:attachment]
and in case you dont want to download the attachments onto your calc, here is the code:


Code:
PROGRAM:WARSCAPE
DelVar ADelVarK
AxesOff:FnOff
real(7,0
real(0
For(F,22,39
For(X,1,50
End
real(5,0,F
End
real(3,255,0
For(F,0,17
For(X,1,50
End
real(5,0,39-F
End
While K "doesnt equal" 105
getKey->K
real(12,3,25,15+A,70,23+A
A+12(K=34 and A "doesnt =" 24)-12(K=25 and A "doesnt =" 0->A
If K "doesnt =" 0
real(3,255,0
End
If A=0
prgmZSTAT
If A=24:Then
real(0
Return
End



Code:
PROGRAM:ZSTAT
For(F,22,39
For(X,1,50
End
real(5,0,F
End
real(7,0
real(12,6,0,0,95,64
real(12,7,-1,26,96,40
real(12,3,0,28,95,38
real(13,1
Text(10,18,"CHOOSE YOUR NAME:
Text(50,7,"Press ENTER to continue...
real(13,0
For(F,0,16,4
For(X,1,50
End
real(5,0,39-F
End

FROM HERE ON THE CODE IS FROM THE TIBD SITE (see custom text input)

" →Str0  // 1 space
Repeat K=105
Repeat K>40 and K<94 or max(K={105,23
Text(-1,30,6length(Str0),"[
Text(-1,30,6length(Str0)+3," //1 space after the quote
For(I,1,30
getKey→K
I+5Ans→I //if K isn't 0, I will go out of bounds, ending the loop.
If I=16 or K
Text(-1,30,6length(Str0)," //1 space after the quote
End:End
K-20-5int(.1K
If 25>length(Str0) and 0<Ans and Ans<29
Then
Str0+sub("ABC  DEFGHIJKLMNOPQRSTUVWXYZ",Ans,1→Str0
Text(-1,30,1,Str0
End
If K=23 and 1<length(Str0
Then
sub(Str0,1,length(Str0)-1→Str0
Text(-1,30,1,Str0,"   //one space after the "
End:End
If 1<length(Str0
sub(Str0,2,length(Str0)-1→Str0

END OF CUSTOM TEXT INPUT CODE (back to my coding)

real(0
8->R:8->D:8->I:8->C
16->A
{1,1,1,1,2,2,2,2,3,3,3,3,3,3->L1
real(13,1
Text(-1,0,0,"STATISTICS:       //seven spaces
real(13,0
1 -> X
For(F,16,40,8
Text(F,10,sub("STR:DEX:INT:CON:",X,4
X+4 -> X
End
Text(55,2,"points left:
For(F,16,40,8
real(1,50,F,1,8,1,11,0,0,0,0
End
real(6
DelVarK

From here on my code needs MAJOR optimization

While K "doesnt =" 9
real(1,50,A,3,8,1,0,8,2,0
1->X
For(F,16,40,8
Text(-1,F,58,expr(sub("RDIC",X,1
X+1->X
End
If R<10:Text(-1,16,64," //1 space
If D<10:Text(-1,24,64," //1 space
If I<10:Text(-1,32,64," //1 space
If C<10:Text(-1,40,64," //1 space
Text(55,38,P," //1 space
real(8
Ans->K
If K "doesnt =" 0:Then
For(F,16,40,8
real(1,50,F,1,8,1,10,0,0,0,0
real(1,69,F,1,8,1,11,0,0,0,0
End
real(6
End
A+8(K=1 and A "doesnt =" 40)-8(K=4 and A "doesnt =" 16->A
If A=16
R+1(K=3 and P>/=L1(R-6) and R "doesnt =" 20)-1(K=2 and R "doesnt =" 8->R
If A=24
D+1(K=3 and P>/=L1(D-6) and D "doesnt =" 20)-1(K=2 and D "doesnt =" 8->D
If A=32
I+1(K=3 and P>/=L1(I-6) and I "doesnt =" 20)-1(K=2 and I "doesnt =" 8->I
If A=40
C+1(K=3 and P>/=L1(C-6) and C "doesnt =" 20)-1(K=2 and C "doesnt =" 8->C
41-(sum(L1,1,R-7)+sum(L1,1,D-7)+sum(L1,1,I-7)+sum(L1,1,C-7->P
End
Menu("CHOOSE A RACE:","Human",A,"Elf",B,"Dwarf",C,"Gnome",D,"Halfling",E,"Half-orc",F
Lbl A:"Human->Str1:Goto "theta"
Lbl B:"Elf->Str1:D+2:C-2Goto "theta"
Lbl C:"Dwarf->Str1:C+2:D-2:Goto "theta"
Lbl D:"Gnome->Str1:I+2:R-2:Goto "theta"
Lbl E:"Halfling->Str1:D+2:R-2:Goto "theta"
Lbl F:"Half-Orc->Str1:S+2:I-2:Goto "theta"
Lbl "theta"
Menu("CHOOSE A CLASS:","Warrior",G,"Ranger",H,"Paladin",I,"Priest",J,"Rogue",K,"Wizard",L,"Druid",M
Lbl G:"Warrior->Str2:prgmZGAME
Lbl H:"Ranger->Str2:prgmZGAME
Lbl I:"Paladin->Str2:prgmZGAME
Lbl J:"Priest->Str2:prgmZGAME
Lbl K:"Rogue->Str2:prgmZGAME
Lbl L:"Wizard->Str2:prgmZGAME
Lbl M:"Druid->Str2:prgmZGAME


okay, i will post the rest of the codes latter (my finders hurt from typing all of that! Very Happy )
thanks for your help, i appreciate all that you guy are doing for me!


Last edited by Guest on 20 Jun 2008 01:32:21 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 20 Jun 2008 04:11:26 am    Post subject:

You'll thank yourself later if you replace all cases of (test1)(test2) with (test1 and test2).

Also, P-L1(R-6)≥0P≥L1(R-6).


Last edited by Guest on 30 Jul 2010 05:52:22 am; edited 1 time in total
Back to top
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 20 Jun 2008 04:14:42 am    Post subject:

you mean while i'm using boolean logic? whats the difference, is it just a size question?
thanks

oh, i didnt see that second tip right away, thats pretty cool!!!


Last edited by Guest on 20 Jun 2008 04:16:06 am; edited 1 time in total
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 20 Jun 2008 10:44:12 am    Post subject:

hey, if you're doing multiple text on the same x coordinate, as you do with your strength, dexterity, and such stats, try this code:

I got the general idea from some tutorial, but then tweaked it just a little.


Code:
:1 -> B
:For(A,16,40,8
:Text(A,10,sub("STR:DEX:INT:CON:",B,4
:B+4 -> B
:End

Hopefully this helps a little with text :)

And thanks for the support last night! I was having a bad day, I guess


Last edited by Guest on 20 Jun 2008 10:44:38 am; edited 1 time in total
Back to top
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 20 Jun 2008 11:17:58 am    Post subject:

okay, here are a bunch of screenshots, i hope everybody likes them!!!



thats just the splashscreen... kind of simple :blush: , but i renounced on greyscale, too complicated having greyscale plus a menu



heres the place where you type in you name :ninja: (thanks you TIBD for the routine Smile )



then you choose you stats... (this part is reaaallly slow in real time :sick: ) you choose your race and class just before, but the screenshots were boring so i didnt post them Very Happy



and this is the game screen (i know, the map is still the tutorial map, but i havent had time to come up with anything better. and thanks to luby for the character sprite)



this is your stat screen Cool



and finally a glimpse at the in game menus

well, thats all i have for now, tell me what you think, i hope you like it!

finally, for those of you who have actually downloaded the game, here's the key chart:
2nd=drink health potion
MODE=drink mana potion
X,T,"theta",n=switch weapon
SIN=switch weapon
Y= =game menu
GRAPH=save menu

i think thats about it!
thanks!

EDIT: and by the way tylerMCL that is a SWEET routine!!! but how would wou get it to work with variables? i tried taking out the quotes, but i got a sintax error...


Last edited by Guest on 20 Jun 2008 11:32:23 am; edited 1 time in total
Back to top
TylerMcL


Member


Joined: 28 May 2008
Posts: 148

Posted: 20 Jun 2008 01:16:49 pm    Post subject:

for stats, you want to use something like this:

Say A=14; B=10; and C=21

If you use this:


Code:
:expr(sub("ABC",2,1


it will give you 10. if you switch the "2" to 3, it will give you 21.

But there's only one catch with this. You can only use letter variables. You cannot use lists or matrices to sparse the values. Now, if you're using a list to store character data, you could use some type of routine to extract the list data into letters, respectively.

I tested the above code, but I've never used it Razz It is a really good method, though, if I do say so myself :biggrin:

Now I'm thinking if you can't use a routine to extract the list data into variables. Let's see what I can't create Very Happy


Code:
...


yeah... I think the only way to designate a storage variable is to have it hard-coded. Neutral sorry...

And by the way, Your menu is going to blow my game's away Very Happy Keep up the amazing work Smile You're doing really well, with good progress. Smile I don't think I'm going to have a fancy custom menu like yours :/ it's custom, just real basic and straight-forward. I like yours a lot!
Back to top
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 20 Jun 2008 01:36:51 pm    Post subject:

thanks, that was really useful and it worked perfectly on my calc. thanks again for all of you sweet routines!!! i wish i had stuff like that to show everybody...

EDIT: however it could be used to CREATE a list, doing something like this:


Code:
{1->L1
For(F,1,6
expr(sub("ABCDEF",F,1
augment(L1,{Ans->L1
End


which is sort of obvious i guess...
well still, this thingy is REALLY useful, i cant wait to look for ways to use it! Razz


Last edited by Guest on 20 Jun 2008 01:45:14 pm; edited 1 time in total
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 20 Jun 2008 02:23:09 pm    Post subject:

Quote:
But there's only one catch with this. You can only use letter variables. You cannot use lists or matrices to sparse the values.


That's not true actually. You could do something like this.


Code:
expr(sub("L1(1)L1(2)L1(3)",A,4


And when A = 1 it will store L1(1) into Ans, and when A = 5 it will store L1(2) into Ans, and so on, just add 4 to A when you want the next number.


Last edited by Guest on 20 Jun 2008 02:25:00 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 21 Jun 2008 02:17:11 am    Post subject:

vanchagreen wrote:
That's not true actually. You could do something like this.


Code:
expr(sub("L1(1)L1(2)L1(3)",A,4


And when A = 1 it will store L1(1) into Ans, and when A = 5 it will store L1(2) into Ans, and so on, just add 4 to A when you want the next number.
L1(A

Last edited by Guest on 30 Jul 2010 05:53:19 am; edited 1 time in total
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 21 Jun 2008 02:59:17 am    Post subject:

Quote:
That's not true actually. You could do something like this.


Code:
expr(sub("L1(1)L1(2)L1(3)",A,4


And when A = 1 it will store L1(1) into Ans, and when A = 5 it will store L1(2) into Ans, and so on, just add 4 to A when you want the next number.


Quote:
L1(A


:blush: Well... I feel kind of stupid right now.
Back to top
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 21 Jun 2008 03:27:20 am    Post subject:

i dont get it... where does the L1(A go?!?!
anyway, i have been wondering wether i should have real time ennemy movement on the map, or do pokemon style battles. i know that real-time is probably cooler, but i am worried that it will really slow down the game, plus graphics are a lot more limited and it will probably be harder to code (unless anybody could help me out with the evvemy coding lol). if anybody has an opinion on this, please tell me so i can plan the game accordingly.
thanks again!

PS any more optimizations are welcome! Very Happy
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 21 Jun 2008 11:55:44 am    Post subject:

L1(A

Replaces

expr(sub("L1(1)L1(2)L1(3)",A,4


Last edited by Guest on 30 Jul 2010 05:53:52 am; edited 1 time in total
Back to top
lordofthegeeks


Advanced Member


Joined: 13 Jul 2007
Posts: 280

Posted: 21 Jun 2008 01:30:57 pm    Post subject:

hey el jache

if you want I have a bunch of sprites you could use.



I can upload more if you want.
just give me a few days till I return to my home computer.
Back to top
Delnar_Ersike
Lazy H4xx0r


Active Member


Joined: 24 Dec 2006
Posts: 578

Posted: 22 Jun 2008 12:19:37 pm    Post subject:

Here are a couple optimizations you also might want to apply (some were taught to me by Weregoose, therefore I was surprised when he didn't mention them):

Not an optimization, but to make things clearer, you should use "!=" when indicating "is not equal to".

Instead of (variable)<10, you can use {variable}=<9 to shave off a byte each instance.

The real(7,0 at the beginning is really not necessary. You are sacrificing 5 bytes just to turn the running indicator off (aka six pixels in the corner, and you still won't be able to use that space)? Plus you will need to use up another 5 bytes toward the end to turn it back on, iirc. Oh, and you basically make it harder for the user if you also implement any Pause command in your programs. Although I use xLib, and I hate the running indicator, I don't see a lot of purpose behind the real(7 command.

Anyway, sorry for the short rant, back on track. Here, at A+12(K=34 and A != 24)-12(K=25 and A != 0->A, you can shave off a byte by replacing it with A+12((K=34 and A != 24)-(K=25 and A != 0->A.

You can replace all instances with {variable}=0 with not({variable} to shave off a byte every instance (the not( command is accessed through the [Math] menu).

I am sure there is a way to optimize {1,1,1,1,2,2,2,2,3,3,3,3,3,3->L1, I just don't know how (I am not good at list functions).

Try not to use the variables X or Y when concerning the graph screen, as they will mess up frequently.

Generic Hint: Having only an If statement instead of an If:Then...End statement will save you space. However, the former statement is slower than the latter, so here is a traditional choice of either speed or size. If you are going for a smaller size in that program, or you don't really care about the execution speed of the command, you can go for the If statement. But in your case, since you want that specific part of your program to run faster, you might have a harder choice.

You have a lot of lines similar to this one, so I will only optimize this one, as you can later apply the optimizations to all the other similar lines:
R+1(K=3 and P>=L1(R-6) and R != 20)-1(K=2 and R != 8->R can be R-(K=2 and R != 8)+(K=3 and R != 20->R and P>=L1(R-6. This will save you 3 bytes (12 if you count all the similar lines as well), and maybe give you some speed too.

Logical Hint (not specifically code-related): You could probably save some space and speed by storing the stat variables directly into a list instead of into a temporary variable that will, in the end, be stored into a list anyway (it is not recommended to store character stats and anything related to a game into a temporary variable; instead, they should be stored into a custom list or a string).

Instead of counting together the total amount of points used and subtracting them from 41 each time, treat P as another variable used for character stats that is lowered one value each time another stat is raised one value, while it is raised one value whenever one of the characters' stats is lowered a value. This would probably change this part of the code (L2 will be involved, which may be replaced with a custom list, as it follows the previous optimization; R corresponds to L2(1), D to L2(2), I to L2(3), and C to L2(4)):

Code:
If A=16
R+1(K=3 and P>/=L1(R-6) and R "doesnt =" 20)-1(K=2 and R "doesnt =" 8->R
If A=24
D+1(K=3 and P>/=L1(D-6) and D "doesnt =" 20)-1(K=2 and D "doesnt =" 8->D
If A=32
I+1(K=3 and P>/=L1(I-6) and I "doesnt =" 20)-1(K=2 and I "doesnt =" 8->I
If A=40
C+1(K=3 and P>/=L1(C-6) and C "doesnt =" 20)-1(K=2 and C "doesnt =" 8->C
41-(sum(L1,1,R-7)+sum(L1,1,D-7)+sum(L1,1,I-7)+sum(L1,1,C-7->P

into something more like this:

Code:
41->P //this will need to be before the While loop
...
A/2-1->B
L2(B)-(K=2 and L2(B)!=8)+(K=3 and P>=L1(L2(B)-6) and 20!=L2(B->C
P+L1(L2(B)-6)(L2(B)-C ->P //the space is only intended for clarification purposes

I haven't calculated how much you will save exactly, but it is a lot.


Here is the entire section of code with my optimizations applied (along with some unmentioned ones, including one concerning the "For(" loops), starting after the custom code and ending before the menus:

Code:
real(0
4->dim(L2
Fill(8->L2
16->A
{1,1,1,1,2,2,2,2,3,3,3,3,3,3->L1
real(13,1
Text(-1,0,0,"STATISTICS:       //seven spaces
real(13,0
1 -> Z
For(F,2,5
Text(8F,10,sub("STR:DEX:INT:CON:",Z,4
Z+4 -> Z
End
Text(55,2,"points left:
For(F,2,5
real(1,50,8F,1,8,1,11,0,0,0,0
End
real(6
DelVar K41->P
While K!=9 //The "Major Optimization needed" part starts here
real(1,50,A,3,8,1,0,8,2,0
For(F,2,5
Text(-1,8F,58,L2(F-1)," //1 space
End
real(8
Ans->K
If not(K
Then
For(F,2,5
For(Z,0,19,19
real(1,50+Z,8F,1,8,1,10+Z/19,0,0,0,0
End:End
real(6
End
A+8(K=1 and A!=40)-8(K=4 and A!=16->A
A/2-1->B
L2(B)-(K=2 and L2(B)!=8)+(K=3 and P>=L1(L2(B)-6) and 20!=L2(B->C
P+L1(L2(B)-6)(L2(B)-C ->P //the space is only intended for clarification purposes
End

When (or if) you try my optimizations out, let us know if it runs faster and how many bytes were saved.

Good luck with your project!

PS. If I were you, I'd put the race and class selection menus first, so players will know what their choices are for race and (especially) class before they decide on which stats to increase and decrease. Also, what is the "S" variable for the Half-Orc stat increase; or did you mean to put "R" there? Oh, I just noticed another thing: you'll have to change the races' stat modifications' code if you want to use a list instead of four variables. As for design purposes, I'd reduce the amount of classes (in turn, I'd make the classes' differences greater) and I'd specify the most and least important stats for each class.


Last edited by Guest on 30 Jul 2010 05:54:50 am; edited 1 time in total
Back to top
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 22 Jun 2008 01:33:05 pm    Post subject:

thank you delnar ersike, your optimizations have saved me over 250 bytes (just in that section!), but the program is acting a little weird: the sprites are drawn all weird until i press the up or down keys (then everything is back to normal), and the second to last line (P+L1(L2(B)-6)(L2(B)-C ->P) isnt working right (i fixed all the rest i'm pretty sure). sadly, i havent noticed much of a speed improvement, and the not( command is acting really weird.
thanks for the help however, it has been very encouraging to see how much space i could get rid of!!!

also, thank you lordofthegeeks for your sprites (yes i would LOVE more!) and vanchagreen for your clarifications :D

more updates and code coming soon!


Last edited by Guest on 22 Jun 2008 01:33:31 pm; edited 1 time in total
Back to top
vanchagreen


Member


Joined: 20 Feb 2008
Posts: 136

Posted: 22 Jun 2008 02:09:26 pm    Post subject:

You're welcome Very Happy

Last edited by Guest on 22 Jun 2008 02:36:02 pm; edited 1 time in total
Back to top
MSR5


Newbie


Joined: 22 Jun 2008
Posts: 49

Posted: 22 Jun 2008 09:22:09 pm    Post subject:

LOL El Jaque, you just used the tiles found from the example porgram and PIC in the xlib download
Back to top
El Jaque


Member


Joined: 01 May 2008
Posts: 122

Posted: 23 Jun 2008 02:49:51 am    Post subject:

Quote:
and this is the game screen (i know, the map is still the tutorial map, but i havent had time to come up with anything better. and thanks to luby for the character sprite)


i said that a couple of posts up (the post with all of the screeshots). :biggrin:

i am working on a spritesheet now, it actually looks pretty cool, the map is REALLY big (i will have to devide into sections or the matrix will be much too big!)

DELNAR ERSIKE: i have fixed the code the best i can, but i still cant get not( to work (everything i do using not( just flickers on and of, its really weird :confused: ) and the last line of code is still acting weird (i replaced the + with a - and it worked okay, but it wouldnt stop substracting from P until i hit another key, so i added :If K != 0 reight before and that fixed the problem, though after a while it started substracting rediculously large numbers Razz !

Quote:
Also, what is the "S" variable for the Half-Orc stat increase; or did you mean to put "R" there?

yup

Quote:
If I were you, I'd put the race and class selection menus first, so players will know what their choices are for race and (especially) class before they decide on which stats to increase and decrease.

it has been done, my lord

Quote:
Oh, I just noticed another thing: you'll have to change the races' stat modifications' code if you want to use a list instead of four variables.

obviously Very Happy

Quote:
As for design purposes, I'd reduce the amount of classes (in turn, I'd make the classes' differences greater) and I'd specify the most and least important stats for each class.

hmm... i'll think about it... i would probably stick with warrior (STR), ranger (DEX), wizard (INT) and priest (CON) in that case. i think that sounds ok. (in between parentheses is the most important stat for that class)

i have though a little about the basic effects that stats have: STRENGTH will boost your melee attack, DEXTERITY will boost your rang attack, whereas INTELLIGENCE will help for spell casting/mana boost and CONSTITUTION will increase your hitpoints/resistance.

i will also make a readme with all of the other info (rules, stats, controls...) do you guys think i should have an in game help system (like press a button and a help screen comes up?)

and also, i still havent decided on the battle system (real time ennemy mouvement on the map as opposed to pokemon style battles). i really need help deciding, seeing as i dont have as much experience as the rest of you! Very Happy
thanks again everybody!

dont forget to re-read this post, it is FULL of edits!!! :biggrin:


Last edited by Guest on 23 Jun 2008 11:39:24 am; edited 1 time in total
Back to top
lordofthegeeks


Advanced Member


Joined: 13 Jul 2007
Posts: 280

Posted: 23 Jun 2008 04:52:48 pm    Post subject:

heres a few more sprites including a 3 level grayscale sheet.

the grayscale is olde rso its not as good as some of my later sprites Also if you want tell me what your looking for And I can make some up for you.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 23 Jun 2008 05:15:03 pm    Post subject:

Delnar_Ersike wrote:
You can replace all instances with {variable}!=0 with not({variable} to shave off a byte every instance (the not( command is accessed through the [Math] menu).
[post="124735"]<{POST_SNAPBACK}>[/post]
This explains all of your not( problems. He meant to say to replace {variable}=0 with not({variable}.

Last edited by Guest on 30 Jul 2010 05:51:41 am; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2, 3, 4  Next
» View previous topic :: View next topic  
Page 2 of 4 » All times are UTC - 5 Hours

 

Advertisement