Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-08-2007, 08:00 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Getting Information from Arrays in DB

Welllll, what I did was create a Database for all my weapons and items on the server.

Much more efficient than a MUD and much simpler. However, I've gotten stuck as far as showing the images for icons in our inventory. We're using regular showimg controls.

Could anyone help me with this issue?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #2  
Old 04-08-2007, 09:12 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
There is no way to read from DB-NPCs clientside.

To read (serverside) just use:
dbName.var
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 04-08-2007, 09:33 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
GS1 you would use with (getnpc(blah)), but with object oriented programming, the DB itself is an object, and thus, as napo stated, you can do dbName.var as an alternative, which is much more efficient and faster to use.


I think the GS2 version of with (getnpc(blah)) would be with (findnpc("blah")) or whatever, but you don't need a with for this.
Reply With Quote
  #4  
Old 04-08-2007, 09:36 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
I suggest using public functions
Inside of the database create a public function like so

PHP Code:
public function getItemData(itemID)
  return 
this.("item_"temp.itemID); 
You could call this like

PHP Code:
temp.itemInfo = ("my Database").getItemData(itemID); 
If you wanted, you could do this.
Inside of the database, add this

PHP Code:
function onCreated()
  
itemData this;
//Other code 
You could then call it like

PHP Code:
temp.itemInfo itemData.getItemData(itemID); 
Which ever you find easier to understand, if you are to use the bottom one, make sure you remember what you call these though. Keep a document or a weapon explaining what each one does, so you don't get lost or reuse the same name.
Reply With Quote
  #5  
Old 04-10-2007, 04:38 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Chandler View Post
PHP Code:
temp.itemInfo = ("my Database").getItemData(itemID); 
Assuming the database name is one word (which it really should probably be ...) you can just do myDatabase.getItemData( itemID );
__________________
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 03:50 PM.


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