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 09-11-2007, 10:49 PM
RyDaze RyDaze is offline
Graal682686
RyDaze's Avatar
Join Date: Sep 2007
Location: Utopia
Posts: 43
RyDaze is an unknown quantity at this point
Send a message via AIM to RyDaze Send a message via MSN to RyDaze
Question For() with strings?

Ok i want to make scripts short and simple as possible.. So is there any way to make a script using the for() to add a number and get the string info with out just making the string like a word (i have problems with this z.Z)..

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
this.station 1;
  
onLoad();
}
function 
onLoad(){
  
temp.startstring "serverr.station"//serverr.station.# = info,info,info...;
  
temp.stations serverr.stations//serverr.stations = 2;
  
for(i=0i<temp.stations+1i++) {
    
this.station i;
  }
  
onRadio();
}
function 
onRadio(){
  
temp.info = @temp.startstring"." @this.station//this post to return.. info,info,info...;
  //but it just returns 0 or just thinks its just "server.station.1" (thinks of it as a word not a string)

__________________

Support Center | Forum Rules | Graal Staff Contacts

A little knowledge is dangerous. So is a lot.



Reply With Quote
  #2  
Old 09-11-2007, 11:16 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.station 1;
  
onLoad();
}
function 
onLoad() {
  
temp.startstring "serverr.station"//serverr.station.# = info,info,info...;
  
temp.stations serverr.stations//serverr.stations = 2;
  
for (0temp.stations 1++) {
    
this.station i;
  }
  
onRadio();
}
function 
onRadio() {
  
temp.info serverr.station.(@ this.station); //this post to return.. info,info,info...;
  //but it just returns 0 or just thinks its just "server.station.1" (thinks of it as a word not a string)

temp. strings are unique to a function and cannot be accessed outside of the function, they are cleared when the function ends.

Also, I really have no idea what you're trying to do with that script, it doesn't look like its doing anything.
__________________
Reply With Quote
  #3  
Old 09-11-2007, 11:22 PM
RyDaze RyDaze is offline
Graal682686
RyDaze's Avatar
Join Date: Sep 2007
Location: Utopia
Posts: 43
RyDaze is an unknown quantity at this point
Send a message via AIM to RyDaze Send a message via MSN to RyDaze
its just an example, like theres a server string called, "serverr.station.1="head.png","UniStation","RyDaze : Hello","stationlink","hat-.png"

Anywho im trying to make a script that takes for() and takes info from a server string, aka "this.stationinfo = @serverr.station@ "." @this.station;"
this.stationinfo = this.stationinfo.tokenize();

than after that works i can use the "this.stationinfo[1]" and stuff for the radio display instead of making it detect check what station your on and than making the script really long depending on how many stations there are.. so i wont have to add like another display for station2 that contains station2 strings.. i want it to be one display that auto changes the this.stationinfo, when this.station changes to a diffrent #.
__________________

Support Center | Forum Rules | Graal Staff Contacts

A little knowledge is dangerous. So is a lot.



Reply With Quote
  #4  
Old 09-11-2007, 11:31 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
temp.stations.size()+1
Reply With Quote
  #5  
Old 09-11-2007, 11:37 PM
RyDaze RyDaze is offline
Graal682686
RyDaze's Avatar
Join Date: Sep 2007
Location: Utopia
Posts: 43
RyDaze is an unknown quantity at this point
Send a message via AIM to RyDaze Send a message via MSN to RyDaze
Ok.. maybe im not getting my problem out clearly? or something.. So here goes nothing!

Quote:
Anywho im trying to make a script that takes for() and takes info from a server string, aka "this.stationinfo = @serverr.station@ "." @this.station;"
this.stationinfo = this.stationinfo.tokenize();
Thats the part i really having a problem to do.. because when ever i try something like that, the first part "this.stationinfo = @serverr.station@ "." @this.station;" it just displays as text instead of a string.. So how i make it get info from the string even if the this.station changes from = 1 to 2 or w\e?
__________________

Support Center | Forum Rules | Graal Staff Contacts

A little knowledge is dangerous. So is a lot.



Reply With Quote
  #6  
Old 09-11-2007, 11:42 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
this.stationinfo = serverr.station.(@this.station).tokenize();

maybe? The script doesn't make much sense in the end... Perhaps onRadio should be doing

return serverr.station.(@this.station).tokenize(); if you want the function to return an array to the calling function.
Reply With Quote
  #7  
Old 09-11-2007, 11:46 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
Well for one:
temp.startstring = "serverr.station";
temp.startstring is going to = serverr.station, not the value of serverr.station, because you enclosed the variable in quotations.
temp.startstring = serverr.station;
Also what Inverness said, you can't pass temp.vars from one function to another(unless you pass the temp.var in the function parameters, which you should do in this case).
Reply With Quote
  #8  
Old 09-11-2007, 11:54 PM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by RyDaze View Post
So how i make it get info from the string even if the this.station changes from = 1 to 2 or w\e?
Like Inverness said, serverr.station.(@ this.station) should do it for you. If that doesn't work it might be serverr.station.(this.station)
__________________
Reply With Quote
  #9  
Old 09-12-2007, 12:30 AM
RyDaze RyDaze is offline
Graal682686
RyDaze's Avatar
Join Date: Sep 2007
Location: Utopia
Posts: 43
RyDaze is an unknown quantity at this point
Send a message via AIM to RyDaze Send a message via MSN to RyDaze
Ok, thanks
__________________

Support Center | Forum Rules | Graal Staff Contacts

A little knowledge is dangerous. So is a lot.



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:46 PM.


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