Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-08-2012, 07:04 AM
brokk brokk is offline
Registered User
Join Date: May 2012
Posts: 84
brokk is on a distinguished road
Item description

How do I make the Gui display the item description?

In the actual weapon I have this

PHP Code:
//#CLIENTSIDE
function onCreated() {
 
obj.description "This is a test.";
 } 
In the inventory I have this for the display text part

--This is done after item is clicked.
PHP Code:
      new GuiTextCtrl("Inventory_Item_Text") {
        
profile GuiBlueTextProfile;
        
text obj.description;
        
screenwidth/2-700+480;
        
screenheight/2-350+140;
        
layer 2;
      } 
I may be way off. But I'm still trying to learn
Reply With Quote
  #2  
Old 12-08-2012, 11:44 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Under onCreated put this.description = "whatever"; then in the inventory put findweapon("wepname").description;
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 12-08-2012, 02:26 PM
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
You need to set the text of Inventory_Item_Text to the weapon's description each time the player selects an item. In other words, when the player selects the item, do something like...

PHP Code:
Inventory_Item_Text.text weapon.description
where weapon is a weapon object (e.g. from findWeapon as above).

Additionally, the description needs to be a flag on the weapon object, so use this.description inside the weapon like Gunderak showed above.
__________________
Reply With Quote
  #4  
Old 12-22-2012, 03:48 PM
greggiles greggiles is offline
Registered User
greggiles's Avatar
Join Date: Sep 2007
Posts: 149
greggiles has a spectacular aura about
Instead of starting a new thread, I thought I'd post in this one. I am also doing a weapon description in a similar way. But I had another idea but I need some help to complete it.

In the Weapon, I have this:

PHP Code:
function onSetDescription() {
 
player.description "blah, blah, blah";
 } 
In my Inventory, I have this for Weapon clicked:
This is the script where I need the help

PHP Code:
function onItemPressed(obj,bla,bla,bla,clickcount) {
  if (
clickcount == 1) {
    if (
IsObject("Inventory_Main")) {
      new 
GuiBitmapCtrl("Inventory_Item_Icon") {
      
play("age_click");
      
//TRIGGER THE 'onSetDescription()' on the clicked weapon  
      //What code would I put to do this???
        
screenwidth/2-615+500;
        
screenheight/2-340+100;
        
width height 32;
        
bitmap obj.normalbitmap;
        
layer 2;
      } 
And of course this displays the text in the INV script:

PHP Code:
 showText(213screenwidth/2-50screenheight/2+50"showg""b""DESCRIPTION:" @(player.description));
   
with (findImg(212)) {
    
textshadow true;
    
shadowoffset "-2 2";
    
shadowcolors "0 0 0";
    
font "showg";
    
style "b";
    
layer 23;
    
zoom 1;

Reply With Quote
  #5  
Old 01-10-2013, 12:54 AM
BboyEatsbacon BboyEatsbacon is offline
The Bacon Man
BboyEatsbacon's Avatar
Join Date: Feb 2011
Location: United States
Posts: 60
BboyEatsbacon will become famous soon enough
Quote:
Originally Posted by greggiles View Post
PHP Code:
function onSetDescription() {
 
player.description "blah, blah, blah";
 } 
It would be better to do something like:
PHP Code:
function onSetDescription() {
    
player.client.description "hihihihihi";
    
showText(213screenwidth/2-50screenheight/2+50"showg""b""DESCRIPTION:" @(player.client.description)); 
 } 
I'd recommend updating the text right when you update the description with onSetDescription, then have the original launch read from the var, which is why it is still being set here.

Add that to your inventory script, you can't cross-reference other scripts whilst on clientside, as that is provoking serverside data.

You can use a trigger to the server then back to the client, but that's just a waste of time when you have a shorter, less complex way of completing your task that still is as efficient.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:24 PM.


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