Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-10-2008, 09:04 PM
Clockwork Clockwork is offline
ᶘ ᵒᴥᵒᶅ...ᶘ ಠᴥಠᶅ❤...ℳℴℯ
Clockwork's Avatar
Join Date: Feb 2007
Location: Pennsylvania
Posts: 2,071
Clockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant future
Send a message via Skype™ to Clockwork
New Emotions

Script that will replace the old emotions with new ones! :O
Made awhile ago, but decided to release it... (I don't like the old ones x.x; )

But yea, credits to Dusty, chompy and myself. o_O..


Graal Script Code:
//#CLIENTSIDE

function onCreated() {
  
enablefeatures(allfeatures-0x1000);
  
this.emote_timer 0;
  
setTimer(0.05);
}

function 
GraalControl.onKeyDown(keymodcharkeynumber) {
  if (
keymod == 577){ this.emote "aeko-crtl_a.gif";} else
  if (
keymod == 578){ this.emote "aeko-crtl_b.gif";} else
  if (
keymod == 579){ this.emote "aeko-crtl_c.png";} else
  if (
keymod == 580){ this.emote "aeko-crtl_d.png";} else
  if (
keymod == 581){ this.emote "aeko-crtl_e.gif";} else
  if (
keymod == 582){ this.emote "aeko-crtl_f.png";} else
  if (
keymod == 583){ this.emote "aeko-crtl_g.png";} else
  if (
keymod == 584){ this.emote "aeko-crtl_h.png";} else
  if (
keymod == 585){ this.emote "aeko-crtl_i.gif";} else
  if (
keymod == 586){ this.emote "aeko-crtl_j.gif";} else
  if (
keymod == 587){ this.emote "aeko-crtl_k.png";} else
  if (
keymod == 588){ this.emote "aeko-crtl_l.gif";} else
  if (
keymod == 589){ this.emote "aeko-crtl_m.png";} else
  if (
keymod == 590){ this.emote "aeko-crtl_n.gif";} else
  if (
keymod == 591){ this.emote "aeko-crtl_o.png";} else
  if (
keymod == 592){ this.emote "aeko-crtl_p.png";} else
  if (
keymod == 593){ this.emote "aeko-crtl_q.png";} else
  if (
keymod == 594){ this.emote "aeko-crtl_r.gif";} else
  if (
keymod == 595){ this.emote "aeko-crtl_s.png";} else
  if (
keymod == 596){ this.emote "aeko-crtl_t.png";} else
  if (
keymod == 597){ this.emote "aeko-crtl_u.png";} else
  if (
keymod == 598){ this.emote "aeko-crtl_v.png";} else
  if (
keymod == 599){ this.emote "aeko-crtl_w.png";} else
  if (
keymod == 600){ this.emote "aeko-crtl_x.png";} else
  if (
keymod == 601){ this.emote "aeko-crtl_y.png";} else
  if (
keymod == 602){ this.emote "aeko-crtl_z.gif";} else
  {
this.emote "None";}
  
  if (
this.emote != "None") {
    
this.emote_timer 6;
    
showimg(1this.emoteplayer.1.5player.1.5);
    
changeimgMode(11);
    
changeimgVis(13);
    
changeimgColors(1111.65); 
  }  
}
function 
onTimeout() {
  if (!
this.emote.ends("gif")) {
    if (
this.emote_timer >= 0.1) {
      
this.emote_timer -= 0.05;
    }else if (
this.emote_timer 0.1) {
      
hideimg(1);
    }
  }
  
with(findimg(1)) {
    if (
!= player.1.5 || != player.1.5) {
      
hideimg(1);
    }
  }
  
setTimer(0.05);

I think that's it...
Attached the images in a .zip
Attached Files
File Type: zip Emotions.zip (61.3 KB, 220 views)
__________________
Reply With Quote
  #2  
Old 10-10-2008, 09:12 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Hmm, I just realized that the Timeout event could of been different, so it don't have to run the loop all the time, but instead only do it when you actually do an emote..

Graal Script Code:
//#CLIENTSIDE
function onCreated() {
  
enablefeatures(allfeatures-0x1000);
  
this.emote_timer 0;
}

function 
GraalControl.onKeyDown(keymodcharkeynumber) {
  if (
keymod == 577){ this.emote "aeko-crtl_a.gif";} else
  if (
keymod == 578){ this.emote "aeko-crtl_b.gif";} else
  if (
keymod == 579){ this.emote "aeko-crtl_c.png";} else
  if (
keymod == 580){ this.emote "aeko-crtl_d.png";} else
  if (
keymod == 581){ this.emote "aeko-crtl_e.gif";} else
  if (
keymod == 582){ this.emote "aeko-crtl_f.png";} else
  if (
keymod == 583){ this.emote "aeko-crtl_g.png";} else
  if (
keymod == 584){ this.emote "aeko-crtl_h.png";} else
  if (
keymod == 585){ this.emote "aeko-crtl_i.gif";} else
  if (
keymod == 586){ this.emote "aeko-crtl_j.gif";} else
  if (
keymod == 587){ this.emote "aeko-crtl_k.png";} else
  if (
keymod == 588){ this.emote "aeko-crtl_l.gif";} else
  if (
keymod == 589){ this.emote "aeko-crtl_m.png";} else
  if (
keymod == 590){ this.emote "aeko-crtl_n.gif";} else
  if (
keymod == 591){ this.emote "aeko-crtl_o.png";} else
  if (
keymod == 592){ this.emote "aeko-crtl_p.png";} else
  if (
keymod == 593){ this.emote "aeko-crtl_q.png";} else
  if (
keymod == 594){ this.emote "aeko-crtl_r.gif";} else
  if (
keymod == 595){ this.emote "aeko-crtl_s.png";} else
  if (
keymod == 596){ this.emote "aeko-crtl_t.png";} else
  if (
keymod == 597){ this.emote "aeko-crtl_u.png";} else
  if (
keymod == 598){ this.emote "aeko-crtl_v.png";} else
  if (
keymod == 599){ this.emote "aeko-crtl_w.png";} else
  if (
keymod == 600){ this.emote "aeko-crtl_x.png";} else
  if (
keymod == 601){ this.emote "aeko-crtl_y.png";} else
  if (
keymod == 602){ this.emote "aeko-crtl_z.gif";} else
  {
this.emote "None";}
  
  if (
this.emote != "None") {
    
this.emote_timer 6;
    
showimg(1this.emoteplayer.1.5player.1.5);
    
changeimgMode(11);
    
changeimgVis(13);
    
changeimgColors(1111.65);
    
setTimer(0.05);
  }  
}
function 
onTimeout() {
  if (!
this.emote.ends("gif")) {
    if (
this.emote_timer 0) {
      
this.emote_timer -= 0.05;
    }
    if (
this.emote_timer <= 0) {
      
hideimg(1);
    }
  }
  
with(findimg(1)) {
    if (
!= player.1.5 || != player.1.5) {
      
hideimg(1);
      
this.emote_timer 0;
    }
  }
  if (
this.emote_timer 0)
    
setTimer(0.05);

But, nice release Aeko
Have to spread some reputation before I can give to you :o
__________________
Reply With Quote
  #3  
Old 10-10-2008, 09:16 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
lol, I get credits for the enablefeatures line?

Anyways, got rid of the nesting and replaced it with an array:
Graal Script Code:
//#CLIENTSIDE
function onCreated() {
  
this.keymaps = {
    
577,"aeko-crtl_a.gif",
    
578,"aeko-crtl_b.gif",
    
579,"aeko-crtl_c.png",
    
580,"aeko-crtl_d.png",
    
581,"aeko-crtl_e.gif",
    
582,"aeko-crtl_f.png",
    
583,"aeko-crtl_g.png",
    
584,"aeko-crtl_h.png",
    
585,"aeko-crtl_i.gif",
    
586,"aeko-crtl_j.gif",
    
587,"aeko-crtl_k.png",
    
588,"aeko-crtl_l.gif",
    
589,"aeko-crtl_m.png",
    
590,"aeko-crtl_n.gif",
    
591,"aeko-crtl_o.png",
    
592,"aeko-crtl_p.png",
    
593,"aeko-crtl_q.png",
    
594,"aeko-crtl_r.gif",
    
595,"aeko-crtl_s.png",
    
596,"aeko-crtl_t.png",
    
597,"aeko-crtl_u.png",
    
598,"aeko-crtl_v.png",
    
599,"aeko-crtl_w.png",
    
600,"aeko-crtl_x.png",
    
601,"aeko-crtl_y.png",
    
602,"aeko-crtl_z.gif",
  };

  
enablefeatures(allfeatures-0x1000);
  
this.emote_timer 0;
  
setTimer(0.05);
}

function 
GraalControl.onKeyDown(keymodcharkeynumber) {
  
Customize();
  if (
keymod in this.keymapsthis.emote this.keymaps[this.keymaps.index(keymod)+1];
  else 
this.emote "None";
  
  if (
this.emote != "None") {
    
this.emote_timer 6;
    
showimg(1this.emoteplayer.1.5player.1.5);
    
changeimgMode(11);
    
changeimgVis(13);
    
changeimgColors(1111.65); 
  }  
}
function 
onTimeout() {
  if (!
this.emote.ends("gif")) {
    if (
this.emote_timer >= 0.1) {
      
this.emote_timer -= 0.05;
    }else if (
this.emote_timer 0.1) {
      
hideimg(1);
    }
  }
  
with(findimg(1)) {
    if (
!= player.1.5 || != player.1.5) {
      
hideimg(1);
    }
  }
  
setTimer(0.05);

I could have done it with subarrays, which would have looked a lot more organized and sensible, but that would have involved loop checks and all since you can't use .index for checking subarrays. This reminds me of GS1's make-shift subarrays :P

Last edited by DustyPorViva; 10-10-2008 at 09:49 PM..
Reply With Quote
  #4  
Old 10-10-2008, 10:01 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004 Send a message via Skype™ to Tolnaftate2004
Graal Script Code:
  temp.keymaps = {
    
"aeko-crtl_a.gif",
    
"aeko-crtl_b.gif",
    
"aeko-crtl_c.png",
    
etc.
  }; 
Then the index you want is keymod-577, 576<keymod<603. Then there's no searching and no cacading else-ifs.
On top of that, you don't need the "aeko-crtl_" in every line, just put it in the showimg.


And since when did the r come before the t in control (ctrl)?
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #5  
Old 10-10-2008, 10:04 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I'm really not following where you're getting at, heh.
Reply With Quote
  #6  
Old 10-10-2008, 10:05 PM
Clockwork Clockwork is offline
ᶘ ᵒᴥᵒᶅ...ᶘ ಠᴥಠᶅ❤...ℳℴℯ
Clockwork's Avatar
Join Date: Feb 2007
Location: Pennsylvania
Posts: 2,071
Clockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant future
Send a message via Skype™ to Clockwork
Quote:
Originally Posted by Tolnaftate2004 View Post
And since when did the r come before the t in control (ctrl)?
awe, yea... I always say "circle" instead of control..so...>>;
__________________
Reply With Quote
  #7  
Old 10-10-2008, 10:19 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004 Send a message via Skype™ to Tolnaftate2004
Quote:
Originally Posted by DustyPorViva View Post
I'm really not following where you're getting at, heh.
Graal Script Code:
this.emote = (keymod in |577,602|)?this.keymap[keymod-577]:"None"
1 evaluation, order unity runtime.
vs.
Graal Script Code:
if (keymod in this.keymapsthis.emote this.keymaps[this.keymaps.index(keymod)+1];
else 
this.emote "None"
1 evaluation, linear runtime. This would take on average more than 13.5 evaluations. (compare below).
vs. (on average 13.5) if/elseif/else statements:
1-27 evaluations, each of order unity runtime.

Quote:
Originally Posted by Clockwork View Post
awe, yea... I always say "circle" instead of control..so...>>;
There's no t in circle, silly.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #8  
Old 10-10-2008, 10:22 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Tolnaftate2004 View Post
Graal Script Code:
this.emote = (keymod in |577,602|)?this.keymap[keymod-577]:"None"
1 evaluation, order unity runtime.
I thought of that, but I wanted to leave the possibility open for emotes that may not fit in the order already there.

Last edited by Tolnaftate2004; 10-10-2008 at 10:25 PM.. Reason: edit != quote
Reply With Quote
  #9  
Old 10-10-2008, 10:25 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004 Send a message via Skype™ to Tolnaftate2004
Quote:
Originally Posted by DustyPorViva View Post
I thought of that, but I wanted to leave the possibility open for emotes that may not fit in the order already there.
You can also have another array that maps keymod -> keymap index (in other words this.keymap[this.keyfunc[keymod]]). Allows for such things and it still doesn't need to search.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #10  
Old 10-10-2008, 11:52 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
That's some ****ed up stying in the first script
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #11  
Old 10-11-2008, 12:08 AM
DarkReaper0 DarkReaper0 is offline
No.
DarkReaper0's Avatar
Join Date: May 2005
Location: Texas,USA
Posts: 344
DarkReaper0 will become famous soon enough
Send a message via MSN to DarkReaper0
I have nothing to really say about the script (There's hundreds of ways to do it).

But I absolutely love the emoticons you provided.
Reply With Quote
  #12  
Old 10-11-2008, 01:44 AM
Clockwork Clockwork is offline
ᶘ ᵒᴥᵒᶅ...ᶘ ಠᴥಠᶅ❤...ℳℴℯ
Clockwork's Avatar
Join Date: Feb 2007
Location: Pennsylvania
Posts: 2,071
Clockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant future
Send a message via Skype™ to Clockwork
lol, thanks I guess ;
__________________
Reply With Quote
  #13  
Old 02-26-2009, 06:07 AM
xfazex xfazex is offline
Registered User
Join Date: Feb 2009
Location: Eastern Shore, Maryland USA
Posts: 81
xfazex is an unknown quantity at this point
Send a message via AIM to xfazex Send a message via MSN to xfazex Send a message via Yahoo to xfazex Send a message via Skype™ to xfazex
This doesn't work for me for some reason, put the images in the emotions folder, and put the NPC script in the level, and nothing. (Using Graal Editor)
Reply With Quote
  #14  
Old 02-26-2009, 06:13 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
This is GS2, all of the scripts in the code gallery are GS2. They won't work offline, you'll need a server.
Reply With Quote
  #15  
Old 02-26-2009, 08:08 PM
xfazex xfazex is offline
Registered User
Join Date: Feb 2009
Location: Eastern Shore, Maryland USA
Posts: 81
xfazex is an unknown quantity at this point
Send a message via AIM to xfazex Send a message via MSN to xfazex Send a message via Yahoo to xfazex Send a message via Skype™ to xfazex
Yeah I have one, I figured that out. lol
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.