Author
|
Topic: inside box
|
abbey |
posted 05-21- 08:36 PM CT (US)
how does inside box work int inside_box(int x, int y, int left, int up, int right, int down);this is what it says in a dink help program but what does it all mean i know the first two but i dont know int left,int up, int down,int right. I am trying to make a key which i have in my inventory open a gate when i am standing in front of it.
|
Tamtur
|
posted 05-22- 03:25 AM CT (US)
For what you are doing, you want int x and int y to be the x and y of dink. int left, int up, int right, and int down are the left, top, right, and down sides of the box. For example:int &dx = sp_x(1, -1); int &dy = sp_y(1, -1); &junk = inside_box(&dx, &dy, 30, 250, 200, 310); In this case, the upper right corner of the box is (30, 250) and the lower right is (200, 310). &junk will be zero if not in the box and one if it is. Good luck. |
abbey
|
posted 05-22- 06:16 PM CT (US)
I still cant seem to get it to work this is my item_key sript that i am using: //item key void main( void ) { &dx = sp_x(1, -1); &dy = sp_y(1, -1); &junk = inside_box(&dx, &dy, 470, 188, 516, 260); }void use( void ) { if (&player_map == 671) { if (&junk == 0) { say("I need to find the right place",1); return; } if (&junk == 1) { say("it worked",1); sp_active(&temphold, 0); } } } can you tell me whats wrong with it please |
Drakeman
|
posted 05-23- 06:11 AM CT (US)
You need to initialize &junk (unless it is a global variable, which it doesn't need to be)use int &junk.... instead of just &junk in the main(void) procedure |
Tamtur
|
posted 05-23- 04:01 PM CT (US)
Also, I think that the inside_box and getting dink's position needs to be in the "use" procedure - I don't think it runs the "main" procedure with each use. At least, I couldn't find any item scripts that had stuff other than int variables in the main proc. So, unless I'm wrong, you could just put the three lines you have in your main proc after your first "if" statement, and add int &junk to your main procedure (or just put int before the &junk in the inside box line)
Good luck
|
abbey
|
posted 05-30- 06:07 PM CT (US)
Thank you all very much |