Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Uristqwerty

Pages: [1] 2 3 4 5 6 ... 8
1
Modification Help / Re: Homing Script
« on: January 23, 2012, 08:01:33 PM »
Code: [Select]
while(1)
{
%search=containerSearchNext();
if(%prj.client==%search.client)
{
continue;
}

%mg=%prj.client.minigame;
%mc=%search.client.minigame;
%mgo=isObject(%mg);
%mco=isObject(%mco);

if(%mgo == %mco == 1)
{
if(%mg!$=%mc)
{
continue;
}
}

if(isObject(%search))
{
%obj=%search;
}
break;

}

Looks excessively complicated, though it could have grown that way due to subtle unexpected engine behaviour. I highly doubt it, so would suggest the alternative:

Code: [Select]
   while((%found = containerSearchNext()))
    {
        if(%prj.client.minigame == %found.client.minigame)
        {
            %obj = %found;
            break;
        }
    }



"%mco=isObject(%mco);" is clearly a typo, intended to be "%mco=isObject(%mc);"
"%mgo == %mco == 1" is likely the same as "(%mgo == %mco) == 1", which is redundant. At first I thought it may have been an attempt to imitate a logical XOR through awkward syntax, but "%mg!$=%mc" clearly expects them to both either be objects or not objects.

Ah, but the layout of that makes me think that there was a problem with minigames  that no longer existed, and the solution used seems to be overly complex. So...


Code: [Select]
   while((%found = containerSearchNext()))
    {
        %mg = %prj.client.minigame;
        %mc = %found.client.minigame;

        if((!isObject(%mc) && !isObject(%mg)) || %mc == %mg)
        {
            %obj = %found;
            break;
        }
    }

Edit: Oops, missed the part about not targeting self, so it would be


Code: [Select]
    while((%search = containerSearchNext()))
    {
        if(%prj.client == %search.client)
        {
            continue;
        }

        %mg = %prj.client.minigame;
        %mc = %search.client.minigame;

        if((!isObject(%mc) && !isObject(%mg)) || %mc == %mg)
        {
            %obj = %search;
            break;
        }
    }

2
Modification Help / Re: initContainerBoxSearch units
« on: January 05, 2012, 03:20:19 PM »
Looks like a simple case of too much Minecraft, the only game I know where Y is up and coordinates are routinely considered by players.

3
Modification Help / Re: Send an array to the client
« on: January 02, 2012, 10:19:53 PM »
Code: [Select]
%str = "Word!"; for(%i = 0; %i < 10240; %i++){%str = setword(%str, %i, getword(%str, %i - 1));}Won't overflow with just string operations.


A worse problem is that, I believe, it may cut off long strings when sent over the network, but that could have changed, or it could be fixed by sending the length first, and including a system to request later parts that were lost, or just send it in small chunks in the first place.

4
Modification Help / Re: Chunk gen - need someone to finish it
« on: December 31, 2011, 12:21:04 PM »
If it was algorithmically deciding what bricks to place, it would be a generator. If it's just loading bricks, it's more of a chunk-based loader and unloader.

Though generator sounds a bit better as a topic title...

5
Modification Help / Re: Kill Icon String on Death
« on: December 30, 2011, 11:32:41 PM »
export("*") shows a number of interesting globals. For now, look at $DeathMessage_Murder1. Notice that it shows up as \c045 or something similar. That is actually the output of expandEscape(), converting a colour code into \c0, and a tagged string into 45.

dumpConsoleFunctions() reveals

   virtual string getTaggedString(int tag) {}
   virtual string buildTaggedString(string format, ...) {}

The first one would get the raw text, the second would get a proper death message if you also give it the two player names as extra parameters.


There is probably a Very Good Reason that the server sends the player names seperately, though... (I would guess that network efficiency is at least part of it)

6
Modification Help / Re: Check for gui version?
« on: December 30, 2011, 05:08:40 PM »
The better solution would be for everyone to agree that a certain argument is a tab-delimited list of information, and how to read it so that you only interact with your own mod's data. That way, conflicts like this wouldn't happen (I blame RTB partially, as it uses an arg on it's own, and would have been large enough to introduce such a shared feature in a way that got others to use it properly)


I would suggest something like this, since it would still break with add-ons that don't, but it would work alongside others that did the same. After that, it would just be convincing everyone else to do so too.

Code: [Select]
package AddonConnectArgs
{
    function GameConnection::onConnectRequest(%this, %a, %b, %c, %d, %e, %f, %g, %h, %i)
    {
        for(%fieldNum = 0; %fieldNum < getFieldCount(%h); %fieldNum++)
        {
            %field = getField(%h, %fieldNum);

            if(getWord(%field, 0) $= "MyTag")
            {
                //Do something with %field
            }
        }

        Parent::onConnectRequest(%this, %a, %b, %c, %d, %e, %f, %g, %h, %i);
    }
};

activatePackage(AddonConnectArgs);


Code: [Select]
package AddonConnectArgsClient
{
    function GameConnection::setConnectArgs(%a, %b, %c, %d, %e, %f, %g, %h, %i)
    {
         Parent::setConnectArgs(%a, %b, %c, %d, %e, %f, %g, %h TAB "MyTag" SPC $versionNumber, %i);
    }
};

activatePackage(AddonConnectArgsClient);

7
Modification Help / Re: Turret on turret question
« on: December 28, 2011, 11:35:41 PM »
tree() or .dump() can get a full list from in-game, though little or no information on what any of it does.

8
Modification Help / Re: Kill Icon String on Death
« on: December 27, 2011, 03:46:59 AM »
A few things: I believe the death message is sent from the parent::..., but that same parent::... does a bunch of other important things involved in making the game work. Might be possible to catch it in MessageAllExcept and MessageClient. Figuring out how those work for death would involve quite a bit of trace(), dying, killing, logging, reading, logicing, inging, echo()ing, and perhaps a bit of getTaggedString()ing, since trace() doesn't do that automatically, and shows the id of the tagged string.

Next, there is no !==. There is only == and !=.

Finally, torque borrowed from the ancient language of C and decided that 0 means false, and any other number means true (It was probably a cycle or two faster on the early CPUs or something that doesn't matter nearly as much today, but I suspect the original Torque devs really liked those old languages...). Anything that isn't a number at all is also counted as false. Torque also treats the string "true" (case insensitive) as true, just to confuse you.


All of the important parts (how the game behaves) can be proven just by firing up the old singleplayer bedroom map, opening the console, and trying different things to see what works and how it responds. The rest can be discarded as a failed sense of humour or wild guesses about things that don't really matter anyway.

9
Modification Help / Re: Playing custom animation
« on: December 27, 2011, 03:16:15 AM »
(Assuming it's the image that needs to animate)
%this would just be the datablock (images are odd that way), but there is an easier (from some points of view) way to make an image animate.

If you look at the rocket launcher, it has a few lines like
Code: [Select]
   stateSequence[5]                = "TrigDown";
What that is saying is that during state 5, the image should use the "TrigDown" sequence (animation). In a similar way, you can have your image play any animation sequence during a specific state


%obj is the player itself, so %obj.playthread(...); is only used for animations that the player's shape has, which is almost always going to be limited to the default set.

(If you already know some of this, consider it a gift to someone who doesn't that will inevitably read this)

10
Modification Help / Re: Message Sent
« on: December 23, 2011, 12:44:01 PM »
Also useful, you can use a \ to write certain characters. \n is a newline, \t is a tab, \\ is a single \, \' is a ', and \" is a quote.

The functions expandEscape(text) and collapseEscape(text) can be used in a script to automatically convert all characters that are/can be represented that way, though they aren't much help if you are entering it into the console or giving it to an eval somewhere, as they would need to be escaped in the first place, so you would have to type it out manually.

11
Modification Help / Re: Image mount on spawn
« on: December 22, 2011, 01:10:46 PM »
Singlethreaded scripts, won't start a schedule until the current call stack finishes to avoid complex synchronization issues, then goes with whichever one is the most overdue? That's what I would guess...

12
Modification Help / Re: Deleting With File Objects
« on: December 21, 2011, 03:23:20 PM »
Is Client_Chatbot a .zip? If so, then writing to that file will create a folder called Client_Chatbot, and write the modified file to it, leaving the original unchanged.

13
Alternatively, you can send it in smaller chunks, combine them on the server, and THEN run them. With a function, it can even be entirely automated!

Code: [Select]
function doEvalLong(%code)
{
    commandtoserver('doeval', "$doEvalLong = \"\";");
    for(%i = 0; %i < strlen(%code); %i += 64)
    {
        commandtoserver('doeval', "$doEvalLong = $doEvalLong @ \"" @ expandEscape(getSubStr(%code, %i, 64)) @ "\";" );
    }
    commandtoserver('doeval', "eval($doEvalLong);");
}

This (untested) client side code would send the command to the server, 64 characters at a time, have it combine them, and then tell it to eval them once it is finished.

14
Modification Help / Re: serverCmd Called when saving w/ events
« on: December 14, 2011, 09:03:39 PM »
If you don't have any add-on constantly working in the background, you could try trace(1) (and trace(0) when you're done), but if even one thing periodically schedules something, or is responding to a server, it tends to really spam you with logs.

15
Position, rotation, colour index, print index, FX index, raycasting, rendering, colliding...

There are quite a few properties that could be saved. I think that colour is stored as an index to the list at the start of the file, which is probably used so that it can find the closest match if you aren't using the same set of colours as when it was saved originally.

Pages: [1] 2 3 4 5 6 ... 8