Chaiscript help.
-
Hi all! loving plutonium. trying to get my simple gsc code to work with chaiscript for hours now.
savecurrentPos() { self endon("disconnect"); self endon("killed_player"); self endon("joined_spectators"); self notifyOnPlayerCommand("v", "+melee"); for ( ;; ) { self waittill("v"); self.saved_origin = self.origin; self.saved_angles = self.angles; self iprintln("^2Current Position Saved"); } } loadlastPos() { self endon("disconnect"); self notifyOnPlayerCommand("f", "+activate"); for ( ;; ) { self waittill("f"); self freezecontrols(true); wait 0.05; self setPlayerAngles(self.saved_angles); self setOrigin(self.saved_origin); self iprintln("^2Last Position Loaded"); self freezecontrols(false); } }``` Honestly any help would be great. i know Very basic gsc. even this took way to long than it should have. simply just trying to make a save/load script. the whole chaiscript thing just its clicking right now. lol Thanks -Kyle
-
// Teleport ChaiScript - xensik def onPlayerConnected(args) { var player = args[0]; gsc.iprintln("hello"); var saved = false; var saved_pos; var saved_ang; player.notifyOnPlayerCommand("save_pos", "+actionslot 3"); player.notifyOnPlayerCommand("load_pos", "+actionslot 4"); player.onNotify("save_pos", fun[player, saved, saved_pos, saved_ang]() { saved_pos = player.getOrigin(); saved_ang = player.getPlayerAngles(); saved = true; player.iprintlnbold("^3Position Saved!"); }); player.onNotify("load_pos", fun[player, saved, saved_pos, saved_ang]() { if(saved) { player.setOrigin(saved_pos); player.setPlayerAngles(saved_ang); player.iprintlnbold("^2Teleported!"); } }); } level.onNotify("connected", onPlayerConnected);
should work when notifies get fixed. wait for a update
-
xensik
Wow, awesome. I really need to spend some time with Chai. Thanks for though though! I tried and tried earlier today.Is the syntax similar to C?
-
xensik said in Chaiscript help.:
should work when notifies get fixed. wait for a update
Are notifies currently broken? How do some servers have save/load pos already working?
-
using C++
-
This post is deleted!