Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Onwall-Check (https://forums.graalonline.com/forums/showthread.php?t=82870)

Pelikano 11-22-2008 09:26 PM

Onwall-Check
 
PHP Code:

//#CLIENTSIDE
function onWeaponFired() {
  
setTimer(0.05);
}
function 
onTimeOut() {
  for (
temp.04i++) { 
    if (!
keydown(i)) 
      continue;
    
temp.nOnwall true
    for (
temp.08n++) { 
      for (
temp.= -11+= 16) { 
        
temp.onwall onwall(player.1.5 vecx(player.dir) * 17 16 abs(vecy(player.dir)) * kplayer.vecy(player.dir) * 17 16 abs(vecx(player.dir)) * k);  
        if (
temp.onwall) { 
          
temp.nOnwall false
          break; 
        } 
      } 
       if (
temp.nOnwall) { 
        
player.+= vecx(player.dir) * 1/16
        
player.+= vecy(player.dir) * 1/16
      } 
    } 
  }  
  
setTimer(0.05);  


Hello.. some people told me that this script is not logical and that I have to do this and that. But no one has ever told me WHY it is not logical or WHAT my mistake is.
I dont want you to rescript this or anything like that.
Please tell me what wrong is :D Thanks.

Inverness 11-22-2008 09:51 PM

So why don't you tell us what you're trying to do.

Pelikano 11-22-2008 09:53 PM

I am trying to change the speed of the player and scripting my own onwall check? lol.

Inverness 11-22-2008 10:03 PM

Quote:

Originally Posted by Pelikano (Post 1444095)
I am trying to change the speed of the player and scripting my own onwall check? lol.

Well then explain the script so people don't have to spend time to figure out what you're doing.

Pelikano 11-22-2008 10:27 PM

If you really want to help me you'll first read the script once.
And if you read the script once and your IQ is over 40 you'll understand it.

Inverness 11-22-2008 10:36 PM

Quote:

Originally Posted by Pelikano (Post 1444108)
If you really want to help me you'll first read the script once.
And if you read the script once and your IQ is over 40 you'll understand it.

If you really want someone to help you then I suggest not being insulting.

And I don't "really" want to help you, however I don't mind helping if you explain some of the calculations.

Chompy 11-22-2008 11:03 PM

Why are you using abs() on some of your vectors?

Pelikano 11-23-2008 12:34 PM

Quote:

Originally Posted by Chompy (Post 1444119)
Why are you using abs() on some of your vectors?

Instead of (player.dir in |0,2| ? k : 0) I use abs(vecy(player.dir)*k, because then vecy gives out 0 or 1, if it gives out 1 the player.dir is either 0 or 2, it's exactly the same as "(player.dir in |0,2| ? k : 0)".

Chompy 11-23-2008 02:45 PM

Yeah, but using if (player.dir in |0,2| ? k : 0) would give you the variable k if you are facing down, left and up..

As |0,2| doesn't mean 0 or 2, it means 0, 2 and anything between.

And do you know what vectors are? And how they work? And could you tell me why you are using 17/16 in your onwall calculations?
Because.. 17 divided by 16 is 1.0625 and in the long go it will eventually jump over a few tiles to check..

Crow 11-23-2008 03:28 PM

Quote:

Originally Posted by Chompy (Post 1444271)
Yeah, but using if (player.dir in |0,2| ? k : 0) would give you the variable k if you are facing down, left and up..

As |0,2| doesn't mean 0 or 2, it means 0, 2 and anything between.

And do you know what vectors are? And how they work? And could you tell me why you are using 17/16 in your onwall calculations?
Because.. 17 divided by 16 is 1.0625 and in the long go it will eventually jump over a few tiles to check..

The |a, b| thing is a mistake I suppose. He's still quite new to coding. I explained him how vectors work, and using 17 / 16 will result in checking almost exactly one pixel out of the bounding box of the player.

Chompy 11-23-2008 03:30 PM

Quote:

Originally Posted by Crow (Post 1444284)
The |a, b| thing is a mistake I suppose. He's still quite new to coding. I explained him how vectors work, and using 17 / 16 will result in checking almost exactly one pixel out of the bounding box of the player.

Well, he were asking us at the Tesbed Server and wasn't very.. co-working.. or whatever the word is :p But yeah, I'm still wondering what he is trying to do exactly.. And I don't like how he responded in post #5.

Crow 11-23-2008 03:38 PM

Quote:

Originally Posted by Chompy (Post 1444285)
Well, he were asking us at the Tesbed Server and wasn't very.. co-working.. or whatever the word is :p But yeah, I'm still wondering what he is trying to do exactly.. And I don't like how he responded in post #5.

He can a jerk like that, yea. Guess the next thing I will tell him is how to post on the scripting forums ;)
He's trying to do either a custom movement or some addition to the default one (running or so). Cant remember.

Tigairius 11-23-2008 07:46 PM

Quote:

Originally Posted by Pelikano (Post 1444095)
I am trying to change the speed of the player and scripting my own onwall check? lol.

Quote:

Originally Posted by Pelikano (Post 1444108)
If you really want to help me you'll first read the script once.
And if you read the script once and your IQ is over 40 you'll understand it.

It's generally a good rule of thumb to respect the scripters who are better than you and willing to help you with your problems.

Inverness 11-23-2008 08:27 PM

Just for the record, my I.Q. is 130.

DrakilorP2P 11-24-2008 02:32 AM

Quote:

Originally Posted by Inverness (Post 1444348)
Just for the record, my I.Q. is 130.

You're so smart; I admire you.

WhiteDragon 11-24-2008 03:43 AM

It's over 9000!!!!!!!

Pelikano 11-24-2008 09:53 PM

Quote:

Originally Posted by Inverness (Post 1444348)
Just for the record, my I.Q. is 130.

Congratulations.


Okay I am making my own movement system.
I add 17/16 because 1/16 = pixel, so 17/16 = 1 pixel more than a tile.


All times are GMT +2. The time now is 12:08 PM.

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