Graalians

Graalians (https://www.graalians.com/forums/index.php)
-   Creative Corner (https://www.graalians.com/forums/forumdisplay.php?f=17)
-   -   John's Scripts (https://www.graalians.com/forums/showthread.php?t=9528)

callimuc 08-20-2012 03:49 PM

Quote:

Posted by Johnaudi (Post 183217)
This would be easier? : (this.stoptime + 5 < timevar2) {}
Would it work? :p

Quote:

Posted by callimuc (Post 182356)
PHP Code:

if (this.lastused+timevar2) {
  echo(
player.nick " [" player.account "] : " this.toks);
  
player.chat "Echo'd: "@temp.toks;




Emera 08-20-2012 03:50 PM

Shush you.

Johnaudi 08-20-2012 03:51 PM

Alright, then I should use your way, @Emera yours is a bit... Um.. Complex.

Emera 08-20-2012 03:52 PM

Quote:

Posted by Johnaudi (Post 183222)
Alright, then I should use your way, @Emera yours is a bit... Um.. Complex.

Not really <3 Might seem a little 'in your face' since it's new to you, but if you want me to talk you through it I'll be more than happy to.

callimuc 08-20-2012 03:53 PM

Quote:

Posted by Johnaudi (Post 183222)
Alright, then I should use your way, @Emera yours is a bit... Um.. Complex.

its pretty much the same. he just likes to use the switch and case stuff... i dont like it that much :P and the clientr.flag storage is kinda useless imo in this case

Emera 08-20-2012 04:01 PM

Quote:

Posted by callimuc (Post 183225)
its pretty much the same. he just likes to use the switch and case stuff... i dont like it that much :P and the clientr.flag storage is kinda useless imo in this case

Log out -> Log in (spam)
Oh wait it's stored serverside...
shush callimuc k?

callimuc 08-20-2012 04:02 PM

Quote:

Posted by Emera (Post 183230)
Log out -> Log in (spam)
Oh wait it's stored serverside...
shush callimuc k?

k

BboyEatsbacon 08-20-2012 05:29 PM

Quote:

Posted by Johnaudi (Post 182303)
Hey,
Got bored a bit, and don't know what to add to the scripts I made a while back. so having you guys give me an opinion would help. Also, I'm still at a learning stage to any developer feel free to correct me/teach me anything new or give me idea's or other ways to do the certain thing.
Echo from NC (Made while learning triggerserver)
  • Current usage by saying "/echo TextGoesHere"
  • Can echo from the player's chat to RC
  • Anti-Spam built (yes, I know timevar2 but I have thought of a different way)
PHP Code:

function onActionServerSide() {
  if (
params[0] == "cmd") {
    
this.toks player.chat.substring(6);
    echo(
player.nick " [" player.account "] : " this.toks);
  }
}

//#CLIENTSIDE
function onCreated() {
  
this.num 1;
}

function 
onPlayerChats() {
  if (
player.chat.starts("/echo")) {
    if (
this.num == 1) {
      
this.toks player.chat.substring(6);
      
triggerserver("gui"name"cmd");
      
sleep(0.1);
      
this.num 0;
      
setTimer(0.01);
      
player.chat "Echo'ed : " player.chat.substring(6);
    } else 
player.chat "Please wait 5 seconds before sending another Echo!";
  }
}

function 
onTimeOut() {
  if (
this.num == 0) {
    
sleep(5);
    
this.num 1;
  }
  
setTimer(0.1);



  • Just declare a flag as you go, no need for it to be under onCreated() :)
  • When checking for a flag, you can just do if (flag == true)
  • Seeing as that you're only using a timer for one thing in the script, don't have your timer set to 0.1, but rather 5 and don't have it loop within onTimeOut.
  • Using format(string, var, var) is very nice when using multiple variables to output to a string.

Fixed Version:
Spoiler

PHP Code:

function onActionServerSide() {
  if (
params[0] == "cmd") {
    
this.toks player.chat.substring(6);
    echo(
format("%s [%s] : %s"player.nickplayer.accountthis.toks);
  }
}

//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat.starts("/echo")) {
    if (
this.num == false) {
      
this.toks player.chat.substring(6);
      
triggerserver("gui"name"cmd");
      
sleep(0.1);
      
this.num true;
      
setTimer(5);
      
player.chat "Echo'ed : " player.chat.substring(6);
    } else 
player.chat "Please wait 5 seconds before sending another Echo!";
  }
}

function 
onTimeOut() {
  if (
this.num == true)
    
this.num == false;




Hopefully I could teach some neat ways to expand your scripting in this post! :)

Johnaudi 08-22-2012 07:13 PM

okay got it, Ty BBoy, the %s helped a lot.
Can't script right now since guest access cleared from Delteria, but, anyone got ideas about Particles? Graal Bible doesn't explain much but I'd love to know the basic way they work.

Billy 08-24-2012 11:47 AM

I don't get scripting,all i see is a bunch of different colored letters and numbers with symbols and shiz and its like it magically makes things in games..can someone tell me about scripting? How do you even do it in game... Where do you do it on a program and then post here?

callimuc 08-24-2012 12:02 PM

Quote:

Posted by Billy (Post 185500)
I don't get scripting,all i see is a bunch of different colored letters and numbers with symbols and shiz and its like it magically makes things in games..can someone tell me about scripting? How do you even do it in game... Where do you do it on a program and then post here?

on graal when you are staff and got the rights on a server you have access to an "extra" section where you can put weapons on. there you write these magical letters and the RC/tests will tell you if you have succeed or if you failed

here you got a pretty good guide
http://public.zodiacdev.com/index.php?title=Fowlplay4

Kavan 08-24-2012 12:50 PM

Quote:

Posted by Billy (Post 185500)
I don't get scripting,all i see is a bunch of different colored letters and numbers with symbols and shiz and its like it magically makes things in games..can someone tell me about scripting? How do you even do it in game... Where do you do it on a program and then post here?

Well, if you actually look and read through some of the scripts, you'll realise that the coloured letters will form - believe it or not - words! If you read this script line by line, you can actually get a good idea of what it is doing:

PHP Code:

//#CLIENTSIDE

function onPlayerChats() {        // If the player says something
  
if(player.chat == ":)") {        // If the player chat is ':)'
    
player.chat ":(";              // Set the player's chat to ':('
    
setTimer(.05);                   // Set a countdown timer of 0.05 seconds
  
}
}

function 
onTimeout() {            // If the timer is "out"
  
temp.posx random(064);  // Create a temporary random # in 0-64
  
temp.posy random(064);  // Same as above
  
player.temp.posx;          // Set the player's x position to the rand #
  
player.temp.posy;          // Set the player's y position to the other #
  
setTimer(.05);                    // Create another countdown timer


So, really, it's not hard to see that it's not just coloured letters. It is comprehensible somewhat, but I can understand how it looks like hieroglyphs when you stick in things like & * / % +. Those are just arithmetic operators, and perform calculations. You just have to learn which is what (for example, + is add, * is multiply), and the same goes for the words used. There are many different words (I used the description 'word' for the sake of simplicity) that you can use to do different things, again you have to learn those.

I'm going to make a crude comparison and compare the brackets used to paragraphs, and these paragraphs can only be read if the word after the keyword 'function' is performed, (ie. onPlayerChats - if the player chats, onTimeout - if the timer runs out). Therefore the second 'paragraph' can only be read if the timer runs out in the script above.

The same way you have read it is the same way the game will interpret it ie. it will read it line by line like an essay and perform what the script is telling it to do.

Hopefully now, scripting doesn't seem as frightening as it did before, and maybe you'll give it a go, because it's quite fun.

You can script on Graal by first buying a gold subscription, and then you can get access to the Testbed Server Remote Control, which you can use to script with.

プリンセスさくら2 08-24-2012 05:45 PM

i hate you john

callimuc 08-24-2012 06:12 PM

Quote:

Posted by プリンセスさくら2 (Post 185705)
i hate you john

im sure he shares your feelings

fsh 08-24-2012 06:25 PM

Quote:

Posted by callimuc (Post 185717)
im sure WE share your feelings



All times are GMT. The time now is 08:38 AM.

Powered by vBulletin/Copyright ©2000 - 2025, vBulletin Solutions Inc.