![]() |
Help with random texts
Trying to test my GUI skills, since I haven't for a LONG time.
So I have a confirmation code that is supposed to come out random from 3 sets of letters/numbers. I have all of those as this.beg, this.mid, this.end and I set up the temp.confCode as follows PHP Code:
One example is "035" How can I get it to display as TEXT? And on a side note: How do I set text to save as a log/*.txt file from a serverside script? |
If I remember correctly, random(start, end) will only return a random number within [start, end)
It's a bit different to generate a random character. Here's one way to generate a random upper-case letter: PHP Code:
Or, you could predefine an array of all the characters you want to include in your random strings, then use randomstring(). Example: PHP Code:
Example: PHP Code:
|
Quote:
++rep if i could. gotta spread :( edit: I did temp.confCode=randomString(this.beg) etc., and it didn't work. It shows up as blank in the GUI. |
Quote:
randomstring() takes in an array of strings and outputs a random element. |
PHP Code:
Edit: Found the problem! Had to use thiso.confCode inside of the GuiMLTextCtrl, and put the randomize setter outside of the GUI. |
just so its out there, you can also savelog2 folder types [always give the NPC server additional rights though!]
savelog2("items/hugeasslog.txt", "wurr"); savelog2("staff/xAndrewx", "hot damn"); etc |
All times are GMT +2. The time now is 04:35 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.