Skip to main content
GameDev.net gamedev.net
🔒 Locked

pushing/pulling items in an array...

Started by Krisc May 11, 2003 at 2:30 AM 1 replies 200+ views
Original Post
Krisc
Krisc
I''m writing a console in my game and I have an array called myHistory to keep the history of console commands so everytime a new command is entered, all the previous ones have to be pushed/pulled up one spot and the last one forgotten...so I know this is VB.NET but please bare with me...you should be able to get it... Public Function ConsoleHitEnter() Dim i As Integer = 0 For i = UBound(myHistory, 1) To 1 myHistory(i) = myHistory(i - 1) Next myHistory(0) = ConsoleString ConsoleString = "" End Function ConsoleString is the current command being entered into myHistory...I believe this should work, but all it does is change myHistory(0) to ConsoleString...and set ConsoleString to ""...thanks! <- Digital Explosions -> "Discipline is my sword, faith is my shield do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)
Krisc
Krisc
awww comon, someone should know this...

btw, feel free to post in C++, I know C++ as well and can translate...


<- Digital Explosions ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)

[edited by - Krisc on May 11, 2003 12:14:42 PM]
Krisc
Krisc
Nevermind, I have to put in

Step -1

at the end of the for statement because it doesn''t know to step -1 automatically...

<- Digital Explosions ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.