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 05-30-2008, 06:37 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
What's the difference between these two?

PHP Code:
temp.var1 = array[b];
temp.var2 = list[b];
temp.var3 blol[b];
temp.var4 blob[b];
        
array[
b] = array[b+1];
list[
b] = list[b+1];
blol[b] = array[b+1];
blob[b] = list[b+1];
        
array[
b+1] = temp.var1;
list[
b+1] = temp.var2;
blol[b+1] = temp.var3;
blob[b+1] = temp.var4
PHP Code:
for(05c++;)
{
  
makevar("temp.var" 1) = params[b];
  
temp.pm params[c];
  
temp.pm[c] = temp.pm[c+1];
  
temp.pm[c+1] = makevar("temp.var" 1);

What's the difference between these two?
If I replace them why won't it work?

Last edited by Stryke; 05-30-2008 at 11:28 PM..
Reply With Quote
  #2  
Old 06-01-2008, 03:09 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Uhm, in the second, the loop is running one time more then it should (will produce a var5)

In your first example you first set all the var# to array[b], list[b], blol[b] and blob[b], but in your second example they're all params[b], and then you suddenly use 'temp.pm'(params[c]) in the second example when it should be params[b].. I'm not going to continue explaining since the examples uses different variables, but in the end, they're not equal..

What is b? Why does params[] represent array[], list[], blol[] and blob[]?

You need to show better examples or word your question better :o
__________________
Reply With Quote
  #3  
Old 06-01-2008, 09:21 PM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
The function used:

SortPlayers( array , list , blol , blob);

params[0] = array.
params[1] = list.
params[2] = blol.
params[3] = blob.

Oops at : makevar("temp.var" @ c + 1) = params[b];
That should be params[3].

Here's the full code tell me what you see is different:

PHP Code:
function SortPlayers( list , array , bol blob )
{
  
temp.result "";
  for(
0< array.size() - 1++;)
  {
    for(
0< array.size() - 1++;)
    {
      if(array[
b] < array[b+1])
      {
        for(
04c++;) 
        { 
          
makevar("temp.var" 1) = makevar(params[c]@"["@(b)@"]");
          
makevar(params[c]@"["@(b)@"]") = makevar(params[c]@"["@(b+1)@"]");
          
makevar(params[c]@"["@(b+1)@"]") = makevar("temp.var" 1); 
        }  
      }
    }
  }
  return list;


Last edited by Stryke; 06-01-2008 at 09:37 PM..
Reply With Quote
  #4  
Old 06-01-2008, 09:40 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Stryke View Post
Here's the full code tell me what you see is different:

PHP Code:
... 
But why do you need to see the difference? Doesn't yours work? Does it work?

And, is this for something like a score system? It records who has the most money on the server etc.?
__________________
Reply With Quote
  #5  
Old 06-01-2008, 11:25 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
HTML Code:
function onCreated() {
  for (temp.i: allplayers) 
    temp.accs.add({i, i.rupees});
    
  for (i: accs) {
    temp.e.add(i[0]);
    temp.e[temp.c].sortvalue = i[1];
    temp.c++;
  }
  e.sortbyvalue("sortvalue", "float", false);
  
  for (i = 0; i < accs.size(); i++) 
    echo(e[i] SPC e[i].rupees);
}  
should do it
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 04:44 PM.


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