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 11-30-2005, 11:06 PM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
tiles[x,y] ?

I cant seem to get it to work.

HTML Code:
  //begin complex
  if (strequals(#v(tiles[playerx,playery]),127 + 15 * 16)) {
    setplayerprop #c, command;
  }
It's meant to set the player chat to "command" whenever you fire the weapon on a normal grass ground, and yes, it is a shovel. I cant think of any other way to do this, and my commands RTF doesnt have tiles[x,y] in it. Is there another one I can get which is upadted?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #2  
Old 12-01-2005, 12:25 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
"127 + 15 * 16" is being treated as a string, not being evaluated.

Try #v(127 + 15 * 16).
__________________
Skyld
Reply With Quote
  #3  
Old 12-01-2005, 02:16 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by Skyld
Try #v(127 + 15 * 16).
Or you can just do
tiles[playerx,playery] == 127 + 15 * 16
although, it's probably better to just use 367 instead of 127 + 15 * 16
__________________
Reply With Quote
  #4  
Old 12-01-2005, 05:50 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by ZeLpH_MyStiK
Or you can just do
tiles[playerx,playery] == 127 + 15 * 16
although, it's probably better to just use 367 instead of 127 + 15 * 16
Each of the numbers in that statement must have some significance, so it's probably better to leave it in a way you can understand it, rather than use one big magic number :x
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 12-01-2005, 06:59 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
Still doesnt work, i've tried it with the #v on both, refuses to work =/

EDIT:
odd, It works now, but the normal grass code is 2047 for some reason, is there any way to verify that?
__________________

I hope for nothing. I fear nothing. I am free.

Last edited by Raeiphon; 12-01-2005 at 07:09 AM..
Reply With Quote
  #6  
Old 12-01-2005, 08:14 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by ApothiX
Each of the numbers in that statement must have some significance, so it's probably better to leave it in a way you can understand it, rather than use one big magic number :x
ah, that's what comments are for okiesmoke =p
__________________
Reply With Quote
  #7  
Old 12-01-2005, 09:06 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Why don't you make the specific tiles in an array?
It'd be alot easier my friend. :0
Reply With Quote
  #8  
Old 12-01-2005, 12:49 PM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Quote:
Originally Posted by xAndrewx
Why don't you make the specific tiles in an array?
It'd be alot easier my friend. :0
Why would he need it in an array? He only has one tile to check for =\
__________________
Reply With Quote
  #9  
Old 12-01-2005, 03:16 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by ZeLpH_MyStiK
ah, that's what comments are for okiesmoke =p
comments?! Who need's 'em! :P

Real scripters script everything on one line and have no comments!1!!1
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #10  
Old 12-01-2005, 05:44 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by ZeLpH_MyStiK
Why would he need it in an array? He only has one tile to check for =\
I'm still saying using an array would be alot easier.
Reply With Quote
  #11  
Old 12-01-2005, 06:03 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by xAndrewx
I'm still saying using an array would be alot easier.
Explain this theory.
__________________
Skyld
Reply With Quote
  #12  
Old 12-01-2005, 06:25 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
It'd be alot easier, if you ever wanted to add more then just one tile. Future planning
Reply With Quote
  #13  
Old 12-01-2005, 06:46 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
But that doesn't make it any easier to do in the present?
__________________
Skyld
Reply With Quote
  #14  
Old 12-01-2005, 07:18 PM
Fox1545 Fox1545 is offline
Registered User
Join Date: Jul 2004
Posts: 78
Fox1545 is on a distinguished road
Quote:
Originally Posted by ZeLpH_MyStiK
although, it's probably better to just use 367 instead of 127 + 15 * 16
[...]
ah, that's what comments are for okiesmoke =p
It is not. Ideally you would use a constant like this.TILE_FOOBAR = 127 + 15 * 16;, or at least a function like getTileFromTileset(x, y) if the tile is not really namable. Putting magic numbers and then commenting them is not exactly elegant, and the foo + bar * 16 form at least adds a lot of editability.

Quote:
Originally Posted by Raeiphon
odd, It works now, but the normal grass code is 2047 for some reason, is there any way to verify that?
Mouseover it in the tile selection frame, and you are going to see the coordinates at the bottom of it. The `code' is x + 16 * y, I think.
Alternatively, write a script to output the `code' of the tile below your mouse cursor or something.

Quote:
Originally Posted by xAndrewx
It'd be alot easier, if you ever wanted to add more then just one tile. Future planning
Because it is totally cool to go against generally accepted programming practice for no reason at all.
Reply With Quote
  #15  
Old 12-01-2005, 07:36 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
O-o Haha, all this time I thought it was x + y * 16.

Anyway, I think the original poster is still trying to use #v() somewhere in the equation. You DO NOT need #v() ANYWHERE. The correct way to do it is (tiles[x,y] == number)

And I agree with Fox. Plus, an array with one value isn't an array..
However, I think you should be able to read a variable that's not an array with var[0].
PHP Code:
function onCreated() {
  
this.cookies 7;
  
chat this.cookies[0];

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 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.