![]() |
String Arrays
I am trying to become a better scripter and I have learned variable arrays and I came up with this script as a test:
// NPC made by SaijinGohan if (created) { this.test = {random(1,20),random(1,20), random(1,20),random(1,20),random(1,20), random(1,20),random(1,20),random(1,20), random(1,20),random(1,20)}; timeout = 1; } if (timeout) { a = this.test[random(1,9)]; message #v(a); timeout = 1; } Will anyone teach me string arrays or manipulate this test to use string arrays? ;) |
I think this is your basic string array:
setarray name,size; so if (created){ setarray test,3; } if (playerchats&&strequals(#c,test1)){ test[0]=1; } if (playerchats&&strequals(#c,test2)){ test[1]=1; } if (playerchats&&strequals(#c,test3)){ test[2]=1; } That's just a basic thing with arrays [EDIT] here's your script converted into string arrays if (created) { setarray test,10; for(i=0;i<=10;i++) {sleep.05; test[i]=random(4,20); timeout = .05; }} if (timeout) { a = test[random(1,9)]; message #v(a); timeout = .05; } [/EDIT] |
Quote:
|
| All times are GMT +2. The time now is 03:38 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.