Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Graal V4 Main Forum (https://forums.graalonline.com/forums/forumdisplay.php?f=143)
-   -   GMAP Variables (https://forums.graalonline.com/forums/showthread.php?t=64964)

Warcaptain 03-26-2006 08:20 AM

GMAP Variables
 
Would it be possible to allow to make gmap variables?

It is currently possible to create level.variables (Correct?) But what about variables global to the gmap?

Would be nice for Mana Realms since each gmap is a new area and I could have an npc somewhere that sets variables like:
NPC Code:

function onCreated(){
gmap.areaname="Main Town";
gmap.areadescription="This is the main town";
}



This would purely be for convenience.. but would be better (in my opinion) than having to create a database (either on file browse or as DBNpc) to manage this information.

Also, now as I am typing I am pretty sure I tested level.vars out (also local.vars) and they didn't work properly. Are there no longer local to the level variables? Would be good for a day/night system to have something like:
NPC Code:

level.disabledaynight=false;


Could be done with strings (ie: client.disabledaynight=true) but would sometimes cause bugs if player warps out somehow. (ie: using warpto or some type of warping spell) This would also have to cause me to put an npc in all levels connected to the level disabling day/night in order to enable it again.

Just a suggestion, any feedback is welcome (as long as its positive)

Projectshifter 03-28-2006 09:33 AM

I get what you're saying, but it seems like it isn't really vital. There is always the option of grabbing the data on the serverside, or if you're really wanting to handle it all on the client you could have it create client.level.<levelname>.vars during onActionPlayerOnline(). Either way, checking onplayerenters for what to do in that level has been what I've always done in the past. I'm not sure about level.vars anymore, but it's easier to administrate such things via a database NPC anyway.

Warcaptain 03-28-2006 10:03 AM

I wouldnt at all say its easier.
It would be much easier to have a single npc that says gmap.var="varvalue";
than to have to set a string on every player. Its cluttered and unorganized.

Projectshifter 03-28-2006 11:34 AM

Quote:

Originally Posted by Warcaptain
I wouldnt at all say its easier.
It would be much easier to have a single npc that says gmap.var="varvalue";
than to have to set a string on every player. Its cluttered and unorganized.

I don't think it would be cluttered or unorganized by any means. Setting a string for every level on each player isn't preferable but it really isn't that bad of a concept. In the string list it would be organized still because they'd all be clientr.level.<lvlname>.var so they'd in a list. My main issue with level and/or gmap vars is that there really isn't a centralized place to read and/or set them, at least with a database NPC you are able to view and edit all of the strings easily.

Admins 03-30-2006 02:09 AM

Gmap-wide variables:
On serverside you cannot access the map parts anyway, so level.vars are always gmap-wide.
On clientside the next version will have a new variable 'object.gmap' for accessing the whole map. The 'level.' var is directing to the map part for compatibility reasons.

Synchronization of serverside and clientside: it might be possible to add level.clientr.vars and level.client.vars, sending level attributes from server to client is needed anyway for the new tile layers thingy

Warcaptain 03-30-2006 02:15 AM

So setting a level.variable serverside will set a variable LOCAL to the gmap?

Can this variable be read clientside is all I really need.

ie: a npc anywhere on a gmap that does:
NPC Code:

function onCreated(){
level.areaname="Towny Town";
}



And then can I access it in a CLIENTSIDE script (like a weapon) using:
NPC Code:

function onCreated(){
showtext(200,screenwidth/2,screenheight/2,"System","c",level.areaname);
changeimgvis(200,4);
}



Because this is the most important thing about it.. that it can be read clientside. If level variables work like I imagine they do, I'm sure they can.. because its just like reading a server.variable clientside.. (which I didn't think you could, but I am told you can) only its for the level only.

If not, you will have to explain to me how I can do this.

Admins 03-30-2006 09:22 PM

Would be level.clientr.areaname

ApothiX 03-30-2006 10:22 PM

Hmm, would level. variables still work the way they already are? I have been using them without problems for awhile, wouldn't be very nice if they were suddenly changed and things I made were broken.

Warcaptain 03-30-2006 10:26 PM

You are able to use them simply as level.varname??

Because I have tried that and unfortunately it has not worked.

I tried it with my time system (to disable day/night locally in levels) and it doesnt work.

ApothiX 03-30-2006 10:27 PM

Quote:

Originally Posted by Warcaptain
You are able to use them simply as level.varname??

Because I have tried that and unfortunately it has not worked.

I tried it with my time system (to disable day/night locally in levels) and it doesnt work.

It works serverside

Warcaptain 03-30-2006 10:27 PM

ah... the variable needs to be set serverside or has to read serverside (or both, of course)

ApothiX 03-30-2006 10:35 PM

Quote:

Originally Posted by Warcaptain
ah... the variable needs to be set serverside or has to read serverside (or both, of course)

You have to read it in the scope that you set it. ie: if it's set serverside, it has to be read serverside. If it's set clientside, it has to be read clientside. (I just checked this, wasn't sure if the clientside worked or not, never had a need to use it clientside)


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

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