-
3DFA hobby scripter
Load / Save Array
I've made a function to load an array some years ago:
(creating an Array out of an variable with values separated by commas)
Code:
array1 =new Array()
function read(txt){
t_le = txt.length; st=0;
for (a=0; a<=t_le; a++){
if (txt.slice(a, a+1) == ","){ // seperator
array1.push(txt.slice(st, a));
st = a+1;
}
}
}
my php save script: (very simple ^^)
PHP Code:
<?php $fp=fopen ($filename,'w'); fwrite($fp,"&variablename=".$variablefrom3dfa); fclose ($fp); ?>
I'm tired of copying my read function in every movie that loads an array from a textfile, so I wanna ask:
Is there a better/other way to load/save an array from/to a text file?
-
3DFA hobby scripter
-
3DFA hobby scripter
help
I'm working on a chat bot,
And so I (think that I) have to work with such an Tree-Array
There must be a way to save/improve that
please help me
Code:
/*
// 1 = [0-u] 0=user, 1=bot, 2=user, ...
// 2 = [0-6] referring top category
// 3 = [0-6] sub category
// 4 = [0-6] nr
//1 2 3 4
a[0][0][0][0] = "hello" // user
a[0][0][0][1] = "hi" // user
a[0][0][0][2] = "hey" // user
// |
// |
// V
a[1][0][0][0] = "hello" // bot
a[1][0][0][1] = "hi" // bot
a[1][0][0][2] = "hey" // bot
a[1][0][0][3] = "hey hey" // bot
a[1][0][0][4] = "hi there" // bot
// end
// Or:
a[1][0][1][0] = "hi, how are you?" // bot
a[1][0][1][1] = "hey, how are you?" // bot
// |
// |
// V
a[2][1][0][0] = "good" // user
a[2][1][0][1] = "great" // user
a[2][1][0][2] = "perfect" // user
// |
// |
// V
a[3][0][0][0] = "I'm too" // bot
a[3][0][0][1] = "same" // bot
a[3][0][0][2] = "great!" // bot
// end
a[2][1][1][0] = "bad" // user
a[2][1][1][1] = "not good" // user
a[2][1][1][2] = "very bad" // user
a[2][1][1][3] = "not so good" // user
// |
// |
// V
a[3][1][0][0] = "oh what happend?" // bot
a[3][1][0][1] = "oh souds awefull!" // bot
a[3][1][0][2] = "oh,why that?" // bot
// end
a[1][0][2][0] = "hi, finall someone is on! who are you?" // bot
a[1][0][2][1] = "hey there, whats your name?" // bot
a[1][0][2][2] = "hi, ehm who are you?" // bot
a[1][0][2][3] = "hey who is there?" // bot
// |
// |
// V
a[2][2][0][0] = "#name" // user
a[2][2][0][1] = "I'm #name" // user
a[2][2][0][2] = "my name is #name" // user
a[2][2][0][3] = "hallo, ich bins #name" // user
a[2][2][0][4] = "man nennt mich #name" // user
// |
// |
// V
a[2][0][0][0] = "hi #name" // bot
a[2][0][0][1] = "hey #name" // bot
a[2][0][0][2] = "hi #name I'm #botname" // bot
a[2][2][1][0] = "I won't tell you" // user
a[2][2][1][1] = "anonym" // user
*/
-
Senior Member
Other than the standard Actionscript Array methods for handling arrays of strings, i'm not sure of any better way to handle string arrays other than to use XML.
Cheers,
kusco
(3DFA Support Team)
-
3DFA hobby scripter
ahh, good idea, I'll try that
-
3DFA hobby scripter
hmm I have no idea ho to do it?
is that ok?
Code:
<kI>
<start>
<cat1>
<1>hi</1>
<2>hello</2>
<3>hey</3>
<4>whats up</4>
<answer>
<1>hi</1>
<2>hello</2>
<3>hey</3>
</answer>
</cat1>
<cat2>
<1>whazzup</1>
<2>whats up</2>
<answer>
<1>nothing</1>
<2>not much</2>
<input>
<cat1>
<1>me, too</1>
<2>yeah, same</2>
<answer>
<1>hmm</1>
<2>yeah</2>
</answer>
</cat1>
<else>
<answer>
<1>oh, really?</1>
</answer>
</else>
</input>
</answer>
</cat2>
</start>
</kI>
but how can I use the xml date in 3dfa
-
3DFA hobby scripter
Is there a function to convert an array to a string and back,
like in in PHP the serialize() and unserialize ()?
-
Senior Member
I'm new to PHP so i'm not going to be much help. Your scripts are impressive...
Zoranan
-
3DFA hobby scripter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|