Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Raelyn's Big Book of Scripting Questions. (https://forums.graalonline.com/forums/showthread.php?t=85091)

fowlplay4 05-03-2009 04:32 PM

visible doesn't work with images.

you could do something like..

PHP Code:

function onKeyPressed(codekeychar) {
  if (
key == "i") {
    if (
findImg(209).image != NULL) {
      
hideimg(209);
    }
  }



Raelyn 05-03-2009 04:34 PM

Quote:

Originally Posted by Raelyn (Post 1488664)
Is there a way in GS1 to do this?

PHP Code:

if (keypressed) {
   if (
strequals(#p(1),I)){
      
if (img 209 is visible){
         
hideimg 209;
      } else {
         
showimg 209,file,x,y;
      }
   }



Solved myself with

PHP Code:



this
.inv_shown 1;

if (
keypressed) {
   if (
strequals(#p(1),I)){
      
Inventory();
   }


function 
Inventory(){

  if (
this.inv_shown == 0){

    
// inventory pane
    
showimg 209;
    
this.inv_shown 1;

  } else {

    
hideimg 209;
    
this.inv_shown 0;
  }


I have another question though, I am trying to change profilevars in server options, and I have

PHP Code:

profilevars=Level:=#v(clientr.level), 

Yet it is not picking up the clientr.level off my NPC...?

Raelyn 05-03-2009 04:56 PM

Quote:

Originally Posted by fowlplay4 (Post 1488698)
visible doesn't work with images.

you could do something like..

PHP Code:

function onKeyPressed(codekeychar) {
  if (
key == "i") {
    if (
findImg(209).image != NULL) {
      
hideimg(209);
    }
  }



Mmm, ok thanks. I was just having someone test me script, and I have it calling replaceani in clientside, so his client is not downloading the ganis from the server. But if I put the replaceani in serverside, the RC reports an error that the server doesn't know that command... So, what command does it understand to get new ganis for the player?

cbk1994 05-03-2009 06:22 PM

Quote:

Originally Posted by Raelyn (Post 1488699)
Solved myself with

PHP Code:



this
.inv_shown 1;

if (
keypressed) {
   if (
strequals(#p(1),I)){
      
Inventory();
   }


function 
Inventory(){

  if (
this.inv_shown == 0){

    
// inventory pane
    
showimg 209;
    
this.inv_shown 1;

  } else {

    
hideimg 209;
    
this.inv_shown 0;
  }



Be sure to convert that to GS2...
Quote:

I have another question though, I am trying to change profilevars in server options, and I have

PHP Code:

profilevars=Level:=#v(clientr.level), 


You don't need #v, just (for example):
PHP Code:

profilevars=Level:=clientr.level,HP:=clientr.hp 

Quote:

Originally Posted by Raelyn (Post 1488705)
Mmm, ok thanks. I was just having someone test me script, and I have it calling replaceani in clientside, so his client is not downloading the ganis from the server. But if I put the replaceani in serverside, the RC reports an error that the server doesn't know that command... So, what command does it understand to get new ganis for the player?

What do you mean, like download them? Just displaying the animations will download them, but if you really want you can use update packages.

fowlplay4 05-03-2009 06:48 PM

Make sure you have the following the folder config.

PHP Code:

file  ganis/*.gani 

So people can download the ganis from the the levels/ganis folder.

Then in a clientside script you can just use

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
replaceani("idle""someotheridleani");
  
replaceani("walk""someotherwalkani");



Raelyn 05-03-2009 07:08 PM

Quote:

Originally Posted by cbk1994 (Post 1488726)
Be sure to convert that to GS2...

You don't need #v, just (for example):
PHP Code:

profilevars=Level:=clientr.level,HP:=clientr.hp 


What do you mean, like download them? Just displaying the animations will download them, but if you really want you can use update packages.

Ok, well, my script is clientside, so that means the server can't GET my clientr.level, right? I need to find some way for for the server to read my clientside variables..

If I join a class to a clientside script, does everything in that class become clientside as if it waste pasted into the class? I am trying to think of another way to split this script so I can maintain my clientside timeouts but have my variables accessible by the server...

Also, I have another problem that is whenever more than one person is on my server, (having the -Player weapon), ONE part of my interface is duplicated in the center of the screen... it's only the one part, and everything else works as intended.. :confused:

Raelyn 05-03-2009 07:17 PM

Quote:

Originally Posted by fowlplay4 (Post 1488728)
Make sure you have the following the folder config.

PHP Code:

file  ganis/*.gani 

So people can download the ganis from the the levels/ganis folder.

Then in a clientside script you can just use

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
replaceani("idle""someotheridleani");
  
replaceani("walk""someotherwalkani");



Thanks, that was the problem. :)

Deas_Voice 05-04-2009 02:48 PM

Quote:

Originally Posted by Raelyn (Post 1488731)
Ok, well, my script is clientside, so that means the server can't GET my clientr.level, right? I need to find some way for for the server to read my clientside variables..

Pass them to the server with
PHP Code:

//#CLIENTSIDE
function onEvent() {
triggerServer("gui","WeaponName","Equal",this.bar,temp.foo);


then on the serverside u could do something like this:
PHP Code:

function onActionServerSide(){
  if (
params[0] == "Equal") {
    
this.thing params[1];
    
this.var = params[2];
  }


then u can use this.bar and temp.foo at serverside. :)
but they will be named this.thing and this.var ofc ;)

Deas_Voice 05-04-2009 02:51 PM

Quote:

Originally Posted by fowlplay4 (Post 1488728)
Make sure you have the following the folder config.

PHP Code:

file  ganis/ *.gani 

So people can download the ganis from the the levels/ganis folder.

fixed, the forum didn't show it :)
(no space between the / and the *)

Raelyn 05-04-2009 05:09 PM

I am trying to do a script for something like:

PHP Code:

if (playerchats){
  if (
strequals(#c,/summon "otherplayeraccountname")){
    
otherplayeracctname newxnewy;
  }


What would I use to get the account name of the said player, and what would I use to set the x/y of ANOTHER player other than the player triggering?

fowlplay4 05-04-2009 05:21 PM

Here's a simple summon weapon script, however since you probably deal with community names you may have to modify the findplayer to findplayerbycommunityname, or whatever it is.

PHP Code:

function onActionServerSide() {
  
// Summons Player to You
  
if (params[0] == "summon") {
    
// Adjusts the Players Level, X, Y
    
findplayer(params[1]).setlevel2(player.levelplayer.xplayer.y);
    
// Adjusts Players Chat 
    
findplayer(params[1]).chat "Summoned by" SPC player.account;
  } 
}

//#CLIENTSIDE

function onPlayerChats() {
  if (
player.chat.starts("/summon")) {
    
// Gets acct from "/summon acct"
    
temp.toSummon player.chat.substring("/summon ".length());
    
// Sends Trigger to Server
    
triggerserver("gui"this.name"summon"toSummon);
  }




All times are GMT +2. The time now is 01:19 AM.

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