Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-14-2007, 04:12 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
shorter way?

is there a shorter way to do this?

PHP Code:
  if ( player.dir == 0) {
    if ( 
tiletypeintthis.x), int(this.y-1)) != 22)
      goto( 
int(this.x), int(this.y-1));
  }
  
  else if ( 
player.dir == 1) {
    if ( 
tiletypeint(this.x-1), int(this.y)) != 22)
      goto( 
int(this.x-1), int(this.y));
  }
  
  else if ( 
player.dir == 2) {
    if ( 
tiletypeint(this.x), int(this.y+1)) != 22)
      goto( 
int(this.x), int(this.y+1));
  }
  
  else if ( 
player.dir == 3) {
    if ( 
tiletypeint(this.x+1), int(this.y)) != 22)
      goto( 
int(this.x+1), int(this.y));
  } 
__________________
Deep into the Darkness peering...
Reply With Quote
  #2  
Old 08-14-2007, 04:19 AM
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
Yes, with vecx/y

PHP Code:
for (i=0;i<4;i++) {
  if (
player.dir==&& tiletype(int(this.x+vecx(player.dir)), int(this.y+vecx(player.dir))) != 22) {
     goto(
int(this.x+vecx(player.dir)), int(this.y+vecx(player.dir)))
  }

Reply With Quote
  #3  
Old 08-14-2007, 04:35 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Your amazing

EDIT : Works great except it moves in diagonals XD fix?
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 08-14-2007, 04:31 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
PHP Code:
for(temp.04++) {
  if (
player.dir == i) {
    
temp.tx int(this.+ (i==1?-1:(i==3?1:0));
    
temp.ty int(this.+ (i==0?-1:(i==2?1:0));
    if (
tiletype(txty) != 22) {
      goto(
txty);
    }
  }

PHP Code:
temp.= {
  { 
0,-1},
  {-
10},
  { 
01},
  { 
10}
};
temp.player.dir;
if (
tiletype(int(this.a[b][0], this.a[b][1])) != 22) {
  goto(
int(this.a[b][0], this.a[b][1]);

dunno if they work (no vecx/y used ;o)
__________________
Reply With Quote
  #5  
Old 08-14-2007, 05:25 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
PHP Code:
for (i=0;i<4;i++) {
  if (
player.dir==&& tiletype(int(this.x+vecy(player.dir)), int(this.y+vecx(player.dir))) != 22) {
     goto(
int(this.x+vecy(player.dir)), int(this.y+vecx(player.dir)))
  }

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 08-14-2007, 07:18 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
lol
everyone has their own way.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #7  
Old 08-14-2007, 08:27 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
PHP Code:
for (i=0;i<4;i++) {
  if (
player.dir == && tiletype(int(this.x+vecy(i)), int(this.y+vecx(i)) != 22)
     goto(
int(this.x+vecy(i)), int(this.y+vecx(i)));

wee..?
__________________
Reply With Quote
  #8  
Old 08-15-2007, 01:06 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I fail to see the need for a loop here...
PHP Code:
if (tiletype(int(this.vecx(player.dir)), int(this.vecy(player.dir))) != 22)
  goto(
int(this.vecx(player.dir)), int(this.vecy(player.dir)); 
__________________
Do it with a DON!
Reply With Quote
  #9  
Old 08-15-2007, 01:37 AM
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
Zero comes and saves the cpu/lag time again!
__________________
Reply With Quote
  #10  
Old 08-15-2007, 02:10 AM
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 zokemon View Post
I fail to see the need for a loop here...
PHP Code:
if (tiletype(int(this.vecx(player.dir)), int(this.vecy(player.dir))) != 22)
  goto(
int(this.vecx(player.dir)), int(this.vecy(player.dir)); 
Hmm, very good point! I completely missed that.
Reply With Quote
  #11  
Old 08-15-2007, 08:28 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
__________________
Do it with a DON!
Reply With Quote
Reply


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 10:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.