Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Level Vars in the .nw file! (https://forums.graalonline.com/forums/showthread.php?t=74979)

zokemon 06-30-2007 02:31 AM

Level Vars in the .nw file!
 
It would be very nice to be able to set level variables in .nw files without having to use NPCs.

Like here could be an example .nw file (omitted all but one of the BOARD lines to make it shorter):

NPC Code:
GLEVNW01
BOARD 0 0 64 0 J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4 J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4 J4J4J4J4J4J4J4J4J4J4J4J4J4J4
VAR noplayerkilling 1
VAR myentermessage Hi guys!
VAR testarray 6,1,Testing,"Hello Everyone"

NPC - 0 0
function onCreated() echo(level.testarray[3]);
//#CLIENTSIDE
function onPlayerEnters() {
say2(level.myentermessage);
player.chat = level.testarray[2] @ ": " @ level.testarray[0] + level.testarray[1];
}
NPCEND



I put the details that are important in bold.

I'm sure a lot of you could figure out what that all does.

Here is another way you could do it:
NPC Code:
GLEVNW01
BOARD 0 0 64 0 J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4 J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4J4 J4J4J4J4J4J4J4J4J4J4J4J4J4J4
VARS
noplayerkilling=1
myentermessage=Hi guys!
testarray=6,1,Testing,"Hello Everyone"
VARSEND

NPC - 0 0
function onCreated() echo(level.testarray[3]);
//#CLIENTSIDE
function onPlayerEnters() {
say2(level.myentermessage);
player.chat = level.testarray[2] @ ": " @ level.testarray[0] + level.testarray[1];
}
NPCEND



I put the details that are important in bold.

Anyways: These would both set clientside and serverside variables when the level is updated (uploaded, server restart or "update level" is done). Of course, once they are set they are still independent (changing the clientside var won't effect the serverside with the exception of already shared vars).

I guess if you want you could maybe use:
VARCLIENT
VARSERVER
VARSCLIENT
VARSCLIENTEND
VARSSERVER
VARSSERVEREND

What do you all think?

EDIT: I dunno why it put spaces in the BOARD but just ignore that as it isn't important.

Chompy 06-30-2007 02:51 PM

That is an idea I would love to see in game..
Protected level variables :O

Crow 06-30-2007 04:10 PM

Meh want! Dang thats a nice idea! Though there should be something added in the editor so you can edit those easily :D

Inverness 06-30-2007 04:31 PM

I prefer the way with VARS and VARSEND its a more familiar format.

zokemon 07-01-2007 04:40 AM

Quote:

Originally Posted by Inverness (Post 1324193)
I prefer the way with VARS and VARSEND its a more familiar format.

They are both familier. One is like LEVELS and LEVELSEND while the other is like BOARD.

Either way one of them should be added (I really don't care which nor does it matter except maybe the VARS and VARSEND way would be easier to save using savevarstoarray(); for an online editor or so.)

Inverness 07-01-2007 06:50 AM

I was suggesting VARS and VARSEND because its more like when you're using text files for variable saving.

zokemon 07-01-2007 09:46 AM

Quote:

Originally Posted by Inverness (Post 1324528)
I was suggesting VARS and VARSEND because its more like when you're using text files for variable saving.

This is true (as I stated in my last post).

The main reason why I want this is because this would load the level. variables with the board data when the player enters a level thus avoiding the ever exploitable npc load lag glitch. And this would completely remove the need to have an NPC for such (also don't have to worry about your npc accidentally being deleted).

The only reason why I used a NPC in my example is because I really didn't want to have to give more then two code boxes...it would only add more confusion. I'm sure you all can understand what I mean by this now? Along with the use?

zokemon 07-06-2007 09:21 AM

Knock knock!


All times are GMT +2. The time now is 09:50 AM.

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