Jump to content

NeonTiger

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by NeonTiger

  1. You can find him on discord @Phantom139, ill link him this post in case others are interested.
  2. http://docs.garagegames.com/torque-3d/reference/classArrayObject.html new ArrayObject(numArray); numArray.add(1,4); numArray.add(2,3); numArray.add(3,8); numArray.add("1,1",5); numArray.add("1,2",9); function ArrayObject::getKeyFromValue(%this,%value){ return %this.getKey(%this.getIndexFromValue(%value)); } function ArrayObject::getValueFromKey(%this,%key){ return %this.getValue(%this.getIndexFromKey(%key)); } numArray.getValueFromKey(1); // will return 4 numArray.getValueFromKey("1,1"); // will return 5
  3. Just a useful function for vector math. Drop it at the bottom of mathTypes.cpp DefineConsoleFunction(createOrientFromDir, const char*, ( VectorF vec),,"Returns orientation from a vector input") { MatrixF mat = MathUtils::createOrientFromDir(vec); AngAxisF aa(mat); char* ret = Con::getReturnBuffer(256); dSprintf(ret, 255, "%g %g %g %g", aa.axis.x, aa.axis.y, aa.axis.z, aa.angle); return ret; }
  4. I messed around with this in 3.10.1 and at first i though it was broken. Then i found out the the gui control needs to be larger in width then the image width to display. Other then that everything that i threw at it seem to display everything just fine.
  5. This is a small update of an old resource that was on garage games. http://www.garagegames.com/community/blogs/view/21262 I added the ability to mark files that you are working in to keeps systems and things like the editor from freaking out and breaking. example: exec("scripts/server/stuff.cs"); to rexec("scripts/server/stuff.cs"); // this file will now auto exec after saving //////////////////////////////////////////////////////////////////////////// First open up volume.h Find these lines template inline bool AddChangeNotification( const Path &path, T obj, U func ) Then add code above them template inline bool AddChangeNotification(const Path &path, U func) { FileSystemRef fs = GetFileSystem(path); if (!fs || !fs->getChangeNotifier()) return false; FileSystemChangeNotifier::ChangeDelegate dlg(func); return fs->getChangeNotifier()->addNotification(path, dlg); } Now open up console.cpp Above this function bool executeFile(const char* fileName, bool noCalls, bool journalScript) Add void reExec(const Torque::Path &path); Now change bool executeFile(const char* fileName, bool noCalls, bool journalScript) To bool executeFile(const char* fileName, bool noCalls, bool journalScript, bool rexec) In the same function change this line if( (dsoPath && *dsoPath == 0) || (prefsPath && prefsPath[ 0 ] && dStrnicmp(scriptFileName, prefsPath, dStrlen(prefsPath)) == 0) ) To if( (dsoPath && *dsoPath == 0) || dStrstr(scriptFileName, "prefs.cs")) //(prefsPath && prefsPath[ 0 ] && dStrnicmp(scriptFileName, prefsPath, dStrlen(prefsPath)) == 0) ) Still in the same function add this after the last #endif if (compiled && rexec) { Torque::Path path(scriptFileName); Torque::FS::AddChangeNotification(path, &reExec); } After the bool executeFile function add void reExec(const Torque::Path &path) { //we know this is a file that exists, and a .cs file, so we can skip a lot of checks... CodeBlock *newCodeBlock = new CodeBlock(); StringTableEntry name = StringTable->insert(path.getFullPath().c_str()); void *data; U32 dataSize = 0; Torque::FS::ReadFile(name, data, dataSize, true); newCodeBlock->compileExec(name, (char*)data, false, 0); delete[] data; } Now open up console.h and change bool executeFile(const char* fileName, bool noCalls, bool journalScript); To bool executeFile(const char* fileName, bool noCalls, bool journalScript,bool rexec); Lastly open up consoleFunctioncs.cpp and replace DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool journalScript ), ( false, false ), "Execute the given script file.\n" "@param fileName Path to the file to execute\n" "@param noCalls Deprecated\n" "@param journalScript Deprecated\n" "@return True if the script was successfully executed, false if not.\n\n" "@tsexample\n" "// Execute the init.cs script file found in the same directory as the current script file.\n" "exec( \"./init.cs\" );\n" "@endtsexample\n\n" "@see compile\n" "@see eval\n" "@ingroup Scripting" ) { return Con::executeFile(fileName, noCalls, journalScript); } With this DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool journalScript ), ( false, false ), "Execute the given script file.\n" "@param fileName Path to the file to execute\n" "@param noCalls Deprecated\n" "@param journalScript Deprecated\n" "@return True if the script was successfully executed, false if not.\n\n" "@tsexample\n" "// Execute the init.cs script file found in the same directory as the current script file.\n" "exec( \"./init.cs\" );\n" "@endtsexample\n\n" "@see compile\n" "@see eval\n" "@ingroup Scripting" ) { return Con::executeFile(fileName, noCalls, journalScript, false); } DefineEngineFunction(rexec, bool, (const char* fileName, bool noCalls, bool journalScript), (false, false), "Execute the given script file. As well as re-execute said file automatically after saving\n") { return Con::executeFile(fileName, noCalls, journalScript, true); }
  6. Great work, i plan on messing around with this during the weekend.
  7. I tried the code you posted above in 3.10 and seems to work. Are you doing this at a long distance? When i was messing around with AI back in T3D 1.2 i ran into an aiming issue. Going off memory, it was something with this if block in aiplayer.cpp if (mFabs(newPitch) > 0.01f) i think i just commented out that if statement and left the other two lines alone. That seemed to fix my aim precision issue. With that said, its not a fix just me trouble shooting so this may still cause problems. // if (mFabs(newPitch) > 0.01f) // { Point3F headRotation = getHeadRotation(); movePtr->pitch = newPitch - headRotation.x; // }
  8. I have had problems in the past with the look animation not begin in sync between two clients on the same server. I had to tweak the number of frames to fix the problem. Tho i'm not sure if its related to this, i thought id bring it up.
×
×
  • Create New...