lucid's Recent Forum Activity

  • oh!

    I thought when you said no new major features until 2.0

    online play was definitely out

    this is good news

  • Device name: NVIDIA GeForce 8800 GTS

    Pixel shader: 3

    Estimated VRAM: 2403 MB

    Motion blur: Yes

  • k

    this is tested, it returns the right value and everything

    forreal this time

    the exact code you just posted

    and this in getdata will return your param back to you

    :

    long ExtObject::GetData(int id, void* param)
    {
    	int* myint =(int*)param;
    	return *myint;
    }[/code:1nhqf3aj]
    
    sorry for all the wrong answers 
    
    and to be clear, this also works:
    [code:1nhqf3aj]long ExtObject::GetData(int id, void* param)
    {
    	
    	return *(int*)param;
    }[/code:1nhqf3aj]
    
    you are type casting the void pointer to a int pointer (      (int*)      )
    then you are dereferencing this pointer to get the value of what it's pointing to
    
    please post back to make sure this worked for you
  • no

    I bet I said something wrong

    gimme a few minutes

    I'm going to start from an empty sdk

    and tell you exactly

  • ok

    simple example

    long ExtObject::GetData(int id, void* param)
    {
    	//this would just return the second parameter as an integer....sorry no asterisk needed
    	return (int)param;
    }[/code:2x70bejr]
    
    sorry, you don't need any asterisks there, I just compiled an example to make sure this works
    
    [code:2x70bejr]int* MyIntPointer;  // a pointer to an integer
    
    YourObject->CallFunction(1,MyIntPointer);[/code:2x70bejr]
    
    not sure if it was my confusion that confused you, 
    or if you're not clear on pointers themselves
    
    but the way they work is like so:
    
    int* MyIntPointer; // a pointer to an integer, holds the memory address of an integer
    int MyInt; // I'm pretty sure you know what this is   
    
    MyIntPointer = &MyInt   // Now MyIntPointer points to the Address of MyInt(& is the address of operator) 
    
    [code:2x70bejr]MyInt = 3;[/code:2x70bejr]
    
    now
    
    *MyIntPointer  is equal to 3
    if I say
    [code:2x70bejr]*MyIntPointer = 5;[/code:2x70bejr]
    then 
    MyInt is now equal to 5
    
    the asterisk before a pointer is called the dereference operator, and makes it so you're basically operating directly on the thing pointed to
    
    MyIntPointer without the asterisk, is still equal to &MyInt
    
    hope this made some sense
    Edit:: if you read this before my last edit, read the first part again
    it's (int)param, not int(param)
  • <img src="http://upload.wikimedia.org/wikipedia/commons/a/a1/ZX_Rebelstar_2.png">

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • using the splitup technique you wouldn't need crouching animations for the torso or the head if they were set to 'always' 'set position to' imagepoints that were placed at the connecting points

  • I'm just comparing private variables so it's easy to see the flow and logic, replace those conditions with what you'd need to know to know if your character was doing each of those things:

    <img src="http://files.getdropbox.com/u/1013446/New%20Folder/CustomKeys/New%20folder/Runtime/Capture3.PNG">

  • yeah, that's gonna be a crazy amount of vram

  • other way around

    in GetData(): if you need param for something that's where you cast it

    long ExtObject::GetData(int id, void* param)
    {
    	switch (id)
    	{
    		case 1:
    			return MASS+(int*)param;// for instance, 
    	}
    	return 0;
    }[/code:2tctjxno]
    This is where you would retrieve something:
    
    [code:2tctjxno]stuff += (*i)->GetData(1, *MyInt);[/code:2tctjxno]
    
    I may have messed up the asterisks in the return MASS line in order for it to add correctly
    I'm pretty new to pointer notation, but the basic idea is
    that void* is a pointer to [i]something[/i]
    you have to cast it so it knows what it is
    this way, you can make param any type you want
  • you can pass anything for the void parameter, so

    you have to cast the void* parameter to whatever you need it to be

    like (int)param

    or (string)param

    GetData() and CallFunction() are exactly the same as far as I can tell. There are two of them for logic and readablility

    pretty straightforward so far,

    however,

    if you happen to need more than one parameter there are three ways I thought of that would work

    I never tried it but I believe you should be able to make a struct in both the calling function and in the body of GetData(), and cast it to that if you need multiple parameters

    alternatively, you can pass the parameter (this)

    and cast it to *CRunObject

    then you can do param->GetData(whatever) and have GetData functions in the calling object that will return the parameters you need one by one

    and lastly, you can just set up multiple functions that append all the needed parameters

    like

    long ExtObject::GetData(int id, void* param)
    {
       int param1;
       string param2;
    
       switch (id)
       {
          case 1:
          {
             param1 = (int)param;
             return 0;
             break;
          }
    
          case 2:
          {
             param2 = (string)param;
             return 0;
             break;
          }
          case 3:
          {
             return param1 + param2;
             break;
          }
    }[/code:1pl9i59i]
    
    btw, if you're on right now, you should go to chat
    we can be plugin code buddies
    
    edit:: and if it's not top secret, may I ask what type of plugin you're developing?
  • Very gory... why do you need to cut to shreds what appear to be civilians standing around?

    you don't need to,

    you're just allowed to.

    what fun!

lucid's avatar

lucid

Member since 16 Jan, 2009

Twitter
lucid has 25 followers

Connect with lucid

Trophy Case

  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

24/44
How to earn trophies