generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Stupid JavaScript Error

Previous Thread :: Next Thread 
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 05:45 PM
This function:

[Assuming everything is defined above]
function CreatePerson(Name, Gender, Type) {
Name = Name || "";
Gender = (Gender==null) ? 0 : parseInt(Gender);
Type = (Type==null) ? 0 : parseInt(Type);

if(AllPeople.length == MaxPeople)
return false;
f(GetPerson(Name) != false)
return false;
if(!TestCreation(Name, Gender, Type))
return false;
Test = new Person(Name, Gender, Type)
AllPeople.push(Test);
return true;
}

Does work when it's called normally, but when it's called with a button, (internet explorer debug error) the error: Object doesn't support this action (WHERE Test = new Person)

Team viewer if you don't understand
Report Abuse
Maradar is not online. Maradar
Joined: 06 Mar 2012
Total Posts: 4478
26 Apr 2013 05:47 PM
Likely since you did not define where it goes. I glanced over it and only know part of JavaScript. So, if I'm wrong, I suppose I'll be wrong.

ProPAIN
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 05:50 PM
I can show you via teamviewer or here's an explanation:

-Create account from inside the script tag (not in a function) it works fine.
-When I do the action within a function, it gives me that error.

[Example:
< SCRIPT >

CreateAccount(x,y,z);
>>True/False

function MakeAccount(x,y,z) {
if(CreateAccount(x,y,z))
>>null or N/A or nothing
else
>>false
}
Report Abuse
prehistoricwoman is not online. prehistoricwoman
Joined: 19 Apr 2013
Total Posts: 205
26 Apr 2013 05:51 PM
> f(GetPerson(Name) != false)

if(GetPerson(Name) != false)*
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 05:51 PM
I accidentally removed the i when copying this, but it's there normally.
Report Abuse
prehistoricwoman is not online. prehistoricwoman
Joined: 19 Apr 2013
Total Posts: 205
26 Apr 2013 05:53 PM
oh. if it isnt fixed in about two hours, then i can try to help over teamviewer. im going out to eat soon. ill check up on the thread when i get back.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 05:54 PM
k

It's a weird problem, I'll try to explain a general view of it:

-Function
-Calls function via < SCIRPT > [returns true OR false]
-Calls function via another function [returns false OR nothing...]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 06:00 PM
OhhEmmGee-e,
What do I see-e;

No problems in script,
JavaScript has tripped; (wut)

If someone won't help me,
I will cry with thee
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 06:29 PM
Figured something out:

It breaks anytime the function "GetPerson" or if not that, "Update" is called

function GetPerson(Name) {
for(i=0; i < AllPeople.length; i++) {
if(Name.toLowerCase() == AllPeople[i].Name.toLowerCase())
return AllPeople[i];
}
return false;
}
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 06:42 PM
The source of the problem (finally found, IDK what's wrong)

if(TestCreation(Name, Gender, Type)) {
if(Type == 8) {
window.alert("You can not change the person to this type");
return;
}
Person = GetPerson(Name);
Person.Gender = Gender;
Person.Type = Type;
UpdatePeopleField(Name);
window.alert("Updated");
} else
window.alert("Make sure the gender and type is valid");

I can make all the accounts I want, but if I update their details, the account creation stops working but the updating still works...
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 06:46 PM
Nope, the actual source is:

(Note: AllPeople is an array)
function GetPerson(Name) {
for(i=0; i < AllPeople.length; i++) {
if(Name.toLowerCase() == AllPeople[i].Name.toLowerCase())
return AllPeople[i];
}
return false;
}


It apparently always works, but when used by the UpdatePerson function, something goes wrong...
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 06:50 PM
Fixed

Problem

Variables Name
(Person) will overwrite the Person function
All I did was change the function name and it worked =D
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
26 Apr 2013 06:53 PM
Perhaps use locals...
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 06:55 PM
ikik, I should of though of that...
Report Abuse
prehistoricwoman is not online. prehistoricwoman
Joined: 19 Apr 2013
Total Posts: 205
26 Apr 2013 06:57 PM
it doesnt seem that hard to forgot three letters.

anyway, is it fixed yet?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 07:02 PM
Yes, and it works perfectly, I'm just rewriting the code now to make it nicer and more efficient (I always do this after I 100 line script or more is finished).
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
26 Apr 2013 08:05 PM
Are you incapable of going to a JS helping forum?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
26 Apr 2013 08:20 PM
Yes,
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image