The 'QuakeC lessons' thread[prev. help with script teleport]
Moderator: Core Staff
Re: help with script teleport
no mate i've run teleport scripts before and i also adjusted them so setting new teleports but only by following instructions given by megazor. it was a .gsc file and i always create these like this: i open notepad++ and click on save as and then put ".gsc" as file extension... tell me if you know a better way to create these...
then i put it into the cb_custom.pk3 and with a few changes in the main .gsc file of the .pk3 launching the teleport script when loading the mod, i uploaded it to the ftp, restarted server and it worked...
then i put it into the cb_custom.pk3 and with a few changes in the main .gsc file of the .pk3 launching the teleport script when loading the mod, i uploaded it to the ftp, restarted server and it worked...
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: help with script teleport
In case you missed it above.Try this:
Make three seperate functions. The first function, fA(param) should return the square of the parameter <param>. The second one, fB(param) should return a boolean(true/false) on whether the parameter <param> is divisible by 3(use modulus - %). The third one, fC(param1, param2) returns a string is this format: "<param1>:-:<param2>".
This one sounds really fun now that I've made it up, give it a go.
Print all three using iprintln.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
Re: help with script teleport
given a string, need to convert it to lowercase one.
example: rYaN -> ryan
the making of that script will give you the knowledge of some new things such as size
example: rYaN -> ryan
the making of that script will give you the knowledge of some new things such as size
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: help with script teleport
I think that may be a small step ahead, without explaining functions and parameters this will be very confusing.Rezil wrote:In case you missed it above. [...]
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: help with script teleport
But it's all in your tutorial, so there is no excuse. If he needs further explanation than the one given in your tut, he can ask.
In the meantime:
[/size]
Solution here, quote my post/zoom in if you want to spoil it for yourself.
In the meantime:
Code: Select all
main()
{
integer = fA(25);
trueBool = fB(39);
falseBool = fB(5);
stg = fC(3, "A"); //interestingly enough, in quakeC you don't need to define the type of a variable
iprintln(integer+" "+trueBool+" "+falseBool+" "+stg);
}
fA(param)
{
return (param*param)
}
fB(param)
{
if(param%3==0) return true;
else return false;
}
fC(param1, param2)
{
return param1+":-:"+param2;
}
Solution here, quote my post/zoom in if you want to spoil it for yourself.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: help with script teleport
Its been a while, that could probably do with a revamp.Rezil wrote:But it's all in your tutorial
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: help with script teleport
megazor wrote:given a string, need to convert it to lowercase one.
example: rYaN -> ryan
the making of that script will give you the knowledge of some new things such as size
Code: Select all
randomFunction(string)
{
return tolower(string);
}
Re: help with script teleport
IzNoGod no offense meant m8 but can you please stop spoiling my exercises i'm sure mega is competent enough to have known this function for years he just wanted to give me a task to do... he created a fucking minecraft mod for cod1 so i'm sure he knows that this command is an actual built-in function...
KS i've given it a try:
KS i've given it a try:
Code: Select all
for(i=0;i<21;i++)
{
var = i * i;
if(var % 2 = 0);
{
iprintln(i+"x"+i+" equals "+(i*i). This is EVEN);
else
iprintln(i+"x"+i+" equals "+(i*i). This is ODD);
}
}
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: help with script teleport
There we go, actual progress. I hope you understand what modulus does now.
You're missing a closing bracket at the end of your if statement and the semi-colon at the end of it shouldn't be there(syntax error). And your if statement is wrong, as you're not comparing, but assigning a value(one '=' instead of two). Also, it would've been more economical to store the odd/even in a seperate string variable and then use only one iprintln, like this:
You're missing a closing bracket at the end of your if statement and the semi-colon at the end of it shouldn't be there(syntax error). And your if statement is wrong, as you're not comparing, but assigning a value(one '=' instead of two). Also, it would've been more economical to store the odd/even in a seperate string variable and then use only one iprintln, like this:
Code: Select all
for(i=0;i<21;i++)
{
    result = i*i;
    str = "";
    if(result%2==0) str = "EVEN";
/*single line if statements reach only until the end of the next statement(str = "EVEN"; in our case) */
    else str = "ODD";
   Â
    iprintln(i+"x"+i" equals "+result+" which is "+str);
}
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
Re: help with script teleport
we save bits.
two following parts of code behave the same
regarding a toLower function, yes, i knew it was a built-in function (not in cod1 though).
but why not develop brains? so now have a go writing that.
two following parts of code behave the same
if (lol == true) return true;
else return false;
-------if (lol) return 1;
return 0;
regarding a toLower function, yes, i knew it was a built-in function (not in cod1 though).
but why not develop brains? so now have a go writing that.
Re: help with script teleport
after trying for a few mins i gave up cos this is impossible to do... think before you post whether this is of suitable difficulty...Rezil wrote:Make three functions. The first function, fA(param) should return the square of the parameter <param>. The second one, fB(param) should return a boolean(true/false) on whether the parameter <param> is divisible by 3(use modulus - %). The third one, fC(param1, param2) returns a string is this format: "<param1>:-:<param2>".
This one sounds really fun now that I've made it up, give it a go.
Print all three using iprintln.
give me a few mins i've just finished KS thing then i failed at rezils now ill try mega's and ive got other things to do as well ...
... ok after failing at megazor's cos i've got no idea whatsoever since i've never seen any tutorial or instruction how to do this i would like to request considering your posts before you make them since i cba reading through all your highly complicated pseudocodes i dont understand ending up in a task ive never been taught how to make so please show some understanding...
Re: The 'QuakeC lessons' thread[prev. help with script telep
ok, size.
the size of a string variable is the amount of characters that make the string up.
for example, the size of the string "lol" is 3.
to get the string size, use
in the above code, rofl is a string
another example
that will print 14. yes, it counts spaces.
now about certain characters:
say we have some string, how do we get the first character of it?
simply:
remember that the string index always starts from 0, not from 1. so, to get the second characher of the same string, "y", you will want to use
well, the function toLower comes here:
the size of a string variable is the amount of characters that make the string up.
for example, the size of the string "lol" is 3.
to get the string size, use
Code: Select all
rofl.size
another example
Code: Select all
str = "megazor is pro";
iprintln(str.size);
now about certain characters:
say we have some string, how do we get the first character of it?
simply:
Code: Select all
str = "ryan";
iprintln(str[0]);
Code: Select all
iprintln(str[1])
Code: Select all
toLower()
{
string = "rYaN"; //a string to convert, changeable
big = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //string that contains all latinic letters - uppercase
correct = "abcdefghijklmnopqrstuvwxyz"; //the same as previous, but lowercase
correctString = ""; //empty string that will be being filled with correct characters
for (i = 0; i < string.size; i++) //for each characher in 'string' (which size is 4, can you see that?), do:
{
s = string[i]; //'s' is a new variable which gets the value of 'string[i]'. if 'i' equals 0, string[i] being "r", and when 'i' equals 1, string[i] being "Y", etc
for (a = 0; a < big.size; a++) //now check through 'big' if this character ('s') is inside it. if so, then it's uppercase.
if (s == big[a])
{
s = correct[a]; //change 's' to lowercase. so, if 's' being "Y", it will become "y". pay attention to the fact that the letters in 'big' and 'correct' are equal, the only difference is being lower/uppercase
break; //break 'big' loop, no need to check for that character any longer as it's been corrected.
}
correctString += s; //add the character (which might have been converted to lowercase) to the string
}
//all the characters have been checked out and converted if they were to.
iprintln(correctString);
}
Re: The 'QuakeC lessons' thread[prev. help with script telep
after reading through the scripting for dummies thread twice only for your task (not to tell you the other 50 thousand times i've read through it) and reading a whole array topic on a cprogramming site this is the only thing i can come up with and i'm 100 % sure its wrong:
Code: Select all
int callofduty1 = [21]
for(i = 1; i <=20; i++)
{
iprintln(callofduty1.size); //forwards here
}
for(i = 20; i >=1; i--)
{
iprintln(callofduty1.size); //backwards here
}
Re: The 'QuakeC lessons' thread[prev. help with script telep
and you were seriously expecting me to be able to do that with my shit noob knowledge? i started a few days ago and have done like 3 tasks successfully and you expect me to be able to do that?megazor wrote:...
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: The 'QuakeC lessons' thread[prev. help with script telep
The idea is there but wrong execution. The for loops are fine however.Ryan wrote:after reading through the scripting for dummies thread twice only for your task (not to tell you the other 50 thousand times i've read through it) and reading a whole array topic on a cprogramming site this is the only thing i can come up with and i'm 100 % sure its wrong:
Code: Select all
int callofduty1 = [21] for(i = 1; i <=20; i++) { iprintln(callofduty1.size); //forwards here } for(i = 20; i >=1; i--) { iprintln(callofduty1.size); //backwards here }
Firstly, with CoDScript you do not need to declare the size of an array or require the 'int'.
You can type simply "arrayName = [];"
That is your array created.
Firstly KS, said to store the numbers inside the array.
To store number in an array we use the following syntax:
arrayName[arrayname.size] = <value>;
to explain what is going on:
Firstly "arrayName" is simply the name we called our array. like a variable, call it what you want.
Secondly, we use the value of "size".
Arrays are an index. Indexes start at ZERO.
So, the current SIZE of the array is ZERO.
arrayName[arrayName.size]
is the same as
arrayName[0]
When we add a value to the array, the array size now becomes 1.
So arrayName[arrayName.size] now equals arrayName[1], etc.
So, we can create an array and populate it using a loop.
Code: Select all
/* Create your array outside the loop */
arrayName = [];
Â
for(i=0;i<21;i++)
{
  arrayName[arrayName.size] = i;
}
From here, you were asked to print them out.
Your loops were correct, but your prints were slightly wrong.
Instead of printing the size, you print the value.
iprintln(arrayName);
So, your final code will look like:
Code: Select all
/* Create an array */
callofduty1 = [];
Â
/* Populate your array with values */
for(i=1;i<=20;i++)
{
  callofduty1[callofduty1.size] = i;
}
Â
/* Print the values from 1 to 20 */
for(i = 1; i <=20; i++)
{
  iprintln(callofduty1[i]); //forwards here
}
Â
/* Print the values from 20 to 1 */
for(i = 20; i >=1; i--)
{
  iprintln(callofduty1[i]); //backwards here
}
When you read your code out loud and make understanding of it, your are essentially thinking Pseudocode.
Also, ignore Megazors exercise, the difficulty level of it was not even amateur let alone beginner...
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 2 guests