Author Topic: Need help scripting  (Read 4725 times)

Please help me with my weapon!

  • What weapon is it?
  • What has gone wrong?
  • Coding Help
  • It's your weapon...
  • Just edit the Gun or sword scripts.
  • If it's the one at the bottom of your post then it appears to be fine.
  • If it isn't, Badspot disabled signatures for a reason.

Wolf, are you named Wolf in Blockland? I just need to know this...


You act less....noobish....ingame

Because I don't have to!!! O_O OMG... I AM a newbie.

Dude, this is NOT your gun, this is MY M4A1 with new decals, fail.

I know. I wasn't editing it. Just a picture of my clan.

...
If it isn't the one at the bottom of your post, Badspot disabled signatures for a reason.

if you cant get me a functioning model i will be glad to script a weapon for you... im too lazy to make my own models...
scriptings easy though
open file
ctrl c
ctrl v
rename stuff
screw with some numbers
look up a thingy from another gun
ctrl c/v
change mroe things
delete stuff that made gun crash
get pissed off at gun and throw computer out window
bring computer to repair shop
pay $700
edit a few more variables
release gun
get yelled at for it being crappy
un release it
edit more stuff
forget to re-release it
???
profit

if you cant get me a functioning model i will be glad to script a weapon for you... im too lazy to make my own models...
scriptings easy though
open file
ctrl c
ctrl v
rename stuff
screw with some numbers
look up a thingy from another gun
ctrl c/v
change mroe things
delete stuff that made gun crash
get pissed off at gun and throw computer out window
bring computer to repair shop
pay $700
edit a few more variables
release gun
get yelled at for it being crappy
un release it
edit more stuff
forget to re-release it
???
profit

O.O T.....M.....I

For people that dont "winrar"

Quote
//--- OBJECT WRITE BEGIN ---
new GuiControl(FileBrowser) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   visible = "1";

   new GuiWindowCtrl() {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "156 107";
      extent = "407 316";
      minExtent = "8 2";
      visible = "1";
      text = "Browse...";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "0";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";
      closeCommand = "canvas.popDialog(FileBrowser);";

      new GuiScrollCtrl() {
         profile = "GuiScrollProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "6 54";
         extent = "395 256";
         minExtent = "8 2";
         visible = "1";
         willFirstRespond = "1";
         hScrollBar = "alwaysOff";
         vScrollBar = "dynamic";
         constantThumbHeight = "0";
         childMargin = "0 0";

         new GuiMLTextCtrl(txtFileBrowser) {
            profile = "GuiMLTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "2 2";
            extent = "395 256";
            minExtent = "8 2";
            visible = "1";
            lineSpacing = "2";
            allowColorChars = "0";
            maxChars = "-1";
         };
      };
      new GuiTextCtrl() {
         profile = "GuiTextProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "8 28";
         extent = "47 18";
         minExtent = "8 2";
         visible = "1";
         text = "Directory:";
         maxLength = "255";
      };
      new GuiTextEditCtrl(txtDir) {
         profile = "GuiTextEditProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "65 27";
         extent = "63 18";
         minExtent = "8 2";
         visible = "1";
         text = "base";
         maxLength = "255";
         historySize = "0";
         password = "0";
         tabComplete = "0";
         sinkAllKeyEvents = "0";
      };
      new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "131 28";
         extent = "82 19";
         minExtent = "8 2";
         visible = "1";
         command = "conductSearch();";
         text = "Search";
         groupNum = "-1";
         buttonType = "PushButton";
      };
   };
};
new GuiControl(ScriptEditor) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   visible = "1";
   new GuiWindowCtrl(ScriptEditWindow) {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "85 58";
      extent = "530 405";
      minExtent = "8 2";
      visible = "1";
      text = "Script Editor";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "1";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";
      closeCommand="canvas.popDialog(ScriptEditor);";
      new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "266 32";
         extent = "87 20";
         minExtent = "8 2";
         visible = "1";
         command = "openFile();";
         text = "Open";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "22 373";
         extent = "89 21";
         minExtent = "8 2";
         visible = "1";
         command = "saveFile();";
         text = "Save";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiTextEditCtrl(txtFileOpen) {
         profile = "GuiTextEditProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "72 32";
         extent = "190 18";
         minExtent = "8 2";
         visible = "1";
         maxLength = "255";
         historySize = "0";
         password = "0";
         tabComplete = "0";
         sinkAllKeyEvents = "0";
      };
      new GuiTextCtrl() {
         profile = "GuiTextProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "20 32";
         extent = "40 18";
         minExtent = "8 2";
         visible = "1";
         text = "Filepath:";
         maxLength = "255";
      };
      new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "415 32";
         extent = "87 21";
         minExtent = "8 2";
         visible = "1";
         command = "execFile();";
         text = "Exec";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "415 56";
         extent = "87 21";
         minExtent = "8 2";
         visible = "1";
         command = "canvas.pushDialog(FileBrowser);";
         text = "Browse...";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiTextCtrl(txtStatus) {
         profile = "GuiTextProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "21 56";
         extent = "150 18";
         minExtent = "8 2";
         visible = "1";
         text = "(Press \'ctrl s\' to toggle the Script Editor window)";
         maxLength = "255";
      };
      new GuiScrollCtrl(FileScroll) {
         profile = "GuiScrollProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "21 79";
         extent = "485 287";
         minExtent = "8 2";
         visible = "1";
         willFirstRespond = "1";
         hScrollBar = "alwaysOn";
         vScrollBar = "alwaysOn";
         constantThumbHeight = "0";
         childMargin = "0 0";
         new GuiMLTextEditCtrl(txtFileContent) {
            profile = "GuiMLTextEditProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "4 2";
            extent = "400 287";
            minExtent = "8 2";
            visible = "1";
            lineSpacing = "2";
            allowColorChars = "0";
            maxChars = "-1";
         };
      };
      new GuiButtonCtrl() {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "197 373";
         extent = "89 21";
         minExtent = "8 2";
         visible = "1";
         command = "SaveFileAs();";
         text = "Save As:";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiTextEditCtrl(txtFileSave) {
         profile = "GuiTextEditProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "292 373";
         extent = "215 18";
         minExtent = "8 2";
         visible = "1";
         maxLength = "255";
         historySize = "0";
         password = "0";
         tabComplete = "0";
         sinkAllKeyEvents = "0";
      };
   };
};
//--- OBJECT WRITE END ---
function openFile()
{
setModPaths(getModPaths());
%path=txtFileOpen.getValue();
   if(!isFile(%path) || %path $= "")
   {
   messageBoxOk("ALERT","That file was not found!\nPlease verify that the filepath you typed is correct.");
   txtStatus.setValue("ERROR - Cannot open file");
   return;
   }
%file=new FileObject();
%file.openForRead(%path);
txtFileContent.setText("");
   while(!%file.isEOF())
   {
   %line=%file.readLine();
   %line=strReplace(%line,"   ","   ");
   txtFileContent.setText(txtFileContent.getText()@"\n"@%line);
   }
$currFile=%path;
%file.close();%file.delete();
FileScroll.scrollToBottom();
txtStatus.setValue("Contents loaded from file:" SPC %path);
}
function saveFile()
{
   if(!isFile($currFile))
   {
   messageBoxOk("ALERT","You have not yet loaded a file to which you can save.");
   txtStatus.setValue("ERROR - Cannot save file");
   return;
   }
%content=txtFileContent.getValue();
writeTextToFile(%content,$currFile);
txtStatus.setValue("Contents saved successfully.");
}
function saveFileAs()
{
%path=txtFileSave.getValue();
   if(%path $= "" || strStr(%path,".") < 0 || strStr(%path,".") >= (strLen(%path)-1))
   {
   messageBoxOk("ALERT","That is not a valid file path.\nPlease verify that the filepath you typed is correct.");
   txtStatus.setValue("ERROR - Cannot save to file:" SPC %path);
   return;
   }
%content=txtFileContent.getValue();
writeTextToFile(%content,%path);
txtStatus.setValue("Content saved to file:" SPC %path);
//txtFileSave.setValue("");
}
function execFile()
{
%file=txtFileOpen.getValue();
   if(%file $= "" && $currFile $= "")
   {
   messageBoxOk("ALERT","You have not yet loaded a file that you can exec.");
   txtStatus.setValue("ERROR - Cannot exec file");
   return;
   }
   else if(%file $= "" && $currFile !$= "")
      %file=$currFile;
exec(%file);
txtStatus.setValue("Successfully executed file:" SPC %file);
}
function writeTextToFile(%content,%fileName)
{
%file=new FileObject();
%file.openForWrite(%fileName);
   if(getSubStr(%content,strLen(%content)-1,1) !$= "\n")
      %content=%content@"\n";
   while( (%search=strStr(%content,"\n")) >= 0)
   {
   %str=getSubStr(%content,0,%search);
   %content=getSubStr(%content,%search+1,strLen(%content)-1);
      if(%str !$= "" && %str !$= "\n")
         %file.writeLine( strReplace(%str,"   ","   ") );
   }
%file.close();%file.delete();
}
function ScriptEditor::toggle(%this)
{
   if(%this.isAwake())
      canvas.popDialog(%this);
   else
      canvas.pushDialog(%this);
}
function populateFileList(%dir)
{
   while( (%f=findNextFile(%dir@"/*.cs")) !$= "")
   {
   %file="<a:"@%f@">"@%f@"</a>\n";
   txtFileBrowser.addText(%file,(stripChars(%file,"\n ") !$= ""));
   %results=true;
   }
   if(!%results)
      txtFileBrowser.setText("No CS files found in this directory.");
}
function conductSearch()
{
%dir=txtDir.getValue();
populateFileList(%dir);
}
function txtFileBrowser::onURL(%this,%url)
{
txtFileOpen.setValue(%url);
%this.setValue("");
canvas.popDialog(FileBrowser);
openFile();
}
GlobalActionMap.bindCmd(keyboard,"ctrl s","","ScriptEditor.toggle();");
canvas.pushDialog(ScriptEditor);

I made some updates on my Script Editor. Hope it proves helpful.
Where do you put it?

You didn't need all the colors if you get all insulted by that, you get the point...

I like the colors. and by the way
Quote
(if you get all insulted by that, you get the point...)
No I don't care... I like colors.