So then you use something like this:

Code:

BackupRegs:
 push af
 push bc
 push hl
 push de
 ret

RestoreRegs:
 pop de
 pop hl
 pop bc
 pop af
 ret

Quote:
so then I get errors and problems and failed compiles.



How do you get failed compiles from not backing up registers? This seems like the structure of your code is wrong or you are missing a label.

Anyways, let's get back on topic and not hijack this thread.
Was wondering if that would happen. Razz

Player, I got the real(2) command to start working (finally!), but now I need help understanding what the difference is between and/or/xor when adding stuff to the screen.

For instance, I want to have 5x5 sprites for my map, so Kerm said I should xor the sprites together so I don't have gaps everywhere. I just don't quite understand that whole process.
OOOHHH!! GOODIE! Make a bcall that SAVES your memory, not destroys it. That might work!
Going to hijack your thread once more if you don't mind. Adept, there is a difference between bcalls and calls. Bcalls are system calls to routines that the OS uses. It is a way to easily call something that the OS does on its own, like making a file in the memory, or archiving something, or displaying text. A call is code that you write to do a task. Technically, "call"ing something is just pushing the PC and changing the PC to whatever you are calling. Calls have to end with ret so that the program flow is continued. Just making sure that you know that.

Beta7, in regards to or/xor/and:
Code:

And:
a | b | output
1   0   0
0   1   0
0   0   0
1   1   1

Or:
a | b | output
1   0   1
1   1   1
0   0   0
0   1   1

Xor
a | b | output
1   1   0
0   1   1
1   0   1
0   0   0
Where A is your original screen value (pixel on or off, 1 or 0), B is your new value, and output is what is actually shown on the screen afterwards. To me, it sounded like Kerm meant for you to write your own tilemapper for this, and then use OR to put the main part on the screen, AND to create a mask for your sprite, or XOR to remove the sprite from the screen. Though that may just be my take on it.
adept wrote:
OOOHHH!! GOODIE! Make a bcall that SAVES your memory, not destroys it. That might work!
I don't find this post to be very constructive. Can you please elaborate?
Player, that's the part I understand (how and/or/xor work), but what I don't understand is how using that will put the sprites at sets of 5 and not 8.
Beta7 wrote:
Player, that's the part I understand (how and/or/xor work), but what I don't understand is how using that will put the sprites at sets of 5 and not 8.
Your spritesheet will be storing them on offsets of 8, right? However, if you simply draw one at (0,0), another at (5,0), another at (10,0), another at (0,5), etc, then because there are no black pixels in the sixth through eighth columns of your sprites, they will sit happily next to each other.
But I'm using real(2), which requires outputting to every 8 pixels.
As I was trying to plan how to do the house, I had an idea - why not add a farm or something, so people can grow their own stuff. I also thought about having a kitchen where it would take a set amount of real time to make food (which would heal more than just the basic food, maybe give temp. stat bonuses durin a fight?) using For loops.

Does this sound like a good addition? Or is it too "off-topic" from the main game (job-based missions)?
Beta7 wrote:
But I'm using real(2), which requires outputting to every 8 pixels.
If you want to render 5-pixel-wide sprites, then no dice; you can't use real(2). You have to pick either sprites with non-multiples-of-8 width or real(2); I'm afraid you can't have both. Sad

Beta7 wrote:
As I was trying to plan how to do the house, I had an idea - why not add a farm or something, so people can grow their own stuff. I also thought about having a kitchen where it would take a set amount of real time to make food (which would heal more than just the basic food, maybe give temp. stat bonuses durin a fight?) using For loops.

Does this sound like a good addition? Or is it too "off-topic" from the main game (job-based missions)?
Sounds decently fun to me. Perhaps you can try it, and see how it plays out; if it feels too heavy next to the main story, you can always scale that back a bit.
I'm using several If:Then blocks to check if the player is at an appliance, and if they are, then it loads the info specific to that appliance. I then use sum(13) (DCSLibs, GUImenu) to make a menu from the variables, and will be using the Ans given from sum(13) (not the label system) to create the action.

My question is, is using several If:Then blocks the best way to handle this, or is there some function I should use to optimize this?
This is what I thought for that: (Not sure how you handle appliances and such)
Code:
{10,7,4,1->L1
0
Menu("a","10 health",A1,"7 health",A2,"4 health",A3,"1 health",A4
Lbl A1
Ans+1
Lbl A2
Ans+1
Lbl A3
Ans+1
Lbl A4
Ans+1
 
Health+L1(Ans->Health
Beta7 wrote:
I'm using several If:Then blocks to check if the player is at an appliance, and if they are, then it loads the info specific to that appliance. I then use sum(13) (DCSLibs, GUImenu) to make a menu from the variables, and will be using the Ans given from sum(13) (not the label system) to create the action.

My question is, is using several If:Then blocks the best way to handle this, or is there some function I should use to optimize this?


Depends on how it will determine if you are there or not, then it depends on the route you are going to take for making it get the items for the GUIMenu.
Problem with that is that this will all be fairly deep into a program, and I can't afford the time delay (program is already too slow Sad ) created by labels.
Beta7 wrote:
Problem with that is that this will all be fairly deep into a program, and I can't afford the time delay (program is already too slow Sad ) created by labels.


Elaborate please, as I don't quite see what you are saying here. :/
From IRC, it sounded like you were already using labels because of sum(13 or Menu(. Did I misinterpret what you said?
It determines whether I'm there or not by looking at the matrix position and checking if it is the right number. Then it goes through a long list of if/then checks to load the right data.


*Edit* Yeah, I think you did. I was asking if using if/then blocjs was the best way to go, without using labels.

@Sonlen:


Code:
:[J](D+1,C+1->_theta_
:If _theta_ = this that or the other
:Then:Blah blah blah:End
:sum(13.   //using parts loaded from if/then blocks
Beta7 wrote:
It determines whether I'm there or not by looking at the matrix position and checking if it is the right number. Then it goes through a long list of if/then checks to load the right data.


Do you have something made yet? If you do I think it would be easier if you posted a code when you can.
Well, you could... *shrug* The only way (imo) for a bunch of things to happen based on stuff like that is to do a bunch of If/Then/End blocks. I assume there are a bunch of appliances that all do very different things. You could at least shorten the If statements by having a list of values {X,Y,X2,Y2,X3,X4} and then check the location that matches and store that to (let's say...) A, then do: If A = 1: :If A = 2: :If A = 3 etc.
_player1537 wrote:
Well, you could... *shrug* The only way (imo) for a bunch of things to happen based on stuff like that is to do a bunch of If/Then/End blocks. I assume there are a bunch of appliances that all do very different things. You could at least shorten the If statements by having a list of values {X,Y,X2,Y2,X3,X4} and then check the location that matches and store that to (let's say...) A, then do: If A = 1: :If A = 2: :If A = 3 etc.


I think that is pretty much what he posted right above mine. :p
Here it is. :p

Beta7 wrote:
@Sonlen:


Code:
:[J](D+1,C+1->_theta_
:If _theta_ = this that or the other
:Then:Blah blah blah:End
:sum(13.   //using parts loaded from if/then blocks
  
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
Page 2 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot 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

 

Advertisement