Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 01-24-2010, 07:27 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
This is because classes don't join immediately when you log on, but the script continues. This is highly annoying, as scripts that rely on a class will break on initiation.

You might be able to do something like this:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.join("gui_design");
  while (!
isinclass("gui_design")) sleep(0.05);
  
this.on false;
  
createGUI();
  
toggle(this.on);
}

function 
onWeaponFired() {
  
this.on = !this.on;
  
player.chat = (this.on) ? "On":"Off";
  
toggle(this.on);

I was going to suggest somehow using waitfor() to make the script wait until the class is successfully joined, but I'm not entirely sure how waitfor() is used, and if it can capture when a class joins a script.

I'm not even sure if what I suggested will work, because the class may never join if it is waiting for the next 'frame'. In that case this MIGHT work:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  while (!
isinclass("gui_design")) {
    
this.join("gui_design");
    
sleep(0.05);
  }
  
this.on false;
  
createGUI();
  
toggle(this.on);
}

function 
onWeaponFired() {
  
this.on = !this.on;
  
player.chat = (this.on) ? "On":"Off";
  
toggle(this.on);

Might need to wait for someone more experience dealing with catching/waiting for functions to deal with this, however.

Last edited by DustyPorViva; 01-24-2010 at 07:50 PM..
Reply With Quote
 


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 04:37 PM.


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