Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-24-2005, 02:20 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
New scripting engine fixes

Today a new npcserver has been uploaded which fixes several things. Restart it to update it to the latest version:

- player.triggerclient(weaponscript [,params]) has been added, works like triggeraction(0,0,"clientside",params)
- object.trigger("action",params) is also accepting single parameters (was only accepting parameters before if there were at least 2 of them)
- when a script is run for a player (e.g. if you player.join("myclass")) then the current player is correctly set and functions like setlevel2 should work correctly
- npc.save[] can correctly be accessed on clientside
- if a variable is not an array (size()==0) then you can access the content of the variable also with "var[0]", which is the same like using "var" then; this is for compatibility with old Graal script.
- in compound statements like "if (var) { this.test = 1; drawunderplayer}" it is now accepting old style graal commands (e.g. drawunderplayer) without semicolon if it's used directly before the closing bracket }. This is for compatibility with old Graal script.
- arrays like npcs[] and players[] can now be assigned to normal variables (still using a link to the originial array so no speed problems), like
e = level.npcs;
echo("npc count: " @ e.size());
- assigning a sub array to the array variable is not crashing the npcserver anymore, so you can do stuff like this now:
this.arr = {{1,2},3,4};
this.arr = this.arr[0];
Reply With Quote
  #2  
Old 05-24-2005, 02:29 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by Stefan
- arrays like npcs[] and players[] can now be assigned to normal variables (still using a link to the originial array so no speed problems)
That sounds pretty interesting. If Graal can use aliases to variables then could we maybe have an option to pass function arguments by reference? Or to manually create links between variables?

Quote:
- assigning a sub array to the array variable is not crashing the npcserver anymore, so you can do stuff like this now:
this.arr = {{1,2},3,4};
this.arr = this.arr[0];
:D
__________________
Reply With Quote
  #3  
Old 05-24-2005, 07:48 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
npc.save[]
What does this do?
__________________
Reply With Quote
  #4  
Old 05-24-2005, 07:52 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally Posted by xAndrewx
npc.save[]
What does this do?
save[] variables are accessible on clientside and serverside, EX:

if (created || timeout) {
save[0]++;
timeout = 1;
}
//#CLIENTSIDE
if (created || timeout) {
setcharprop #c,#v(save[0]); // will increase
timeout = 1;
}
__________________

Reply With Quote
  #5  
Old 05-24-2005, 07:58 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
I mean what does it actually do? save npcs o_o?
and how would you use it in a script what would benefit the player/npc server?
__________________

Last edited by xAndrewx; 05-24-2005 at 08:21 AM..
Reply With Quote
  #6  
Old 05-24-2005, 08:21 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by Stefan
- player.triggerclient(weaponscript [,params]) has been added, works like triggeraction(0,0,"clientside",params)
Yay!
Reply With Quote
  #7  
Old 05-24-2005, 08:38 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally Posted by xAndrewx
I mean what does it actually do? save npcs o_o?
and how would you use it in a script what would benefit the player/npc server?
It's an array (hence the []s), not a function. It makes it easy to pass information between clientside and serverside without needing to deal with triggeractions. It doesn't save the npc, it just saves numbers. If there was some kind of setting done on clientside, you wouldn't want to use a triggeraction every time to find out what it is when you could simply reference a variable.
__________________

Reply With Quote
  #8  
Old 05-24-2005, 09:41 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
Oh,cool .
Thanks for clearing that up.
__________________
Reply With Quote
  #9  
Old 05-24-2005, 01:10 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by Kaimetsu
That sounds pretty interesting. If Graal can use aliases to variables then could we maybe have an option to pass function arguments by reference? Or to manually create links between variables?
Well you have the object.link() function which passes a link to the object, and doesn't necessary copy it. Gui objects, players and npcs are always passed as links. But it can also be good if you have huge arrays.
Reply With Quote
  #10  
Old 05-24-2005, 01:24 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
Some great stuff there, but:
Quote:
Originally Posted by Stefan
- player.triggerclient(weaponscript [,params]) has been added, works like triggeraction(0,0,"clientside",params)
Are we going to get triggerserver(weapon, parameters) too? Or is there any replacement for going through the player's weapons and using callweapon(..) I don't know of? I would trigger the weapon directly, but it isn't working.
EDIT: Ah, it's different, .trigger works with the current player, but if you trigger on another player, e.g. with findplayer(..) or players[i] it isn't working.


Quote:
Originally Posted by Stefan
- arrays like npcs[] and players[] can now be assigned to normal variables (still using a link to the originial array so no speed problems), like
e = level.npcs;
echo("npc count: " @ e.size());
level.npcs works, but level.players never works, even if you access it directly.
__________________
Graal Statistics

Top 3 servers at the moment (players):



Last edited by Fry; 05-24-2005 at 01:51 PM..
Reply With Quote
  #11  
Old 05-24-2005, 05:39 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by Stefan
Well you have the object.link() function which passes a link to the object, and doesn't necessary copy it
Oh, awesome. That's gonna be pretty useful.
__________________
Reply With Quote
  #12  
Old 05-24-2005, 07:29 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by Fry
but level.players never works, even if you access it directly.
Because it's not existing yet
Reply With Quote
  #13  
Old 05-24-2005, 07:44 PM
Fry Fry is offline
Registered User
Fry's Avatar
Join Date: Sep 2001
Location: Germany
Posts: 384
Fry has a spectacular aura about
Quote:
Originally Posted by Stefan
Because it's not existing yet
The "yet" sounds good, I hope for it to arrive soon, because the raw "players[i]" isn't working very reliable.
__________________
Graal Statistics

Top 3 servers at the moment (players):


Reply With Quote
  #14  
Old 05-25-2005, 12:32 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally Posted by Stefan
Well you have the object.link() function which passes a link to the object, and doesn't necessary copy it
Hm. What about things like obj.substring(...)? Is it necessary to use something like this?

NPC Code:
text = obj.substring(...);
myfunction (text.link());



Also, it's not really relevant to the thread, but is it possible that we could get clipboard access from within scripts? Mostly for scripted chat bars and suchlike.
__________________
Reply With Quote
  #15  
Old 05-25-2005, 01:11 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
It might be abused for that one (Some people copy and paste their passwords when it's new, and going on a server with that in clipboard may serve as a vulnerbility to the actual player).
__________________
In a world of change... Who'll you believe?
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 09:18 AM.


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