Blockland Welcome, Guest. Please login or register.
Did you miss your activation email?
December 12, 2017, 10:10:51 AM

Home Help Login Register
+  Blockland Forum
|-+  Blockland Forums
| |-+  Modification Help
| | |-+  [BL SOURCE CODE/REFERENCE] ServerLoadSaveFile_Start/Tick/End/Color Data
Pages: 1 2 [3] 4
Author Topic: [BL SOURCE CODE/REFERENCE] ServerLoadSaveFile_Start/Tick/End/Color Data  (Read 3310 times)
mctwist

« April 19, 2017, 02:38:34 PM »

Code:
function QueueSO::pop(%obj)
{
if(%obj.head != %obj.tail)
{
%obj.head--;
if(%obj.head < 0)
{
%obj.head = %obj.size-1;
%ret = %obj.val[%obj.head];
%obj.val[%obj.head] = 0;
}
}
return %ret;
}

More like this:

Code:
function QueueSO::pop(%obj)
{
if(%obj.head != %obj.tail)
{
%obj.head--;
if(%obj.head < 0)
{
%obj.head = %obj.size-1;
}
%ret = %obj.val[%obj.head];
%obj.val[%obj.head] = 0;
}
return %ret;
}
Logged
Ad Bot

Full members do not see ads

Swollow

« April 20, 2017, 09:03:15 PM »

right my bad
Logged
mctwist

« April 21, 2017, 12:09:02 AM »

Edit: thanks mctwist for catching that ♥

No problem.
Logged
Mocha

« June 12, 2017, 10:41:19 PM »

Posted new functions.
Logged
Potatoh

« June 12, 2017, 11:25:36 PM »

whats the func to paint something
sorry wrong thread
« Last Edit: June 12, 2017, 11:28:06 PM by Potatoh » Logged
mctwist

« June 13, 2017, 01:21:11 AM »

Am I the only one that get bothered that the source uses float as index?
Logged
Conan

« June 13, 2017, 10:49:14 AM »

Am I the only one that get bothered that the source uses float as index?
i get really bothered when the source does comparisons like %index == 2.0
Logged
Mocha

« June 13, 2017, 06:35:51 PM »

Posted music datablock creation.
Logged
Tendon

« June 14, 2017, 06:21:04 PM »

Posted music datablock creation.
Problem on line 38/39 of createMusicDatablocks
Code:
%command = "datablock AudioProfile(" @ %dbName @ ") {" @ "filename = " @ %filename @ ";" @ "description = AudioMusicLooping3d;" @ "preload = true;" @ "uiName = " @ %uiName @ ";" @ "};";
eval(%command);
%filename, %uiname, and maybe description need escaped quotes to work with eval.
So like-
Code:
%command = "datablock AudioProfile(" @ %dbName @ ") {" @ "filename = \"" @ %filename @ "\";" @ "description = \"AudioMusicLooping3d\";" @ "preload = true;" @ "uiName = \"" @ %uiName @ "\";" @ "};";
Logged
portify

« June 15, 2017, 01:15:07 AM »

description definitely doesn't

Note: If you're using that code as inspiration, don't do that anyway. You should be taking advantage of eval's scope if you have to use it.

eval("datablock AudioProfile(" @ %dbName @ "){filename=%filename;description=AudioMusicLooping3d;preload=1;uiName=%uiName;};");
Logged
Crwn

« June 15, 2017, 03:59:08 PM »

It was never posted on the forums but someone created an add-on that rewrites the music datablock creation function to raise the size limit: https://blocklandglass.com/addons/addon.php?id=596
Logged
Conan

« June 15, 2017, 07:18:40 PM »

It was never posted on the forums but someone created an add-on that rewrites the music datablock creation function to raise the size limit: https://blocklandglass.com/addons/addon.php?id=596
CreateMusicDatablocks.

function createMusicDatablocks()
{
   updateMusicList();
   %dir = "Add-ons/Music/*.ogg";
   %fileCount = getFileCount(%dir);
   %filename = findFirstFile(%dir);
   %i = 0;
   while(%i < %fileCount)
   {
      %base = fileBase(%filename);
      %uiName = strreplace(%base, "_", " ");
      %varName = getSafeVariableName(%base);
      if (!$Server::Dedicated)
      {
         if (getRealTime() - $lastProgressBarTime > 200.0)
         {
            LoadingProgress.setValue(%i / %fileCount);
            $lastProgressBarTime = getRealTime();
            Canvas.repaint();
         }
      }
      if (!isValidMusicFilename(%filename))
      {
         %filename = findNextFile(%dir);
      }
      else
      {
         if (getFileLength(%filename) > 1048576.0)
         {
            error("ERROR: Music file " @ %filename @ " > 1mb - ignoring");
            %filename = findNextFile(%dir);
         }
         else
         {
            if ($Music__[%varName] $= 1)
            {
               %dbName = "musicData_" @ %varName;
               %command = "datablock AudioProfile(" @ %dbName @ ") {" @ "filename = " @ %filename @ ";" @ "description = AudioMusicLooping3d;" @ "preload = true;" @ "uiName = " @ %uiName @ ";" @ "};";
               eval(%command);
               if (%dbName.isStereo())
               {
                  error("ERROR: Stereo sound detected on " @ %dbName.getName() @ " - Removing datablock.");
                  schedule(1000, 0, MessageAll, '', "Stereo sound detected on  " @ fileName(%dbName.fileName) @ " - Removing datablock.");
                  %dbName.uiName = "";
                  %dbName.delete();
                  if (getBuildString() $= "Ship")
                  {
                     fileDelete(%filename);
                  }
                  else
                  {
                     warning("WARNING: \'" @ %filename @ "\' is a stereo music block and would be deleted if this was the public build!");
                  }
               }
            }
            %filename = findNextFile(%dir);
         }
      }
      %i = %i + 1.0;
   }
}


ya its a really easy change lol
« Last Edit: June 15, 2017, 07:32:17 PM by Conan » Logged
Conan

« June 28, 2017, 07:39:32 PM »

Looks like the OP contents got reverted. I'll ask Mocha to update it
Logged
superdupercoolguy

« June 28, 2017, 11:44:30 PM »

Why not post the decompiler itself?

5 internet points on it being written in python.
Logged
Metario

« June 29, 2017, 01:15:52 AM »

Why not post the decompiler itself?

5 internet points on it being written in python.
+5 internet points
somebody's busy converting it to c++ but gave up until he can find a good way to store the string tables
Logged
Pages: 1 2 [3] 4  


Login with username, password and session length

Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Page created in 0.041 seconds with 19 queries.