Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Get instance ID without with or something... [solved]  (Read 1172 times)

0 Members and 1 Guest are viewing this topic.
Get instance ID without with or something... [so...
« on: April 30, 2007, 08:05:09 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Code: [Select]
var a;
a = argument0; //New data required
if(objPlayerData.NetworkID==a){
    var b;
    b = other.id;
    clearbuffer(); //Clear current data in memory
    writestring(string(a)); //Write new data into memory
    b.sendmessage(a); //Send data in memory
}

This is untested, but basically, there are many objPlayerData's, and I need to get the one with the ID in argument0, and in it, and do that stuff to it. I want to know basically how to return one particular object if it holds a certain value (networkid). I havent tested the code, but is it right?

Edit: No "with" please.
« Last Edit: May 01, 2007, 10:27:17 am by AoDC »
Logged
the a o d c

Dayjo

shut the fuck up donny.
Re: Get instance ID without with or something...
« Reply #1 on: April 30, 2007, 12:08:46 pm »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Loop through all the objects?

Code: [Select]
for(i=0; i < instance_number(objPlayerData); i+=1){
   if(instance_find(objPlayerData,i).NetworkID = a){
   //do stuff
   break;
   }
}

I'm not entirely sure what i'm talking about, and even if I have the syntax right with those functions.. not used GM in a while.
Logged
  • My Blog
Re: Get instance ID without with or something...
« Reply #2 on: April 30, 2007, 12:36:05 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
I have to ask, why no "with"? D:
Logged
Re: Get instance ID without with or something...
« Reply #3 on: May 01, 2007, 01:19:43 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Quote
I have to ask, why no "with"? D:
Preference.

Quote
Loop through all the objects?

Code:
for(i=0; i < instance_number(objPlayerData); i+=1){
   if(instance_find(objPlayerData,i).NetworkID = a){
   //do stuff
   break;
   }
}

I'm not entirely sure what i'm talking about, and even if I have the syntax right with those functions.. not used GM in a while.
I'll try it, thanks.

Edit:

Code: [Select]
var a,i;
a = argument0; //New data required

for(i=0; i<instance_number(objPlayerData); i+=1){ //Loop all player data objects
    if(instance_find(objPlayerData,i).NetworkID = a){ //If one matches ID
        clearbuffer(); //Clear current data in memory
        writestring(string(a)); //Write new data into memory
        i.sendmessage(a); //Send data in memory
        exit;
    }
}
See where I put i... It keeps giving me an error on it. Variable name expected?
« Last Edit: May 01, 2007, 08:20:34 am by AoDC »
Logged
the a o d c

Dayjo

shut the fuck up donny.
Re: Get instance ID without with or something...
« Reply #4 on: May 01, 2007, 10:03:55 am »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Why are you using i.sendmessage(a) ?
i is just the count for the loop and the instance_find() function.
Logged
  • My Blog
Re: Get instance ID without with or something...
« Reply #5 on: May 01, 2007, 10:08:25 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Sorry, half asleep, lol. Thanks.

edit: No, see, if I assign an ID to a variable, and try to go varibale.scriptname(); it wont let me. That is crap. I need a way around it.

edit: I hate gm, but meh, ill just edit the script to include another ID argument (LAME).

edit: lol, i woke up.

var a,i;
a = argument0;
for(i=0; i<instance_number(objPlayerData); i+=1){ //Loop all player data objects
    clearbuffer(); //Clear current data in memory
    writestring(string(a)); //Write new data into memory
    sendmessage(instance_find(objPlayerData,i).NetworkID); //Send data in memory
}

No errors. Thanks to Dayjo for help.
« Last Edit: May 01, 2007, 10:26:02 am by AoDC »
Logged
the a o d c
Re: Get instance ID without with or something......
« Reply #6 on: May 01, 2007, 11:32:26 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Quote
edit: I hate gm, but meh, ill just edit the script to include another ID argument (LAME).
Theres always real programming languages *hint* *hint*
Logged
Re: Get instance ID without with or something......
« Reply #7 on: May 01, 2007, 11:56:16 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Lmfao. Yea, I know Helios, lol.
Logged
the a o d c
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.314 seconds with 53 queries.