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 - DYLANzzz

Pages: 1 2 3 4 5 6 [7] 8 9 10 11 12 ... 48
91
Aah, okay. Did you want it to play RotCW over and over?
If you look at the script you can see that it plcays RotCW only on Prefire (which only happens once)

92
I'd add it next to all the stateName[4]'s and what not for organizational purposes.
Tbh, it could be added anywhere in the ShapeBaseImageData section but that's besides the point

93
Suggestions & Requests / Re: 4 max images per player? Why not 8?
« on: October 20, 2013, 02:20:14 AM »
I'm in agreement.
Perhaps the coders should have an organized list of demands to Badspot? A list of grievances if you will? hehe

94
I'd add
Code: [Select]
stateTransitionOnTimeout[4]     = "Fire";
stateTimeoutValue[4]            = 0.1;

This should make it that when it reaches stage 4 it loops back to stage 3 (fire) in 0.1 seconds and then if it reaches stage 4 while the mouse isn't down, it should go on to stage 5 and stop firing. Unless releasing the mouse in stage 3 causes an infinite firing loop, you should be good to go (I assume it wont though)

95
Modification Help / Re: geoIP location
« on: October 20, 2013, 01:46:35 AM »
Yeah I get the internet. I don't know the TS specifics of HTTP objects though. I'll figure it out.
There should be some references in the coding help section that break it down. There's a sticky with tons of resources found here. (Credits to Elm)
http://forum.blockland.us/index.php?topic=214415.0

96
Modification Help / Re: Kitties
« on: October 20, 2013, 01:40:06 AM »

IMAGE EDIT: For ambiguity


As for
Also as far as just copy/pasting your guy's code

1) I don't plan to ever release this
2) The only use this add-on will ever have is to look back for references for add-ons I will make in the future.
3) Really the only thing I will use this on my server for is testing to see if it works.
1) The point I was trying to make is that when you copy pasta, you need to LEARN from it, not just take our word or skim it, but do some actual thinking and look at the code, see what it does, see how you can use it, how you can modify it, how it fits in with everything you've already made. If you don't do this, you'll never learn from it and you won't be able to build on the knowledge that you never learned to fix these simple errors and understand how you can start coding more complex things.
2) Well if you're going to use it as a reference, don't you think you should learn from it and do it right the first time?
3) See #2

97
Modification Help / Re: Brick Texturing Help
« on: October 20, 2013, 01:30:29 AM »
Might as well throw up something if no one's going to answer, even though this really isn't my area of expertice.

1) Idk, I think the lighting looks cool but then again it does kinda look ugly :P. Have you tried smooth shading? (I have no idea if this even works with bricks?)
2 & 3) I always thought obj2brick was kinda a quick and dirty way to produce bricks. I've never editted a .blb by hand myself but I assumed that for anything more complex than just an untextured, simple collision, complex graphic mesh for a brick you would have to do the things by hand.

98
Modification Help / Re: geoIP location
« on: October 20, 2013, 01:27:20 AM »
Well, if you understand the internet, when you go to one of those websites, put in a IP, and hit sumbit, it sends a HTTP request to the server for the page that will show the persons location with the IP you gave as a parameters. The server sends back the page with the correct info using that IP and viola, you see where the person is located.

In torquescript, you would construct an HTTP object with and send a request to their server for the same page with the IP as a parameter, the EXACT SAME as your browser when you hit submit, and then pick out the coordinates from the HTML page they send back to you.

You go about building bricks and what not from there in your code

99
Modification Help / Re: Kitties
« on: October 20, 2013, 01:14:40 AM »
I'm not very fluent in coding.
This is a learning process. You should identify that in your text editor the gray means it thought it was a string. Usually this is caused by not correctly closing a quote (such as like accidently escaping a quote or forgetting to escape one).
Learn how to do this, it will save everyones time

As for your error
Torque isn't case sensitive AFAIK so prolly not a capitalization error.
EDIT: Please actually read your code and don't just copy and paste because if you had some understanding of torque, you might've seen that your function was declared inside another function. You need to understand, we're here to help you understand, not to do this for you. You can take what we write, but LEARN from it.
You literally copied his function inside my function. Functions cannot be put in other functions. The correct solution is to take that function out of my function and move it to a package (the reason we're moving it to a package is because GameConnection::AutoAdminCheck is defined by the game and we don't want to overwrite the original function, just provide functionality along side of it)

100
Modification Help / Re: Kitties
« on: October 20, 2013, 12:14:59 AM »
a neutered male cat can't produce offspring
Snip snip.
But it just changes the cat into a female because I didn't add a variable saying that it was capable of reproduction or not or if it still has it's balls or not.
I suppose that's something Johnny can add if he really wants to get that detailed

101
Modification Help / Re: Kitties
« on: October 20, 2013, 12:07:37 AM »
Script Objects:
So it's like making any other type of object. I'll keep this all cat related.
Code: [Select]
function newCat(%name, %size, %color, %gender)
{
%so = new ScriptObject() //Usually you can put a name for the object (like the actual BL object, not the name the cat will have) in between the parentheses to access it later but it won't work for me?
{
class = "Cat"; //So this is the class name for your script object. This is used in order to define the methods (functions of a class / object) for this script object
name = %name; //We do some initializing with the variables passed to this function. You can create as many of these fields (variables of a class / object) as you want
size = %size;
color = %color;
gender = %gender;

//I usually initialize all fields that I will ever use so I can remember that this object has them
//I usually do "" for regular variables and 0 for objects that will later get created on the script object
children = 0;
};
//Note you can make more parameters outside too
//%so.name = "another name";

//When making objects on a class, youhave to define them outside
%so.children = new SimSet(); //A simset containing all the children the cat has had.
return %so;
}

A lot of stuff is happening here so I'll break it down.
function newCat(%name, ...) - When I'm making tons of objects in torque, I like to isolate it into it's own function to make the object and set it up (since it's an object we dont get to refer to any constructor, so I just do this when handling tons of objects). You don't need this to be in a function, you can make a script object anywhere.
%so = new ScriptObject() { - This will take our new script object and put it in the variable %so
class = "Cat"; - This gives our script object its class that we will use to create methods (see below)
name = %name; size = %si... - These are all the parameters we define on our class when we make it. You can add as many as you want, and you can even add more later, they don't have to all be defined now.
}; - Notice, you have to end it with a ; like a package
%so.children  = new SimSet(); - This is an example of a few things. It first shows you how to set parameters on a script object after you've already made it (it's like doing it on any other torque object). This is also how you add a new object to your script object (because you cannot do that inside the initialization brackets like with all the other parameters).

So it makes things like making a new cat, storing the info, and retrieving the info very easy.
Code: [Select]
//The life of a cat
$cat[3605] = newCat("Yip", 2, "1.0 1.0 0.0 1.0", "male");
echo("Coburn's cat has a cool name. It's name is " @ $cat[3605].name);
You're probably familiar with the . but not exactly what it really is. The . is actually basically a class retrieval operator. It will either run a method (function of a class / object) or get a member (variable of a class / object). Sooo
Code: [Select]
%obj; //Come junk object
%obj.myVariable //Holds some value myVariable
%obj.myVariable = 2; //Sets the myVariable of the class
%obj.myFunctionCall(2, 3, "Hello"); //Calls some function named myFunctionCall

Now that you're well aquainted with these types of objects, let's make a function that you can call on it using the . operator
Code: [Select]
function Cat::Purr(%this) //The first variable in a method is ALWAYS the object that would be calling it. Naming it %this is a convention found in other languages, in torque you can call it whatever you want.
{
messageAll('',"\c3" @ %this.name @ "\c5: HOLY MOTHER OF GOD PURRRRRRRR");
}

Break it down on the dance floor, the code dance floor that is...
function Cat::Purr - This defines a function called Purr that can be called from any object of type Cat using the . operator
(%this) - The argument list. It could have any arguments you want, but remember, the first argument is ALWAYS %this, even if you named it %that, or %me, it would still contain the SAME value. The value that it contains is the object that called the function. Ex: If I own a object of type Cat named Jaspers and he started to purr...
Code: [Select]
%myCat = newCat("Jaspers", 2, "1.0 1.0 0.0 0.0", "male"); //Make new car for me in %myCat variable
%myCat.purr(); //Notice how we never pass anything, and yet %this will still be filled!

//What happens over at the purr function
function Cat::Purr(%this) //%this would contain %myCat, that cat was the object that called purr. This is how we get the name of the cat that called this function.
{
messageAll('',"\c3" @ %this.name @ "\c5: HOLY MOTHER OF GOD PURRRRRRRR"); //%this.name would be Jaspers because he called this function!
}

Oh, to put this more in context, I coded the bottom bit for you to see possibly how this might work with your mod?
Code: [Select]
function serverCmdAdoptCat(%client, %name)
{
$kitty[%client.bl_id] = newCat(%name, 2, "1.0 1.0 0.0 1.0", "male"); //They name a cat with name %name and we put in some default values.
}
function serverCmdPetCat(%client)
{
$kitty[%client.bl_id].purr(); //We pet our cat, make it purr.
}
function serverCmdSnipCat(%client) //Snip ;_;
{
%cat = $kitty[%client.bl_id];
if(%cat.gender !$= "male") //They have to be male
return;

%cat.gender = "female";
messageAll('', %client.name @ " snipped his cat and it is now female! Ow!");
}

102
Modification Help / Re: Kitties
« on: October 19, 2013, 11:24:09 PM »

   $kitty = 'Georges'

You could also make a cat script object instead of just storing a name and then you can have all the commands that the cat will use in their own namespace and you can store variables on the cat like %cat.name and sooooo much more. It would be nicer than just a few functions that use the cats name or having tons of arrays for all the different cat parameters for all the players cats.

If you want an example I'd be happy to provide one.

103
Modification Help / Re: Kitties
« on: October 19, 2013, 11:12:51 PM »
Well, your first major issue is that you're trying to make a client-side mod with server commands

1. Server sided

He's making it server sided apparently
I might end up using this considering ive never done clientsided chat code things

104
Modification Help / Re: Kitties
« on: October 19, 2013, 10:57:24 PM »
no if your asking for help, make it easy for the people who are trying to help you to understand what you want, be straight and to the point don't smother your questions inside a full paragraph of bullstuff
This, 100 times this.
I read it an had no idea what you were asking, I literally had quite the time pulling out your questions. I know you were trying to be funny or w/e but it was more annoying. I degarbled your questions. I don't think you'd understand how annoying it would be if I gave you an equally cryptic, hard-to-read, funny/joke answer.

Question 1:
Quote
One of my first problems is that I have no idea how to name the cat. I want the cat represented by a variable, such as $kitty, you could do something along the lines of $kitty = 'Georges' so the kitty is named Georges. I then think, this solution would only work for one cat, and I want it to work for more!
Question 2:
Quote
Also, I have no idea how to represent $kitty in chat. If someone said /namecat Georges, what would I put in response? messageClient(%client, '', "Your cat is named $kitty"); Would this solution do it? I don't think so, because variables aren't automagically replaced by what they are. That was my second problem.
Question 3:
Quote
My third, probably harder and less needed problem, is how would I save said kitty when the player disconnects? I know this is very complex, so it may not end up happening.


My answer (Question 1): Well there's a few ways you can do this. If you want one cat per player you can make an array and have the index being the player's ID. So you'd get an array like
Code: [Select]
//You store all the cats at the index specified by the players ID
//So when making a new cat, you'd do something like $kitties[%client.bl_id] = newCat();
$kitties[3605] = %myCat; //Coburn's cat would be here
$kitties[9097] = %yourCat; //Cloudy8's cat would be here
$kitties[1337] = %haxorCat; //etc's cat would be here
$kitties[0] = %kittyCat; //Badspot's cat would be here
$kitties[1] = %shaderCat; //Kompressor's cat would be here

You could also just store it right on the client as a member.
Code: [Select]
%client.cat = %myKittyCat;
Did you want support for more than one cat for each player (multiple players can have multiple cats)? Perhaps you should take a look at SimSets (or just use an array) and store a SimSet full of cats (or an array) on the client or in the array delineated by BL_ID.
Code: [Select]
//Using the BLID array thing with SimSets
$kitties[3605] = new SimSet();
$kitties[3605].add(newCat());
//Using the BLID array thing with another array (in effect a multidimensional array)
$kitties[3605,0] = newCat();

My answer (Question 2): There's a thing called string concatenation. You can use @, SPC, TAB, or NL to join strings. You can concatenate anything (because torque is very flexible (more formally known as a not strictly typed language)
Code: [Select]
//Joining strings
%resultStr = "Results go here";
%resultStr = "this" @ "that"; //becomes thisthat
%resultStr = "this" SPC "that"; //becomes this that
%resultStr = "this" TAB "that"; //Hopefully obvious, joins them with a tab
%resultStr = "this" NL "that"; //Joins then with a new line

%that = 100;
%resultStr = "this" SPC %that; //Becomes this 100
%that ="test";
%resultStr = "this" SPC %that; //Becomes this test

My answer (Question 3): If you use the BLID array, there's a special function for doing this called export where you can export a bunch of global variables to a file and it makes it easy to save and load.
If you're using the simset, you'd have to develop a system to save using FileIO which might be a fun learning experience.
Swollow has a bit more down here v v

EDIT: Sorted so other people can help if necessary

105
Why wouldn't it be okay? Many people have bought keys for friends before.
There's this thing called trust - it's a free key after all, so that's good anyways.
I agree

Pages: 1 2 3 4 5 6 [7] 8 9 10 11 12 ... 48