Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-14-2006, 02:36 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
overloading function params?

I remember a while ago I was told that something such as the following would possess the same qualities as overloading functions (and I'm pretty sure it was from Stefan). However, now that I've found a place where I want to use it, I find that params aren't even loading into the function.
PHP Code:
function myFunction() {
  switch (
params.size()) {
  case 
1:
  case 
2:
  case 
3:
  default:
  }

Here is the script that I am working with.
PHP Code:
function dropitem() {
  
player.chat params.size();
  switch (
params.size()) {
  case 
1:
     
temp.dropitem params[0];
     break;
  case 
2:
    
temp.tpercents params[1];
    for (
i=0;i<temp.tpercents.size();i++)
      
tpercents[i] += tpercents[i-1];
    
temp.choice random(0,100);
    for (
i=0;i<temp.tpercents.size();i++) {
      if (
temp.choice <= temp.tpercents[i]) {
        
temp.dropitem params[0][i];
        break;
      }
    }
    break;
  }
  if (
temp.dropitem) {
    
putnpc2(x-1,y-1,"join dropitem_"@temp.dropitem@";");
  }

I would have revived the thread that this was said in, but I can't find it. Unfortunately, I guess I'll have to go about other methods. If I'm just screwing things up, please help me. If not, move this to the future improvements forum or something.
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 09:37 AM.


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