Pages: 1
  Print  
Author Topic: position_destroy()  (Read 2515 times)
Offline (Unknown gender) Brother156
Posted on: April 21, 2010, 06:07:41 PM
Member
Joined: Apr 2010
Posts: 1

View Profile Email
Hi, well I wanted to help out a little. I made a VERY simple gml code for position_destroy() as you don't have it in the list of done functions:
Code: [Select]
with (all) {
if (x > argument0 and x < argument2 and y > argument1 and y < argument3){
instance_destroy();}}

By the way, how can I add these to the ENIGMA R3 I downloaded?
Logged
Offline (Male) retep998
Reply #1 Posted on: April 21, 2010, 06:29:34 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
Code: [Select]
with (all) {
if (x==argument0 and y==argument1){
instance_destroy();
}
}
Go read the documentation on position_destroy's arguments before you try to code it.
Also, don't do anything for R3.
R4 is coming very soon, and it'll have a feature called whitespace where you can add your own functions.

If you really want to help, go learn advanced C++, check out a copy of the latest trunk revision, and ask Josh what you can work on.
Logged
Offline (Male) RetroX
Reply #2 Posted on: April 21, 2010, 06:42:30 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
"Own functions" meaning C++, not GML.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #3 Posted on: April 21, 2010, 07:07:21 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
Now now, retep, he can edit R3 if he likes.
In actuality, neither code is correct. If I recall correctly, position_destroy() operates based on collision, not based solely on a precise position. Meaning that it'd do a collision_point-style test to determine if the instance is to be destroyed.

However, I still appreciate the effort. If more people showed this incentive, ENIGMA would be done in no time.

As far as adding it to R3, you can't; R3's with() isn't set up in such a way that it can work in plain C++ code (R4's may yet be, though). Don't worry, though; as soon as the collision system is in (and the new instance system, for that matter), I will implement this function.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) retep998
Reply #4 Posted on: April 21, 2010, 07:46:26 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
Code: [Select]
with (all) {
   if (collision_point(argument0,argument1,self,true,false)){
      instance_destroy();
   }
}
Logged
Offline (Male) Josh @ Dreamland
Reply #5 Posted on: April 21, 2010, 08:10:03 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
Now if only that code was more of a function and less of a script. :P
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) Micah
Reply #6 Posted on: April 21, 2010, 08:13:55 PM

Resident Troll
Joined: May 2008
Posts: 128

View Profile
The dichotomy between the two is pretty stupid. Although it's nice that since scripts are resources, you have script passing.
Logged
Offline (Male) retep998
Reply #7 Posted on: April 21, 2010, 08:44:15 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
Code: [Select]
void position_destroy(int x,int y){
   with (all) {
      if (collision_point(x,y,self,true,false)){
         instance_destroy();
      }
   }
}
Logged
Offline (Male) Josh @ Dreamland
Reply #8 Posted on: April 21, 2010, 09:31:24 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
<_<"
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) retep998
Reply #9 Posted on: April 21, 2010, 10:27:41 PM

Member
Location: Where else?
Joined: Jan 2010
Posts: 248
MSN Messenger - retep998@charter.net AOL Instant Messenger - retep998 Yahoo Instant Messenger - retep998
View Profile Email
Does position_destroy return anything?
maybe a bool?
true if it deleted something
false otherwise
???
profit
Logged
Offline (Male) Josh @ Dreamland
Reply #10 Posted on: April 22, 2010, 01:12:46 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
I don't believe it does; and if that's the case, I'm not implementing that in ENIGMA. Functions that are used (especially heavily, which position_destroy may not be) in GM should seek to execute the exact functionality as quickly as possible. No one has made use of a return value for that function; adding one will only slow things down (if not by much). If it were truly useful, though, I'd consider it; I don't see how that's the case when int a = instance_count; position_destroy(); show_message(instance_count - a); is an option.
« Last Edit: April 22, 2010, 05:32:30 PM by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: 1
  Print