Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   converting to gs2 (https://forums.graalonline.com/forums/showthread.php?t=66964)

excaliber7388 06-26-2006 05:55 PM

converting to gs2
 
So far, this is the only really annoying thing about gs2: Strings. More specifically, variables in string names. Of course, that might not be the problem here, who knows.
Anyway, this works in gs1, not gs2 I blame the strings, however I may have screwed something up when transfering it to gs2. The action IS received, and the parameter is read.
PHP Code:

if(params[0]=="buy")
  {
    if(
player.rupees>=("serverr.market_" params[1] @ "_price"))
    {
      
addweapon ("serverr.market_" params[1] @ "_item");
      
player.rupees-=("serverr.market_" params[1] @ "_price");
      
with(findplayer(("serverr.market_" params[1] @ "_acct")))
      {
        
player.rupees+=("serverr.market_" params[1] @ "_price");
        
player.chat="You sold something at the market!";
      }
    (
"serverr.market_" params[1] @ "_item")=0;
    (
"serverr.market_" params[1] @ "_acct")=0;
    (
"serverr.market_" params[1] @ "_img")=0;
    (
"serverr.market_" params[1] @ "_price")=0;
    }
  } 


Skyld 06-26-2006 06:15 PM

You must not put periods inside the string name like that.
This is correct:
PHP Code:

serverr.("market_" params[1] @ "_price") = 0;
serverr.("mystring_" temp.number).("morefoo_" temp.bzz) = 0


ApothiX 06-27-2006 07:03 AM

Expanding on what Skyld said: Periods do work if you're using makevar() as opposed to the foo.("bar") format. ie: makevar("clientr.myname") = "Okiesmokie" is equal to: clientr.(@"myname") = "Okiesmokie";


All times are GMT +2. The time now is 11:00 AM.

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